/* 文件名:luke.nut 路径:Plugins/Luke/luke.nut 创建日期:2023-03-30 13:40 文件用途:卢克主文件 */ //HudPro按钮类 class LukeButtonPro extends BasicsDrawTool // obj -- 按钮名称 -- X坐标 -- Y坐标 -- Ani调用路径 -- 宽度 -- 高度 { obj = null; //Obj对象 State = 0; //按钮状态 ClickEnble = false; //点击效果 ButtonDynamic = false; //动态按钮效果 Index = 0; CustomClickEnble = false; //自定义点击效果 CustomClickAnifile = null; //自定义点击效果Ani路径 CustomButtonName = null; //自定义点击效果名称 CustomClickFrame = null; //自定义点击效果Ani编号 CustomClickx = null; //自定义点击效果X坐标 CustomClicky = null; //自定义点击效果Y坐标 RectEnble = false; //悬停效果 RectButtonName = null; //悬停名称 RectBaseAnifile = null; //悬停Ani路径 RectFrame = null; //非动态按钮的悬停调用Ani编号 Rectx = null; //悬停X坐标 Recty = null; //悬停Y坐标 ButtonName = null; //按钮名称 x = null; //X坐标 y = null; //Y坐标 BaseAnifile = null; //调用Ani路径 width = null; //可点击宽度 length = null; //可点击高度 //构造函数 constructor(gObj, gButtonName, gX, gY, gAnifile, gWidth, gLength, gIndex) { obj = gObj; ButtonName = gButtonName; x = gX; y = gY; BaseAnifile = gAnifile; width = gWidth; length = gLength; Index = gIndex; } //绘制按钮 function Show() { isLBDown(); isRBDown(); if (ClickEnble) //是否开启点击效果 { if (isLBDown() && State == 0) //按下左键并且按钮处于弹起状态 { State = 1; //按键进入按下状态 ++y; } if (!isLBDown() && State == 1) //按下左键并且按钮处于弹起状态 { State = 0; //按键进入弹起状态 --y; } } if (CustomClickEnble) //是否开启自定义点击效果 { if (isLBDown()) //按下左键并且按钮处于弹起状态 { if (!ButtonDynamic) T_DrawStayAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomClickFrame, CustomButtonName); else T_DrawDynamicAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomButtonName); } } if (RectEnble) //开启悬停效果时 { if ((isInRect() && !isLBDown()) || (isInRect() && !CustomClickEnble)) //如果鼠标悬停的时候 并且没有点击的时候 { //IMouse.SetMouseTask(44); if (!ButtonDynamic) T_DrawStayAni(obj, RectBaseAnifile, Rectx, Recty, RectFrame, RectButtonName); else T_DrawDynamicAni(obj, RectBaseAnifile, Rectx, Recty, RectButtonName); } } if (!isInRect()) //如果鼠标没有悬停的时候 { //IMouse.SetMouseTask(0); if (!ButtonDynamic) T_DrawStayAni(obj, BaseAnifile, x, y, Index, ButtonName); else T_DrawDynamicAni(obj, BaseAnifile, x, y, ButtonName); } } //设置自定义点击效果 function SetCustomClickEnble(bool, gButtonName, gX, gY, gAnifile, gFrame) { CustomClickEnble = bool; //自定义点击效果 CustomClickAnifile = gAnifile; //自定义点击效果Ani路径 CustomButtonName = gButtonName; //自定义点击效果名称 CustomClickFrame = gFrame; //自定义点击效果Ani编号 CustomClickx = gX; //自定义点击效果X坐标 CustomClicky = gY; //自定义点击效果Y坐标 } //设置悬停效果 function SetRectEnble(bool, gButtonName, gX, gY, gAnifile, gFrame) { RectEnble = bool; //悬停效果 RectButtonName = gButtonName; //悬停名称 RectBaseAnifile = gAnifile; //悬停Ani路径 RectFrame = gFrame; //非动态按钮的悬停调用Ani编号 Rectx = gX; //悬停X坐标 Recty = gY; //悬停Y坐标 } //设置动态按钮 function SetClickEnble(bool) { ButtonDynamic = bool; } //设置点击效果 function SetClickEnble(bool) { ClickEnble = bool; } //悬停状态 function isInRect() { if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 5, 5, x, y, width, length)) return true; else return false; } //左键按下状态 function isLBDown() { if (isInRect() && IMouse.GetLButton() == 1) { obj.getVar(ButtonName).setBool(0, true); return true; } else return false; } //右键按下状态 function isRBDown() { if (isInRect() && IMouse.GetRButton() == 2) { obj.getVar(ButtonName).setBool(1, true); return true; } else return false; } //左键弹起状态 function isLBUp() { if (isInRect() && IMouse.GetLButton() == 0) return true; else return false; } //左键双击状态 function IsLBDoubleClick() { if (isInRect() && IMouse.GetLButton() == 64) return true; else return false; } //左键单击状态 function isLBActive() { if (isInRect() && IMouse.isButtonUpEvent() && obj.getVar(ButtonName).getBool(0) == true) { obj.getVar(ButtonName).setBool(0, false); return true; } else return false; } //右键单击状态 function isRBActive() { if (isInRect() && IMouse.isButtonUpEvent() && obj.getVar(ButtonName).getBool(1) == true) { obj.getVar(ButtonName).setBool(1, false); return true; } else return false; } //别处点击 function isNotLBActive() { if (!isInRect() && IMouse.isButtonUpEvent()) return true; else return false; } //别处右键点击 function isNotRBActive() { if (!isInRect() && IMouse.GetRButton() == 2) return true; else return false; } } //Switch按钮类 class LukeSwitchButtonPro extends SwitchButtonPro { obj = null; //Obj对象 State = 0; //按钮状态 ClickEnble = false; //点击效果 ButtonDynamic = false; //动态按钮效果 SwitchState = false; //复选框是否选中 CustomClickEnble = false; //自定义点击效果 CustomClickAnifile = null; //自定义点击效果Ani路径 CustomButtonName = null; //自定义点击效果名称 CustomClickFrame = null; //自定义点击效果Ani编号 CustomClickx = null; //自定义点击效果X坐标 CustomClicky = null; //自定义点击效果Y坐标 RectEnble = false; //悬停效果 RectButtonName = null; //悬停名称 RectBaseAnifile = null; //悬停Ani路径 RectFrame = null; //非动态按钮的悬停调用Ani编号 Rectx = null; //悬停X坐标 Recty = null; //悬停Y坐标 ButtonName = null; //按钮名称 x = null; //X坐标 y = null; //Y坐标 BaseAnifile = null; //调用Ani路径 BaseAnifileFrame = null; //调用的Ani帧数 width = null; //可点击宽度 length = null; //可点击高度 //构造函数 constructor(gObj, gButtonName, gX, gY, gAnifile, gBaseAnifileFrame, gWidth, gLength) { obj = gObj; ButtonName = gButtonName; x = gX; y = gY; BaseAnifile = gAnifile; BaseAnifileFrame = gBaseAnifileFrame; width = gWidth; length = gLength; } //绘制按钮 function Show() { if (ClickEnble) //是否开启点击效果 { if (isLBDown() && State == 0) //按下左键并且按钮处于弹起状态 { State = 1; //按键进入按下状态 ++y; } if (!isLBDown() && State == 1) //按下左键并且按钮处于弹起状态 { State = 0; //按键进入弹起状态 --y; } } if (CustomClickEnble) //是否开启自定义点击效果 { if (isLBDown()) //按下左键并且按钮处于弹起状态 { if (!ButtonDynamic) T_DrawStayAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomClickFrame, CustomButtonName); else T_DrawDynamicAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomButtonName); } } if (RectEnble) //开启悬停效果时 { if ((isInRect() && !isLBDown()) || (isInRect() && !CustomClickEnble)) //如果鼠标悬停的时候 并且没有点击的时候 { //IMouse.SetMouseTask(44); if (!ButtonDynamic) T_DrawStayAni(obj, RectBaseAnifile, Rectx, Recty, RectFrame, RectButtonName); else T_DrawDynamicAni(obj, RectBaseAnifile, Rectx, Recty, RectButtonName); } } if (!isInRect() && !SwitchState) //如果鼠标没有悬停的时候 { //IMouse.SetMouseTask(0); if (!ButtonDynamic) T_DrawStayAni(obj, BaseAnifile, x, y, BaseAnifileFrame, ButtonName); else T_DrawDynamicAni(obj, BaseAnifile, x, y, ButtonName); } if (!isInRect() && SwitchState) { if (!ButtonDynamic) T_DrawStayAni(obj, RectBaseAnifile, Rectx, Recty, RectFrame, RectButtonName); else T_DrawDynamicAni(obj, RectBaseAnifile, Rectx, Recty, RectButtonName); } } //设置自定义点击效果 function SetCustomClickEnble(bool, gButtonName, gX, gY, gAnifile, gFrame) { CustomClickEnble = bool; //自定义点击效果 CustomClickAnifile = gAnifile; //自定义点击效果Ani路径 CustomButtonName = gButtonName; //自定义点击效果名称 CustomClickFrame = gFrame; //自定义点击效果Ani编号 CustomClickx = gX; //自定义点击效果X坐标 CustomClicky = gY; //自定义点击效果Y坐标 } //设置悬停效果 function SetRectEnble(bool, gButtonName, gX, gY, gAnifile, gFrame) { RectEnble = bool; //悬停效果 RectButtonName = gButtonName; //悬停名称 RectBaseAnifile = gAnifile; //悬停Ani路径 RectFrame = gFrame; //非动态按钮的悬停调用Ani编号 Rectx = gX; //悬停X坐标 Recty = gY; //悬停Y坐标 } //设置动态按钮 function SetClickEnble(bool) { ButtonDynamic = bool; } //设置点击效果 function SetClickEnble(bool) { ClickEnble = bool; } //悬停状态 function isInRect() { if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 5, 5, x, y, width, length)) return true; else return false; } //左键按下状态 function isLBDown() { if (isInRect() && IMouse.GetLButton() == 1) return true; else return false; } //左键弹起状态 function isLBUp() { if (isInRect() && IMouse.GetLButton() == 0) return true; else return false; } //左键双击状态 function IsLBDoubleClick() { if (isInRect() && IMouse.GetLButton() == 64) return true; else return false; } //左键单击状态 function isLBActive() { if (isInRect() && IMouse.isButtonUpEvent()) return true; else return false; } } function Luke(obj) { //如果不在安图恩区域则不执行 if (L_sq_GetTownIndex() != 19 || L_sq_GetRegionIndex() < 2) return; //检查自己是否断线重连 if (!getroottable().rawin("LukeDConnect")) { local LukeDConnect = Json_STL("LukeDConnect"); LukeDConnect.Put("op", 25600175); local str = LukeDConnect.GetString(); L_sq_SendPackType(130); L_sq_SendPackWChar(str); L_sq_SendPack(); LukeDConnect.Delete(); getroottable().rawset("LukeDConnect", true); } //卢克攻坚队逻辑 LukeParty(obj); //卢克城镇攻坚队界面 攻坚队队伍信息部分 LukeTownMainControl_PartyInfo(obj); //卢克攻坚副本信息 LukeDungeonInfoControlFunc(obj); //安图恩城镇攻坚队界面 攻坚队队伍申请部分 LukeTownMainControl_PartyReq(obj); } function DrawLukeParty(obj) { local RootTab = getroottable(); if (RootTab.rawin("LukePartyObj") && RootTab.rawin("LUKEDUNGEONINFOCONTROL") && RootTab["LUKEDUNGEONINFOCONTROL"].PageState != 1) { RootTab["LukePartyObj"].Draw(obj); } if (RootTab.rawin("LukeTOWNCONTROLINFO") && RootTab["LukePartyObj"].NowSelectTeam != null && RootTab["LukePartyObj"].State == 1) { RootTab["LukeTOWNCONTROLINFO"].Run(obj); } if (RootTab.rawin("LUKEDUNGEONINFOCONTROL") == false) {} else { RootTab["LUKEDUNGEONINFOCONTROL"].Draw(obj); } if (RootTab.rawin("LUKETOWNMAINCONTROLREQ") == false) {} else { RootTab["LUKETOWNMAINCONTROLREQ"].Run(obj); } //如果安图恩主界面开启就绘制申请队伍人信息 }