From af522dcecb72d1810f0ca6fa0bd887d20eae72a1 Mon Sep 17 00:00:00 2001 From: Lenheart <947330670@qq.com> Date: Mon, 25 Mar 2024 20:51:30 +0800 Subject: [PATCH] 11123 --- DofileList.nut | 1 + DrawMainCustomUi/DrawMainCustomUi_All.nut | 31 +- .../Sq_DrawMainMaxLayerCustomUI.nut | 3 +- Plugins/100UI/100UI.nut | 2 +- Plugins/Fiendwar/Fiendwar.nut | 16 +- Plugins/Fiendwar/FiendwarHall.nut | 2 +- Plugins/Fiendwar/FiendwarHallCreateParty.nut | 116 +++++- Tool/UiClassTool.nut | 357 ++++++++++++++++++ dnf_enum_header.nut | 2 +- 9 files changed, 507 insertions(+), 23 deletions(-) create mode 100644 Tool/UiClassTool.nut diff --git a/DofileList.nut b/DofileList.nut index bfa8487..0e74814 100644 --- a/DofileList.nut +++ b/DofileList.nut @@ -18,6 +18,7 @@ dofile("sqr/LenheartCallBack/Sq_MouseEventCallBack.nut"); //鼠标点击回调 //---@工具API类 dofile("sqr/Tool/Tool.nut"); //主要拓展API工具类 dofile("sqr/Tool/ClassTool.nut"); //主要拓展API工具类 +dofile("sqr/Tool/UiClassTool.nut"); //UI dofile("sqr/Tool/DebugInfo.nut"); //输出人物主要信息类 //----------------------------------------------------------------------------------------------------- diff --git a/DrawMainCustomUi/DrawMainCustomUi_All.nut b/DrawMainCustomUi/DrawMainCustomUi_All.nut index e8fea91..5ef83c4 100644 --- a/DrawMainCustomUi/DrawMainCustomUi_All.nut +++ b/DrawMainCustomUi/DrawMainCustomUi_All.nut @@ -161,8 +161,23 @@ function drawMainCustomUI_All(obj) { // local Item = ItemInfoClass(InfoTable); // Item.Show(200, 200); + // local InfoW = sq_GetPopupWindowMainCotrol(74); - + // if(InfoW){ + // print(InfoW.IsOverAbsolutely()); + // } + // local Lnnn = 0; + // for (local i = 0; i< 400; i++) { + // if (i == 176 || i == 1) continue; + // local InfoW = sq_GetPopupWindowMainCotrol(i); + // if (InfoW) { + // // print("Pos_X : " + InfoW.GetXPos()); + // // print("Pos_Y : " + InfoW.GetYPos()); + // print("WindowsId: " + i); + // // Lnnn++; + // } + // } + // print(Lnnn); // if (KeyPress.isKeyPress(78)) { // //local itemSS = sq_GetPopupWindowMainCotrol(170); @@ -170,7 +185,7 @@ function drawMainCustomUI_All(obj) { // // local Skill = sq_GetSkill(obj, 1); // //local chrobj = sq_CreateCharacter(1, 4); - // local Win = sq_GetPopupWindowMainCotrol(176); + // local Win = sq_GetPopupWindowMainCotrol(74); // print("-----------------------------------------------/"); // foreach(member, val in Win.getclass()) { // ::print(member + "\n"); @@ -324,6 +339,7 @@ function drawMainCustomUI_All(obj) { BasicsDrawTool.InitClass("LUKEDUNGEONINFOCONTROL"); + L_Windows_List = []; BasicsDrawTool.InitClass("FiendwarCObj"); BasicsDrawTool.InitClass("FiendwarHallCObj"); BasicsDrawTool.InitClass("FiendwarHallCreatePartyCObj"); @@ -333,8 +349,6 @@ function drawMainCustomUI_All(obj) { } - - if (KeyPress.isKeyPress(77)) { /* local T = { @@ -497,6 +511,7 @@ function drawMainCustomUI_All(obj) { // L_sq_Open_ExWindow2(0x1ADE090, 69, "asdasd", 0); + } @@ -528,7 +543,6 @@ function drawMainCustomUI_All(obj) { // setVisibleInput(); // L_sq_NewInputBox(0, 0, 100, 20); // L_sq_Open_ExWindow(0x1ADE090, 269, 0, 1); - L_NewWindows("Lenheart", 24, 0x65535); } @@ -537,8 +551,11 @@ function drawMainCustomUI_All(obj) { //L_sq_DrawImg("common/etc/combo.img", 0, 100, 100, 0, sq_RGBA(255, 255, 255, 250), 1.0, 1.0); // local Ani = obj.getCurrentAnimation(); // Ani.setEffectLayer(true, 6, true, sq_RGB(255, 0, 0), sq_ALPHA(100), true, true); - - + // print("Mouse_Left: " + L_sq_RA(0x1B46874)); + // print("Mouse_Right: " + L_sq_RA(0x1B46878)); + // print("Mouse_XPos: " + L_sq_RA(0x1B4686C)); + // print("Mouse_YPos: " + L_sq_RA(0x1B46870)); + // print(IMouse); if (RootTab.rawin("TestScobj")) { diff --git a/LenheartCallBack/Sq_DrawMainMaxLayerCustomUI.nut b/LenheartCallBack/Sq_DrawMainMaxLayerCustomUI.nut index 6a9558f..ff0312b 100644 --- a/LenheartCallBack/Sq_DrawMainMaxLayerCustomUI.nut +++ b/LenheartCallBack/Sq_DrawMainMaxLayerCustomUI.nut @@ -57,12 +57,11 @@ function Sq_DrawMainMaxLayerCustomUI(pack) { } + Lenheartancient(obj); LenheartSeverNotiAnimotion(obj); - - } diff --git a/Plugins/100UI/100UI.nut b/Plugins/100UI/100UI.nut index c1821ed..3776a7a 100644 --- a/Plugins/100UI/100UI.nut +++ b/Plugins/100UI/100UI.nut @@ -409,7 +409,7 @@ function Lenheart_100UI(obj) { function Lenheart_100UITop(obj) { - Lenheart_100UI_DrawSkillAddSystem(obj); + // Lenheart_100UI_DrawSkillAddSystem(obj); //悬停层绘制 { diff --git a/Plugins/Fiendwar/Fiendwar.nut b/Plugins/Fiendwar/Fiendwar.nut index 2025816..1a69f51 100644 --- a/Plugins/Fiendwar/Fiendwar.nut +++ b/Plugins/Fiendwar/Fiendwar.nut @@ -76,14 +76,16 @@ function LenheartFiendwar(obj) { RootTab["FiendwarHallCObj"].Draw(obj); } + //创建队伍框 - if (!RootTab.rawin("FiendwarHallCreatePartyCObj")) { - local Cobj = FiendwarHallCreatePartyC(); - RootTab.rawset("FiendwarHallCreatePartyCObj", Cobj); - } else { - RootTab["FiendwarHallCreatePartyCObj"].Proc(obj); - RootTab["FiendwarHallCreatePartyCObj"].Draw(obj); - } + FiendwarHallCreatePartyC("超时空创建队伍窗口",290, 220, 284, 154, 18); + // if (!RootTab.rawin("FiendwarHallCreatePartyCObj")) { + // FiendwarHallCreatePartyC("超时空创建队伍窗口",290, 220, 200, 200, 20); + // // RootTab.rawset("FiendwarHallCreatePartyCObj", Cobj); + // } else { + // // RootTab["FiendwarHallCreatePartyCObj"].Proc(obj); + // // RootTab["FiendwarHallCreatePartyCObj"].Draw(obj); + // } } if (getroottable().rawin("LenheartFuncTab")) { diff --git a/Plugins/Fiendwar/FiendwarHall.nut b/Plugins/Fiendwar/FiendwarHall.nut index fa09011..0f4fdb5 100644 --- a/Plugins/Fiendwar/FiendwarHall.nut +++ b/Plugins/Fiendwar/FiendwarHall.nut @@ -102,7 +102,7 @@ class FiendwarHallTeamC extends BasicsDrawTool { class FiendwarHallC extends BasicsDrawTool { WindowObj = null; //窗口对象 - MainState = true; //主状态 + MainState = false; //主状态 X = 320; Y = 40; diff --git a/Plugins/Fiendwar/FiendwarHallCreateParty.nut b/Plugins/Fiendwar/FiendwarHallCreateParty.nut index c347a89..56b6b2b 100644 --- a/Plugins/Fiendwar/FiendwarHallCreateParty.nut +++ b/Plugins/Fiendwar/FiendwarHallCreateParty.nut @@ -4,7 +4,7 @@ 创建日期:2024-03-18 13:20 文件用途: */ - +/* class FiendwarHallCreatePartyC extends BasicsDrawTool { WindowObj = null; //窗口对象 MainState = true; //主状态 @@ -76,12 +76,13 @@ class FiendwarHallCreatePartyC extends BasicsDrawTool { if (MainState) { if (WindowObj) { DrawMain(obj); - WindowObj.Show(obj); + // WindowObj.Show(obj); X = WindowObj.X; Y = WindowObj.Y; } else { - WindowObj = LenheartWindow(X, Y, 800, 600, 28); //坐标 大小 标题栏高度 - // WindowObj.DeBugMode = true; + WindowObj = LenheartNewUI.Windows(X, Y, 800, 600, 28); //坐标 大小 标题栏高度 + WindowObj.Init(this); + WindowObj.DeBugMode = true; } } else { if (WindowObj && WindowObj.YMouseSw == false) { @@ -98,4 +99,111 @@ class FiendwarHallCreatePartyC extends BasicsDrawTool { MainState = false; } } +} +*/ + + +class FiendwarHallCreatePartyC extends LenheartNewUI.Windows { + //调试模式 + DeBugMode = true; + + WindowObj = null; //窗口对象 + MainState = true; //主状态 + X = 290; + Y = 220; + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + return LenheartNewUI.Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + } + + function GetInstance() { + return getroottable()["FiendwarHallCreatePartyCObj"]; + } + + + + InputObject = null; + //绘制主界面 + function DrawMain(obj) { + L_sq_DrawWindow(X, Y + 10, 260, 120, "interface/lenheartwindowcommon.img", 213, 12, 2, 13, 2); + L_sq_DrawWindow(X, Y + 10, 260, 120, "interface/lenheartwindowcommon.img", 213, 12, 2, 13, 2); + L_sq_DrawImg("interface2/gcontents/180621_fiendwar/raid/raid_areaimg_fiend.img", 0, X + 11, Y + 21); + + L_sq_DrawImg("hud/fiendwarl.img", 9, X - 2, Y + 2); + L_sq_DrawCode("创建攻坚队", X + 112, Y + 3, sq_RGBA(179, 169, 135, 255), 0, 1); + + L_sq_DrawImg("hud/fiendwarl.img", 10, X + 72, Y + 44); + + if (!InputObject) InputObject = LenheartBaseInput(X + 62, Y + 68, 152, 20); + else { + InputObject.SyncPos(X + 62, Y + 68); + InputObject.Show(); + } + + local OkButton = LenheartButtonText(X + 78, Y + 124, 5, "确定"); + OkButton.SetTextOffset(0, 1); + OkButton.Show(); + if (OkButton.isLBActive()) { + if (InputObject.str.len() > 0) { + local T = { + op = 20063001, + teamsName = InputObject.str, + items = [L_sq_GetCharacterAttribute(0x1c, 14), L_sq_GetCharacterAttribute(0x1c, 13)], + } + BasicsDrawTool.SendPackEx(T); + MainState = false; + } + } + + local CloseButton = LenheartButtonText(X + 144, Y + 124, 5, "取消"); + CloseButton.SetTextOffset(0, 1); + CloseButton.Show(); + if (CloseButton.isLBActive()) { + MainState = false; + } + } + + //开启界面回调 + function OpenClassCallBack() { + + L_NewWindows("Lenheart", 170, 0x65535); + local W = sq_GetPopupWindowMainCotrol(170); + W.SetVisible(false); + W.SetEnable(false); + + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI.Windows.Show(obj); + } + + //逻辑入口 + function Proc(obj) { + + } + /* + //绘制入口 + function Draw(obj) { + if (MainState) { + if (WindowObj) { + DrawMain(obj); + // WindowObj.Show(obj); + X = WindowObj.X; + Y = WindowObj.Y; + } else { + WindowObj = LenheartNewUI.Windows(X, Y, 800, 600, 28); //坐标 大小 标题栏高度 + WindowObj.Init(this); + WindowObj.DeBugMode = true; + } + } else { + if (WindowObj && WindowObj.YMouseSw == false) { + IMouse.ReleaseMouseClick(); + WindowObj.YMouseSw = true; + WindowObj = null; + } + } + } + */ + } \ No newline at end of file diff --git a/Tool/UiClassTool.nut b/Tool/UiClassTool.nut new file mode 100644 index 0000000..db1136f --- /dev/null +++ b/Tool/UiClassTool.nut @@ -0,0 +1,357 @@ +/* +文件名:UiClassTool.nut +路径:Tool/UiClassTool.nut +创建日期:2024-03-20 11:27 +文件用途:UI +*/ +LenheartNewUI <- {} +//基础窗口类 +class LenheartNewUI.BaseWindow extends BasicsDrawTool { + + constructor() { + + } + //鼠标事件回调 + function OnMouseProc(Flag, MousePos_X, MousePos_Y) {} + //鼠标左键按下回调 + function OnMouseLbDown(MousePos_X, MousePos_Y) { + + } + //鼠标左键弹起回调 + function OnMouseLbUp(MousePos_X, MousePos_Y) { + + } + //鼠标右键按下回调 + function OnMouseRbDown(MousePos_X, MousePos_Y) { + + } + //鼠标右键弹起回调 + function OnMouseRbUp(MousePos_X, MousePos_Y) { + + } + //鼠标滚轮时间回调 + function OnMouseWheel(Flag, MousePos_X, MousePos_Y) { + + } +} + +class LenheartNewUI.Windows extends LenheartNewUI.BaseWindow { + //MyObjectId + ObjectId = null; + //可用性 + Visible = true; + //宽度 + Width = null; + //高度 + Height = null; + //标题高度 + TitleH = null; + + //调试模式 + DeBugMode = false; + + //X坐标 + X = null; + B_X = null; + //Y坐标 + Y = null; + B_Y = null; + + M_Xpos = null; + M_Ypos = null; + //移动Flag + MoveFlag = false; + + YMouseSw = true; + //焦点 + Focus = true; + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + ObjectId = gObjectId; + foreach(Index, WindowObj in L_Windows_List) { + if (WindowObj.ObjectId == this.ObjectId) return; + } + //宽度 + Width = gWidth; + //高度 + Height = gHeight; + //标题高度 + TitleH = gTitleH; + + //X坐标 + X = gX; + //Y坐标 + Y = gY; + + Init(); + } + + function ResetFocus() { + foreach(Index, WindowObj in L_Windows_List) { + if (WindowObj.ObjectId == this.ObjectId) L_Windows_List.remove(Index); + WindowObj.Focus = false; + } + this.Focus = true; + L_Windows_List.append(this); + } + + //加入窗口队列 + function Init() { + ResetFocus(); + } + + //设定鼠标逻辑 + function LockMouse(MousePos_X, MousePos_Y) { + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) { + IMouse.LockMouseClick(); + YMouseSw = false; + L_sq_WA(0x1b46898, 1); + IMouse.LockState <- true; + } else { + if (YMouseSw == false && sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, 0, 0, 800, 600) && !MoveFlag) { + IMouse.ReleaseMouseClick(); + YMouseSw = true; + L_sq_WA(0x1b46898, 0); + IMouse.LockState <- false; + } + } + } + + function Show(obj) { + if (!Visible) return; + // L_sq_DrawImg("interface2/yosin/tbjp.img", 4, X, Y + 1); + if (DeBugMode) DeBug(obj); + } + + function DeBug(obj) { + sq_DrawBox(X, Y, Width, Height, 0xffffffff); + sq_DrawBox(X, Y, Width, TitleH, 0xffffffff); + } + + //override + function OnMouseProc(Flag, MousePos_X, MousePos_Y) { + if (!Visible) return; + //设定鼠标逻辑 + if (!MoveFlag) LockMouse(MousePos_X, MousePos_Y); + if (Flag == 1) { + if (MoveFlag) { + //左键拖动 + X = B_X - (M_Xpos - MousePos_X); + Y = B_Y - (M_Ypos - MousePos_Y); + } + } + } + + //override + //鼠标左键按下回调 + function OnMouseLbDown(MousePos_X, MousePos_Y) { + if (!Visible) return; + //如果点击事件在窗口内 + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) { + ResetFocus(); + //如果点下去在标题栏 + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, TitleH)) { + MoveFlag = true; + M_Xpos = MousePos_X; //原始鼠标位置数据 + M_Ypos = MousePos_Y; + B_X = X; //原始窗口位置 + B_Y = Y; + } + } + } + //override + //鼠标左键弹起回调 + function OnMouseLbUp(MousePos_X, MousePos_Y) { + if (!Visible) return; + if (MoveFlag) { + MoveFlag = false; + M_Xpos = null; + M_Ypos = null; + B_X = null; + B_Y = null; + } + } + //override + //鼠标右键按下回调 + function OnMouseRbDown(MousePos_X, MousePos_Y) { + if (!Visible) return; + + } + //override + //鼠标右键弹起回调 + function OnMouseRbUp(MousePos_X, MousePos_Y) { + if (!Visible) return; + + } + //override + //鼠标滚轮时间回调 + function OnMouseWheel(Flag, MousePos_X, MousePos_Y) { + if (!Visible) return; + + } +} + + + +//遍历窗口查询是否有悬停在新窗口中 +function CheackMouseInNewWindows(MousePos_X, MousePos_Y) { + local Flag = false; + foreach(Window in L_Windows_List) { + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Window.X, Window.Y, Window.Width, Window.Height)) { + Flag = true; + return Flag; + } + } + return Flag; +} + + +//鼠标事件 +/* +a1 +常规状态 200 +左键点击 201 +左键松开 202 +右键点击 204 +右键松开 205 +滚轮滚动事件 20a +看a2 如果是ff880000 向下 如果是780000 向上 +中建按下没有事件 + +鼠标事件为200 并且a2 = 1 为左键拖动 a2=2为右键拖动 中建按下拖动a2 =10 + +a2=3的时候代表2个键一起按下 事件代表后按下的键*/ + +//如果根空间没有选定AB层的Flag 就新建一个 默认是false 渲染在下层 +if (!("WindowsShowABFlag" in getroottable())) { + getroottable().WindowsShowABFlag <- false; +} + +function L_MouseCallBack(MouseState, MouseFlag, MousePos_X, MousePos_Y) { + //如果渲染层级在下级 即A层 或者是 鼠标没有悬停在任何新窗口上时 执行判断 如果悬停在原生窗口 就解除鼠标锁定 如果点击 就改变渲染层级 + if (!getroottable().WindowsShowABFlag || !CheackMouseInNewWindows(MousePos_X, MousePos_Y)) { + if (L_sq_RA(0x1A32950) != 92 && L_sq_RA(0x1A32950) != 2396) { + if ("LockState" in IMouse) { + if (IMouse.LockState) { + IMouse.ReleaseMouseClick(); + IMouse.LockState <- false; + } + } + //如果点击了原生窗口 就把渲染队列改成下 + if (MouseState == 0x201) getroottable().WindowsShowABFlag <- false; + return; + } + } + + //克隆一遍窗口列表 + local WindowListF = clone(L_Windows_List); + WindowListF.reverse(); + + //判断滚石是向上还是向下的 + local Flag = MouseFlag == 0xff880000 ? 0 : 1; + foreach(Window in WindowListF) { + if (Window.Visible) { + switch (MouseState) { + //常规或者拖动事件 + case 0x200: { + Window.OnMouseProc(MouseFlag, MousePos_X, MousePos_Y); + break; + } + //左键点击 + case 0x201: { + //如果点击了新窗口就把渲染队列改成上 + getroottable().WindowsShowABFlag <- true; + Window.OnMouseLbDown(MousePos_X, MousePos_Y); + break; + } + //左键松开 + case 0x202: { + Window.OnMouseLbUp(MousePos_X, MousePos_Y); + break; + } + //右键点击 + case 0x204: { + Window.OnMouseRbDown(MousePos_X, MousePos_Y); + break; + } + //右键松开 + case 0x205: { + Window.OnMouseRbUp(MousePos_X, MousePos_Y); + break; + } + //滚轮事件 + case 0x20a: { + Window.OnMouseWheel(Flag, MousePos_X, MousePos_Y); + break; + } + } + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Window.X, Window.Y, Window.Width, Window.Height)) return; + } + } +} + +// if (!getroottable().rawin("L_Windows_List")) +L_Windows_List <- []; + +// if (!getroottable().rawin("asdasdasd")) { +// getroottable().asdasdasd <- 1; +// local Win = LenheartNewUI.Windows("测试框",120, 100, 329, 382, 30); +// Win.DeBugMode = true; +// local Win2 = LenheartNewUI.Windows(250, 100, 329, 382, 30); +// Win2.Init(); +// local Win3 = LenheartNewUI.Windows(360, 100, 329, 382, 30); +// Win3.Init(); +// } + +//窗口逻辑入口 +function L_WindowsLogic(obj) { + // print(Clock()); + //是否存在一个窗口Flag + local WindowExistence = false; + //遍历窗口队列 如果可见则调用Show 只要有一个可见就写入Flag + foreach(Window in L_Windows_List) { + if (Window.Visible) { + Window.Proc(obj); + Window.Show(obj); + WindowExistence = true; + } + } + //如果可见 需要调用一个原生窗口抵消ESC + if (WindowExistence) { + local W = sq_GetPopupWindowMainCotrol(170); + if (!W) L_NewWindows("Lenheart", 170, 0x65535); + else { + W.SetVisible(false); + W.SetEnable(false); + } + } + //如果按下ESC键要将所有的窗口关闭 + if (KeyPressNB.isKeyPress(48, "AllLenheartWindows")) { + foreach(Window in L_Windows_List) { + Window.Visible = false; + Window.YMouseSw = true; + } + L_sq_WA(0x1b46898, 0); + IMouse.ReleaseMouseClick(); + } + + +} + +function L_DrawWindow_A() { + local obj = sq_GetMyMasterCharacter(); + if (!obj) return; + //A层只在下层渲染 + if (getroottable().WindowsShowABFlag == false) L_WindowsLogic(obj); +} + +function L_DrawWindow_B() { + + local obj = sq_GetMyMasterCharacter(); + if (!obj) return; + + //B层只在上层渲染 + if (getroottable().WindowsShowABFlag) L_WindowsLogic(obj); + //因为图层太高会盖掉鼠标 所以重新画一个 + L_sq_DrawImg("interface/newstyle/windows/cursor.img", 0, IMouse.GetXPos(), IMouse.GetYPos()); +} \ No newline at end of file diff --git a/dnf_enum_header.nut b/dnf_enum_header.nut index 2542468..7127698 100644 --- a/dnf_enum_header.nut +++ b/dnf_enum_header.nut @@ -1,6 +1,6 @@ // 湍?模蝶顶 enum高击 squirrel script缣怃紫 饵辨?晦 嫔? 渗??场擎 高菟殓栖棻. // 牖热 蝶觼董?煎 蒙机?贼怃 跷陛?捡? 高菟桧 毡棻贼.. 陕 霜机_header.nut?橾缣 鸢殓?舆撮蹂.. 桧够缣 跷陛旎虽 -L_sq_OpenConsole("倾泪寒测试用"); +// L_sq_OpenConsole("倾泪寒测试用"); InitDofile <- true ArtDofile <- false //---@原生类拓展