commit 39d60b284ee4e9f883f5278dad960ad79b4b2c9e Author: Lenheart <947330670@qq.com> Date: Mon Sep 16 17:09:36 2024 +0800 111 diff --git a/Base/CallBack/DrawHudMain.nut b/Base/CallBack/DrawHudMain.nut new file mode 100644 index 0000000..1480dfb --- /dev/null +++ b/Base/CallBack/DrawHudMain.nut @@ -0,0 +1,32 @@ +/* +文件名:DrawHudMain.nut +路径:Base/CallBack/DrawHudMain.nut +创建日期:2024-08-29 09:39 +文件用途:血槽绘制入口(图层在血槽层) +*/ +function L_HUD_BloodBackground() { + local RootTab = getroottable(); + local obj = sq_getMyCharacter(); + if (!obj) return; + if (RootTab.rawin("HudUi_Obj")) { + RootTab.HudUi_Obj.BottomShow(obj); + } + if (RootTab.rawin("EventList_Obj")) { + foreach(win in EventList_Obj.Events) { + win.EventShow(obj); + } + } +} + +getroottable().Camera_Pos <- 0; + +function L_Sync_Camera_Pos(Xpos) { + getroottable().Camera_Pos = Xpos; + // print(Xpos); +} + + +function Sq_DrawChannel() { + // L_sq_DrawImg("interface2/cs_shop/cs_packageevent/2021_summer/hearoursummer_calendarui.img", 0, 0, 0); + print(Clock()); +} \ No newline at end of file diff --git a/Base/CallBack/DrawMain.nut b/Base/CallBack/DrawMain.nut new file mode 100644 index 0000000..bb22613 --- /dev/null +++ b/Base/CallBack/DrawMain.nut @@ -0,0 +1,162 @@ +/* +文件名:DrawMain.nut +路径:Base/CallBack/DrawMain.nut +创建日期:2024-08-06 18:58 +文件用途:绘制回调 +*/ +//在DrawMain后面调用 +function L_drawMainCustomUI_All() { + local obj = sq_getMyCharacter(); + if (!obj) return; + + local RootTab = getroottable(); + //下帧执行任务事件 + if (RootTab.rawin("LenheartNextFrameFuncTab")) { + foreach(Func in RootTab["LenheartNextFrameFuncTab"]) { + Func(); + } + RootTab["LenheartNextFrameFuncTab"] = []; + } else { + RootTab.LenheartNextFrameFuncTab <- []; + } + + //重载逻辑 + try { + local Func = loadfile("Yosin_Game_Reloading.Sign", true); + Func(); + L_Cmd("cmd.exe /c del Yosin_Game_Reloading.Sign"); + //清空窗口 + L_Windows_List = []; + //清空活动图标窗口 + getroottable().rawdelete("EventList_Obj"); + //清空插件初始化状态 + getroottable().rawdelete("LenheartPluginsInitFlag"); + + getroottable().rawdelete("RINDRO_GET_ITEM_FLAG"); + //特殊清空 + getroottable().rawdelete("OnlineAnnouncement_Obj"); + //血槽UI + getroottable().rawdelete("HudUi_Obj"); + + //战令 + getroottable().rawdelete("AradPass_Obj"); + //战斗力系统 + getroottable().rawdelete("CombatRankC_Obj"); + //刷图签到 + getroottable().rawdelete("FightSign_Obj"); + //希曼音乐会 + getroottable().rawdelete("MidsummerParty_Obj"); + //在线签到 + getroottable().rawdelete("OnilneSign_Obj"); + //全服竞拍 + getroottable().rawdelete("ServerAuction_Obj"); + + } catch (exception) { + if (exception != "cannot open the file") + print("Reloading Script Fail !!! \n" + exception); + } + + // + local RootTab = getroottable(); + + + //尝试调用百级UI + // if (getroottable().rawin("Lenheart_100UI_Event_BackGround")) Lenheart_100UI_Event_BackGround(); + // if (getroottable().rawin("Lenheart_100UI")) Lenheart_100UI(obj); + + //初始化活动图标 + Lenheart_EventList_Fun(obj); + + //加载注册Base函数窗口 + if (RootTab.rawin("LenheartBaseFuncTab")) { + if (RINDRO_INIT_FLAG) { + local LenheartFunc = RootTab["LenheartBaseFuncTab"]; + foreach(Func in LenheartFunc) { + Func(obj); + } + } + } + + //加载注册Ex函数窗口 + if (RootTab.rawin("LenheartFuncTab")) { + if (RINDRO_INIT_FLAG) { + local LenheartFunc = RootTab["LenheartFuncTab"]; + foreach(Func in LenheartFunc) { + Func(obj); + } + } + } + + //所有插件初始化完毕 + if (!getroottable().rawin("LenheartPluginsInitFlag")) { + if (RINDRO_INIT_FLAG) { + local T = { + op = 25001021, + } + Rindro_BaseToolClass.SendPackEx(T); + getroottable().LenheartPluginsInitFlag <- true; + } + } + + //初始化Item信息 + if (!getroottable().rawin("RINDRO_GET_ITEM_FLAG")) { + getroottable().RINDRO_GET_ITEM_FLAG <- true; + Rindro_BaseToolClass.SendPackEx({ + op = 20069005, + md5 = Rindro_GetMd5() + }); + } + + // if (Clock() - getroottable().Lsnzz >= 50) { + // getroottable().Lsnzz = Clock(); + // local T = { + // op = 25001021, + // } + // Rindro_BaseToolClass.SendPackEx(T); + // } + + // if (!CNSquirrelAppendage.sq_IsAppendAppendage(obj, "appendage/curreny.nut")) { + // local appendage1 = CNSquirrelAppendage.sq_AppendAppendage(obj, obj, 174, false, "appendage/curreny.nut", true); + // } + + // print(format("%02X", L_sq_RA(0x1B474D4))); + // print(R_Mouse.IsLock()); + // print(format("%02X", L_sq_RA(0x3431de00 + 0x14))); + // L_sq_WA(0x3431de00 + 0x14,200); + // print(format("%02X", L_sq_RA(0x1AE94C4, "0x590+0x44+"))); + //外界主界面 + // if(L_sq_RA(0x1B474D4) == 0x3C7FB100)print(true); + // else print(false); + // print(CheckInOldW()); + // GetTownBaseBackgroundAddress(); + + // print(getroottable().WindowsShowABFlag); + + // L_Sq_GetPlayerEachName(); + // Sout("%L",L_Sq_GetPlayerEachName()); + // print(Rindro_BaseToolClass.GetEachNpcId()); + + + + // local EachCount = 0; + // local EachClassObject = L_sq_RA(0x1ADE0E0); + // if (EachClassObject) { + // local FristChildOffset = (EachClassObject + 0x68); + // for (local i = 0; i< 74; i++) { + // local AddressBuf = FristChildOffset + (4 * i); + // local ChildAddress = L_sq_RA(AddressBuf); + // if (ChildAddress) { + // local OpenFlag = L_sq_RA(ChildAddress + 0xC); + // if (OpenFlag == 257) EachCount++; + // } + // } + // } + // print(EachCount); + + // for (local i = 0; i< 400; i++) { + // local WindowAddress = L_sq_GetWindowById(i); + // if (WindowAddress != 0) print(format("%02X", WindowAddress)); + // if (WindowAddress == 0x39F56000) print(i); + // } +} +// getroottable().Lsnzz <- Clock(); diff --git a/Base/CallBack/GetDamageRate.nut b/Base/CallBack/GetDamageRate.nut new file mode 100644 index 0000000..0889b71 --- /dev/null +++ b/Base/CallBack/GetDamageRate.nut @@ -0,0 +1,72 @@ +/* +文件名:GetDamageRate.nut +路径:Base/CallBack/GetDamageRate.nut +创建日期:2024-08-09 14:10 +文件用途:获取伤害倍率 +*/ +function L_getCurrentModuleDamageRate(obj) { + if (!obj) + return 1.0; + local rate; + if (getroottable().rawin("LenheartCurrentModuleDamageRate")) { + rate = 1.0 + getroottable()["LenheartCurrentModuleDamageRate"]; + } else { + rate = 1.0; + } + + //超时空伤害 + if (getroottable().rawin("LenheartFiendModuleDamageRate")) { + rate *= getroottable()["LenheartFiendModuleDamageRate"]; + } else { + rate *= 1.0; + } + + //pvf伤害 + local ClientRat = 1.0; + try { + ClientRat = getCurrentModuleDamageRate(obj).tofloat(); + } catch (exception) { + ClientRat = 1.0; + } + + //副本伤害控制 + try { + local stage = sq_GetGlobaludpModuleStage(); + local dungeon = sq_GetDungeonByStage(stage); + local dungeonIndex = sq_GetDuegonIndex(dungeon); + local fbsh = 100; + + foreach(id in DungeonIndex) { + if (dungeonIndex == id[0]) { + fbsh = id[1]; + } + } + local nrate = fbsh.tofloat() / 100.0; + rate = rate.tofloat() * nrate; + } catch (exception) { + + } + + //职业伤害控制 + try { + local LLJob = sq_getJob(obj); + local LLGrowT = sq_getGrowType(obj); + + local LLLen = GrowType.len(); + for (local i = 0; i< 11; ++i) { + if (i == LLLen) break; + if (LLJob == i) { + foreach(GR in GrowType[i]) { + if (LLGrowT == GR[0]) + rate = rate.tofloat() * GR[1].tofloat(); + } + } + + } + } catch (exception) { + + } + + + return (rate * ClientRat); +} \ No newline at end of file diff --git a/Base/CallBack/PushDamage.nut b/Base/CallBack/PushDamage.nut new file mode 100644 index 0000000..451f848 --- /dev/null +++ b/Base/CallBack/PushDamage.nut @@ -0,0 +1,39 @@ +/* +文件名:PushDamage.nut +路径:Base/CallBack/PushDamage.nut +创建日期:2024-08-30 14:41 +文件用途:发生伤害时 +*/ +PushDamageFontDataFuncTab <- {}; +PushDamageFontFuncTab <- {}; + +function Sq_PushDamageData(ObjAddress, MySelfAddress, Value) { + // print("MyCharacter: " + format("%02x", L_sq_RA(0x1AB7CDC))); + // print("ObjAddress: " + format("%02x", ObjAddress)); + // print("A1: " + format("%02x", A1)); + // print("A2: " + format("%02x", A2)); + // print(" "); + foreach(Func in PushDamageFontFuncTab) { + Func(ObjAddress, MySelfAddress, Value); + } +} + +function Sq_PushDamageFontData(ObjAddress, X, Y, Z, Value, Type, A1, A2) { + // print("MyCharacter: " + format("%02x", L_sq_RA(0x1AB7CDC))); + // print("ObjAddress: " + format("%02x", ObjAddress)); + // print("A1: " + format("%02x", A1)); + // print("A2: " + format("%02x", A2)); + // print(" "); + + // if (A2) + // print(format("%02x", L_Sq_GetObjectIsCharacter(A2))); + local Flag = true; + foreach(Func in PushDamageFontDataFuncTab) { + local Ret = Func(ObjAddress, X, Y, Z, Value, Type, A1, A2); + if (Ret == false) { + Flag = false; + } + } + + return Flag; +} \ No newline at end of file diff --git a/Base/CallBack/Window_Get.nut b/Base/CallBack/Window_Get.nut new file mode 100644 index 0000000..90bb390 --- /dev/null +++ b/Base/CallBack/Window_Get.nut @@ -0,0 +1,71 @@ +/* +文件名:Window_Get.nut +路径:Base/CallBack/Window_Get.nut +创建日期:2024-08-08 13:38 +文件用途:窗口被获取时经过的函数 +*/ +getroottable().RindroOneRunTable <- {}; + +function OneRunCode(Func, Key, Window_Obj) { + if (!RindroOneRunTable.rawin(Key)) { + Func(Window_Obj); + RindroOneRunTable.rawset(Key, true); + } +} + +function L_Old_Window_Get(Window_Obj) { + // print(L_sq_RA(Window_Obj + 0xC)); + // L_sq_WA(Window_Obj + 0xC,257); + // L_sq_RA(Window_Obj, "0xC+"); + + // if (L_sq_RA(Window_Obj + 0x14) == 0) { + // print(L_sq_RA(Window_Obj + 0x18)); + // print(format("%02x", Window_Obj)); + // } + + // if (0x422e2100 == Window_Obj) { + // print(L_sq_RA(Window_Obj + 0x14)); + // } + + + // OneRunCode(function(Window_Obj) { + // if (0x185242C == L_sq_RA(Window_Obj)) { + // //任务提示 + // if (L_sq_RAB(Window_Obj + 0x78) == 131 && L_sq_RAB(Window_Obj + 0x79) == 2) { + // L_sq_WA(Window_Obj + 0x14, 144); + // L_sq_WA(Window_Obj + 0x18, 53); + // } + // } + // }, "任务提示设置", Window_Obj); + + + // //任务提示 + // if (0x185242C == L_sq_RA(Window_Obj)) { + // if (L_sq_RA(Window_Obj + 0x44) == 131 && L_sq_RAB(Window_Obj + 0x79) == 2) { + // L_sq_WA(Window_Obj + 0x14, 144); + // L_sq_WA(Window_Obj + 0x18, 53); + // } + // } + + + + // if(369 == L_sq_RA(Window_Obj + 0x78)) + // print(format("%02X", Window_Obj)); +} + + +//窗口是否打开 +function L_Old_Window_Visible(WindowObject, Flag) { + // print(format("%02X", WindowObject)); + + // if (Character_Info_Window_Address.rawin(WindowObject)) { + // L_sq_WAB(WindowObject + 0xc, 0); + // // print(L_sq_RA(WindowObject + 0x14)); + // // print(format("%02X", WindowObject)); + // } + // print(1213); + // foreach(Key, Table in Character_Info_Window_Address) { + // L_sq_WA(Key + 0xC, 256); + // // print(format("%02X", Key)); + // } +} \ No newline at end of file diff --git a/Base/PackControl/PackControl.nut b/Base/PackControl/PackControl.nut new file mode 100644 index 0000000..5e1ee87 --- /dev/null +++ b/Base/PackControl/PackControl.nut @@ -0,0 +1,38 @@ +/* +文件名:PackControl.nut +路径:Base/PackControl/PackControl.nut +创建日期:2024-08-06 22:13 +文件用途: +*/ +Pack_Control <- {} + +function Sq_Pack_Control(Chunk) { + try { + local Pack_Json = Json.Decode(Chunk); + if (Pack_Control.rawin(Pack_Json.op)) { + try { + Pack_Control[Pack_Json.op](Chunk); + } catch (exception) { + print("error pack: " + Pack_Json.op); + } + } + } catch (exception) { + print("error packmsg: " + Pack_Json.op); + } + +} + +function Sq_Pack_ControlLocal(Chunk) { + local Pack_Json = Json.Decode(Chunk); + if (Pack_Control.rawin(Pack_Json.op)) Pack_Control[Pack_Json.op](Chunk); +} + + +//进入副本回调 +function LenheartGotoDgnCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + local DgnId = Jso.map.id; + local DgnRate = Jso.map.ra; + L_sq_GoDungeon(DgnId); +} +Pack_Control.rawset(2024041602, LenheartGotoDgnCallBack); \ No newline at end of file diff --git a/Base/UI/Lenheart_Ani_Class.nut b/Base/UI/Lenheart_Ani_Class.nut new file mode 100644 index 0000000..a501dbd --- /dev/null +++ b/Base/UI/Lenheart_Ani_Class.nut @@ -0,0 +1,85 @@ +/* +文件名:Lenheart_Ani_Class.nut +路径:Base/UI/Lenheart_Ani_Class.nut +创建日期:2024-08-06 18:56 +文件用途:Ani +*/ +class Lenheart_Ani { + + X = 0; + Y = 0; + + ImgPath = null; + ImgFrame = null; + + + //播放状态 + State = 0; + //循环 + LoopFlag = true; + + //当前帧数 + CurFrame = 0; + //初始化时间 + InitTime = 0; + //Ani当前帧播放时间 + PlayCurTime = 0; + + + //img 路径 调用帧数组 + constructor(path, frame, Pos) { + ImgPath = ("Character/" + path + ".img").tolower(); + ImgFrame = frame; + InitTime = Clock(); + State = 1; + X = Pos[0]; + Y = Pos[1]; + } + + + function Show(dt) { + if (State == 1) { + if (ImgFrame) { + local NowFrameObj = ImgFrame[CurFrame]; + PlayCurTime += dt; + L_sq_DrawImg(ImgPath, NowFrameObj.ImgIndex, NowFrameObj.Pos[0] + X, NowFrameObj.Pos[1] + Y); + if (PlayCurTime >= NowFrameObj.Delay) { + CurFrame++; + //播放完成 + if (CurFrame >= ImgFrame.len()) { + if (LoopFlag) CurFrame = 0; + else State = 0; + } + InitTime = Clock(); + PlayCurTime = 0; + } + } + } + } + + function ShowEx(dt,gRgba,rate_x,rate_y) { + if (State == 1) { + if (ImgFrame) { + local NowFrameObj = ImgFrame[CurFrame]; + PlayCurTime += dt; + L_sq_DrawImg(ImgPath, NowFrameObj.ImgIndex, NowFrameObj.Pos[0] + X, NowFrameObj.Pos[1] + Y,1,gRgba,rate_x,rate_y); + if (PlayCurTime >= NowFrameObj.Delay) { + CurFrame++; + //播放完成 + if (CurFrame >= ImgFrame.len()) { + if (LoopFlag) CurFrame = 0; + else State = 0; + } + InitTime = Clock(); + PlayCurTime = 0; + } + } + } + } + + function Reset() + { + CurFrame = 0; + State = 1; + } +} \ No newline at end of file diff --git a/Base/UI/Lenheart_Character_Info_Class.nut b/Base/UI/Lenheart_Character_Info_Class.nut new file mode 100644 index 0000000..589a1fb --- /dev/null +++ b/Base/UI/Lenheart_Character_Info_Class.nut @@ -0,0 +1,512 @@ +/* +文件名:Lenheart_Character_Info_Class.nut +路径:Base/UI/Lenheart_Character_Info_Class.nut +创建日期:2024-08-27 12:13 +文件用途:个人信息属性面板 +*/ +class Lenheart_Character_Info_ClassC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + NoWindow = true; + + //是否可见 + Visible = false; + + //图标路径 + IconPath = "interface2/profile/profile_icon1.img"; + + //我的信息 + MyInfo = null; + + //滚轮偏移值 + YOffset = 0; + + + function My_GetCharacterInfoCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + MyInfo = Jso.Attribute; + } + + //初始化 + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + Pack_Control.rawset(20069014, My_GetCharacterInfoCallBack.bindenv(this)); + } + + function RegisterWidget() { + // //关闭按钮 + // local CloseButton = LenheartNewUI_BaseButton(278, 0, 11, 12, "interface/lenheartwindowcommon.img", 276); + // CloseButton.OnClick = function() { + // this.Visible = false; + // }.bindenv(this); + // Childrens.append(CloseButton); + } + + //绘制主界面 + function DrawMain(obj) { + DrawInfo(obj); + } + + function CheckPosInDrawBox(PosY) { + if ((PosY + YOffset) >= 0 && (PosY + YOffset)< 144) return true; + return false; + } + + //绘制信息 + function DrawInfo(obj) { + if (MyInfo) { + + //生命魔法值 + local PosOffset = 0; + if (CheckPosInDrawBox(PosOffset)) { + L_sq_DrawImg(IconPath, 0, X + 4, Y + 3 + YOffset); + L_sq_DrawCode("HP", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local HpStr = MyInfo.CurHp.tostring() + "/" + MyInfo.MaxHp.tostring(); + L_sq_DrawCode(HpStr, X + 128 - LenheartTextClass.GetStringLength(HpStr), Y + 4 + (0 * 18) + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1); + + L_sq_DrawImg(IconPath, 1, X + 130, Y + 3 + YOffset); + L_sq_DrawCode("MP", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local HpStr = MyInfo.CurMp.tostring() + "/" + MyInfo.MaxMp.tostring(); + L_sq_DrawCode(HpStr, X + 248 - LenheartTextClass.GetStringLength(HpStr), Y + 4 + (0 * 18) + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1); + } + + //力量智力 + PosOffset += 18; + if (CheckPosInDrawBox(PosOffset)) { + L_sq_DrawImg(IconPath, 2, X + 4, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("力量", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str = MyInfo.Strength.tostring(); + L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1); + + L_sq_DrawImg(IconPath, 3, X + 130, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("智力", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str2 = MyInfo.Intellect.tostring(); + L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1); + } + + //体力精神 + PosOffset += 18; + if (CheckPosInDrawBox(PosOffset)) { + L_sq_DrawImg(IconPath, 4, X + 4, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("体力", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str = MyInfo.Vitality.tostring(); + L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1); + + L_sq_DrawImg(IconPath, 5, X + 130, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("精神", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str2 = MyInfo.Spirit.tostring(); + L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1); + } + + //物理攻击魔法攻击 + PosOffset += 18; + if (CheckPosInDrawBox(PosOffset)) { + L_sq_DrawImg(IconPath, 6, X + 4, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("物理攻击", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str = MyInfo.PhysicalAttack.tostring(); + L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1); + + L_sq_DrawImg(IconPath, 7, X + 130, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("魔法攻击", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str2 = MyInfo.MagicalAttack.tostring(); + L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1); + } + + //独立攻击力 + PosOffset += 18; + if (CheckPosInDrawBox(PosOffset)) { + L_sq_DrawImg(IconPath, 31, X + 4, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("独立攻击力(物理/魔法)", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str = MyInfo.IndependentAttack.tostring(); + L_sq_DrawCode(Str, X + 248 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1); + } + + //物理防御魔法防御 + PosOffset += 18; + if (CheckPosInDrawBox(PosOffset)) { + L_sq_DrawImg(IconPath, 8, X + 4, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("物理防御", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str = MyInfo.PhysicalDefend.tostring(); + L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1); + + L_sq_DrawImg(IconPath, 9, X + 130, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("魔法防御", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str2 = MyInfo.MagicalDefend.tostring(); + L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(150, 255, 30, 250), 0, 1); + } + + //物理暴击 魔法暴击 + PosOffset += 18; + if (CheckPosInDrawBox(PosOffset)) { + L_sq_DrawImg(IconPath, 10, X + 4, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("物理暴击", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str = format("%0.1f%%", MyInfo.PhysicalCrit); + L_sq_DrawCode(Str, X + 133 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); + + L_sq_DrawImg(IconPath, 11, X + 130, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("魔法暴击", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str2 = format("%0.1f%%", MyInfo.MagicalCrit); + L_sq_DrawCode(Str2, X + 253 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); + } + + //攻击速度 释放速度 + PosOffset += 18; + if (CheckPosInDrawBox(PosOffset)) { + L_sq_DrawImg(IconPath, 12, X + 4, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("攻击速度", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str = format("%0.1f%%", MyInfo.AttackSpeed); + L_sq_DrawCode(Str, X + 133 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); + + L_sq_DrawImg(IconPath, 13, X + 130, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("释放速度", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str2 = format("%0.1f%%", MyInfo.ReleaseSpeed); + L_sq_DrawCode(Str2, X + 253 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); + } + + //移动速度 抗魔 + PosOffset += 18; + if (CheckPosInDrawBox(PosOffset)) { + L_sq_DrawImg(IconPath, 14, X + 4, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("移动速度", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str = format("%0.1f%%", MyInfo.MoveSpeed); + L_sq_DrawCode(Str, X + 133 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); + + L_sq_DrawImg(IconPath, 15, X + 130, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("抗魔", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str2 = MyInfo.AntiMagic.tostring(); + L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); + } + + //命中率 回避率 + PosOffset += 18; + if (CheckPosInDrawBox(PosOffset)) { + L_sq_DrawImg(IconPath, 16, X + 4, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("命中率", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str = format("%0.1f%%", MyInfo.HitRate); + L_sq_DrawCode(Str, X + 133 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); + + L_sq_DrawImg(IconPath, 17, X + 130, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("回避率", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str2 = format("%0.1f%%", MyInfo.DodgeRate); + L_sq_DrawCode(Str2, X + 253 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); + } + + //HP恢复量 MP恢复量 + PosOffset += 18; + if (CheckPosInDrawBox(PosOffset)) { + L_sq_DrawImg(IconPath, 18, X + 4, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("HP恢复量", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str = MyInfo.HPRecovery.tostring(); + L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); + + L_sq_DrawImg(IconPath, 19, X + 130, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("MP恢复量", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str2 = MyInfo.MPRecovery.tostring(); + L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); + } + + //僵直度 硬直 + PosOffset += 18; + if (CheckPosInDrawBox(PosOffset)) { + L_sq_DrawImg(IconPath, 20, X + 4, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("僵直度", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str = MyInfo.StunRate.tostring(); + L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); + + L_sq_DrawImg(IconPath, 21, X + 130, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("硬直", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str2 = MyInfo.StunResist.tostring(); + L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); + } + + //火属性强化 火属性抗性 + PosOffset += 18; + if (CheckPosInDrawBox(PosOffset)) { + L_sq_DrawImg(IconPath, 22, X + 4, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("火属性强化", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str = MyInfo.FireStrength.tostring(); + L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); + + L_sq_DrawImg(IconPath, 23, X + 130, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("火属性抗性", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str2 = MyInfo.FireResist.tostring(); + L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); + } + + //冰属性强化 冰属性抗性 + PosOffset += 18; + if (CheckPosInDrawBox(PosOffset)) { + L_sq_DrawImg(IconPath, 24, X + 4, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("冰属性强化", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str = MyInfo.IceStrength.tostring(); + L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); + + L_sq_DrawImg(IconPath, 25, X + 130, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("冰属性抗性", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str2 = MyInfo.IceResist.tostring(); + L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); + } + + //光属性强化 光属性抗性 + PosOffset += 18; + if (CheckPosInDrawBox(PosOffset)) { + L_sq_DrawImg(IconPath, 26, X + 4, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("光属性强化", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str = MyInfo.LightStrength.tostring(); + L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); + + L_sq_DrawImg(IconPath, 27, X + 130, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("光属性抗性", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str2 = MyInfo.LightResist.tostring(); + L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); + } + + //暗属性强化 暗属性抗性 + PosOffset += 18; + if (CheckPosInDrawBox(PosOffset)) { + L_sq_DrawImg(IconPath, 28, X + 4, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("暗属性强化", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str = MyInfo.DarkStrength.tostring(); + L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); + + L_sq_DrawImg(IconPath, 29, X + 130, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("暗属性抗性", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str2 = MyInfo.DarkResist.tostring(); + L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); + } + + //名望值 罪恶值 + PosOffset += 18; + if (CheckPosInDrawBox(PosOffset)) { + L_sq_DrawImg(IconPath, 53, X + 4, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("名望值", X + 20, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str = MyInfo.Fame.tostring(); + L_sq_DrawCode(Str, X + 128 - LenheartTextClass.GetStringLength(Str), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); + + L_sq_DrawImg(IconPath, 45, X + 130, Y + 3 + PosOffset + YOffset); + L_sq_DrawCode("最终伤害", X + 148, Y + 4 + PosOffset + YOffset, sq_RGBA(255, 255, 255, 250), 0, 1); + local Str2 = MyInfo.FinalDamage.tostring(); + L_sq_DrawCode(Str2, X + 248 - LenheartTextClass.GetStringLength(Str2), Y + 4 + PosOffset + YOffset, sq_RGBA(251, 251, 251, 250), 0, 1); + } + } + } + + function Show(obj) { + + } + + function RealShow(obj) { + + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + } + + //override + //鼠标滚轮事件回调 + function OnMouseWheel(Flag, MousePos_X, MousePos_Y) { + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) { + if (Flag) { + if (YOffset< 0) YOffset += 18; + } + if (!Flag) { + if (YOffset > (-145)) YOffset -= 18; + } + } + + //调用原生方法 + LenheartNewUI_Windows.OnMouseWheel(Flag, MousePos_X, MousePos_Y); + } + + GetMyInfoFlag = false; + + //逻辑入口 + function Proc(obj) { + Visible = false; + LenheartNewUI_Windows.SyncPos(X, Y); + + local WindowX = sq_GetPopupWindowMainCotrol(74); + + if (!WindowX) { + GetMyInfoFlag = false; + } + + if (!WindowX || !OldWindowAddress) return; + + if (!GetMyInfoFlag) { + GetMyInfoFlag = true; + local T = { + op = 20069013, + Info = Lenheart_Character_GetAttribute(null) + } + SendPackEx(T); + } + + X = L_sq_RA(OldWindowAddress + 0x14); + Y = L_sq_RA(OldWindowAddress + 0x18); + } + + Base_X = 0; + Base_Y = 0; + OldWindowAddress = null; + + function SyncState(Address) { + local WindowX = sq_GetPopupWindowMainCotrol(74); + local WindowAddress = L_sq_GetWindowById(74); + if (!WindowX || !WindowAddress) return false; + + //确定是个人信息窗口才执行逻辑 并且返回true 不执行原逻辑 + if (Address - WindowAddress <= 0x20000) { + OldWindowAddress = Address; + local obj = sq_getMyCharacter(); + RealShow(obj); + Visible = true; + return true; + } + } + +} + + +//个人信息窗口逻辑 +function L_Character_Info_Window(WindowObject) { + //返回Flase 原逻辑继续执行 返回Tue 原逻辑终止执行 + local Flag = false; + if (getroottable().rawin("Lenheart_Character_Info_Class_Obj")) { + local MyWindow = getroottable().rawget("Lenheart_Character_Info_Class_Obj"); + local Ret = MyWindow.SyncState(WindowObject); + if (Ret) Flag = true; + } + return Flag; +} + +getroottable().rawdelete("Lenheart_Character_Info_Class_Obj"); + +function Lenheart_Character_Info_Class_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("Lenheart_Character_Info_Class_Obj")) { + RootTab.rawset("Lenheart_Character_Info_Class_Obj", LenheartNewUI_CreateWindow(Lenheart_Character_Info_ClassC, "个人信息属性面板窗口", 0, 0, 263, 146, 0)); + } +} + +getroottable()["LenheartFuncTab"].rawset("Lenheart_Character_Info_ClassFuncN", Lenheart_Character_Info_Class_Fun); + + + +class Lenheart_Other_Character_Info_ClassC extends Lenheart_Character_Info_ClassC { + //调试模式 + // DeBugMode = true; + + //不是窗口 + NoWindow = true; + + //是否可见 + Visible = false; + + //图标路径 + IconPath = "interface2/profile/profile_icon1.img"; + + //我的信息 + MyInfo = null; + + //滚轮偏移值 + YOffset = 0; + + function Other_GetCharacterInfoCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + MyInfo = Jso.Attribute; + } + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + Pack_Control.rawset(20069012, Other_GetCharacterInfoCallBack.bindenv(this)); + } + + function RegisterWidget() { + + } + + function Show(obj) { + + } + + function DrawMain(obj) { + DrawInfo(obj); + } + + function RealShow(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + } + + + //override + //鼠标滚轮事件回调 + function OnMouseWheel(Flag, MousePos_X, MousePos_Y) { + + if (Flag) { + if (YOffset< 0) YOffset += 18; + } + if (!Flag) { + if (YOffset > (-145)) YOffset -= 18; + } + + //调用原生方法 + LenheartNewUI_Windows.OnMouseWheel(Flag, MousePos_X, MousePos_Y); + } + + //逻辑入口 + function Proc(obj) { + Visible = false; + LenheartNewUI_Windows.SyncPos(X, Y); + + local WindowX = sq_GetPopupWindowMainCotrol(74); + if (!WindowX || !OldWindowAddress) return; + X = L_sq_RA(OldWindowAddress + 0x14); + Y = L_sq_RA(OldWindowAddress + 0x18) + 154; + + } + + OldWindowAddress = null; + + function SyncState(Address) { + OldWindowAddress = Address; + local obj = sq_getMyCharacter(); + RealShow(obj); + Visible = true; + return true; + } + +} + +//他人信息窗口逻辑 +function L_Other_Character_Info_Window(WindowObject) { + //返回Flase 原逻辑继续执行 返回Tue 原逻辑终止执行 + local Flag = false; + if (getroottable().rawin("Lenheart_Other_Character_Info_Class_Obj")) { + local MyWindow = getroottable().rawget("Lenheart_Other_Character_Info_Class_Obj"); + local Ret = MyWindow.SyncState(WindowObject); + if (Ret) Flag = true; + } + return Flag; +} + +getroottable().rawdelete("Lenheart_Other_Character_Info_Class_Obj"); + +function Lenheart_Other_Character_Info_Class_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("Lenheart_Other_Character_Info_Class_Obj")) { + RootTab.rawset("Lenheart_Other_Character_Info_Class_Obj", LenheartNewUI_CreateWindow(Lenheart_Other_Character_Info_ClassC, "他人信息属性面板窗口", 0, 0, 263, 146, 0)); + } +} + +getroottable()["LenheartFuncTab"].rawset("Lenheart_Other_Character_Info_ClassFuncN", Lenheart_Other_Character_Info_Class_Fun); \ No newline at end of file diff --git a/Base/UI/Lenheart_Event_Class.nut b/Base/UI/Lenheart_Event_Class.nut new file mode 100644 index 0000000..9434995 --- /dev/null +++ b/Base/UI/Lenheart_Event_Class.nut @@ -0,0 +1,359 @@ +/* +文件名:Lenheart_Event_Class.nut +路径:Base/UI/Lenheart_Event_Class.nut +创建日期:2024-08-11 09:47 +文件用途:活动图标 +*/ + + +class LenheartNewUI_EventButton extends LenheartNewUI_CommonUi { + State = 0; + BaseIdx = 29; + DWidth = null; + Path = null; + Idx = null; + BindObj = null; + Timer = 0; + EffFlag = true; + ShowName = null; + + constructor(X, Y, Path, Idx) { + this.DWidth = 20; + this.Path = Path; + this.Idx = Idx; + LenheartNewUI_CommonUi.constructor(X, Y, 20, 20); + Timer = Clock(); + } + + function SetFrame(gPath, gIdx) { + if (gPath) Path = gPath; + Idx = gIdx; + } + + function Show(obj) { + T_DrawDynamicAni(obj, "common/yosinevent/eventsystemeff.ani", X, Y, "EventIcon" + ObjectId); + //不可用 + if (State == 8) { + L_sq_DrawImg(Path, Idx + 3, X, Y + 1); + } else { + //按下 + if (isLBDown) { + L_sq_DrawImg(Path, Idx + 1, X, Y); + } + //悬停 + else if (isInRect) { + L_sq_DrawImg(Path, Idx, X, Y); + } + //普通 + else { + L_sq_DrawImg(Path, Idx, X, Y); + } + } + } + + //鼠标左键按下回调 + function OnMouseLbDown(MousePos_X, MousePos_Y) { + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) isLBDown = true; + } + + //鼠标左键弹起回调 overr + function OnMouseLbUp(MousePos_X, MousePos_Y) { + if (isLBDown && OnClick) { + local obj = sq_getMyCharacter(); + obj.sq_PlaySound("CLICK_BUTTON1"); + OnClick(this); + } + isLBDown = false; + } +} + + +class Rindro_Event extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + EventFlag = true; + //不是窗口 + NoWindow = true; + //显示标志位 + PosIdx = null; + + //闪烁透明度 + Alpha = 250; + //闪烁模式 + BlinkMode = false; + //时间 + Timer = 0; + + //是否可见 + Visible = true; + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + Timer = Clock(); + } + + //绘制主界面 + function DrawMain(obj) { + local RT = Clock() - Timer; + + //根据模式调整透明度 + if (!BlinkMode) Alpha = sq_GetUniformVelocity(250, 130, RT, 500); + else Alpha = sq_GetUniformVelocity(130, 250, RT, 500); + + //转换模式 + if (RT >= 500) { + Timer = Clock(); + BlinkMode = !BlinkMode; + } + + + L_sq_SetDrawImgModel(2, 0); + L_sq_DrawImg("interface2/yosin/eventsystemeff.img", 0, X, Y, 1, sq_RGBA(255, 255, 255, Alpha), 1.0, 1.0); + L_sq_ReleaseDrawImgModel(); + } + + function Show(obj) { + // DrawMain(obj); + // LenheartNewUI_Windows.Show(obj); + } + + function EventShow(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + } + + function TopShow(obj) { + if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, 20, 20)) { + L_sq_DrawImg("interface2/yosin/eventsystem.img", 0, X - 7, Y - 24); + local Len = ObjectId.len() / 3; + for (local i = 0; i< Len; i++) { + L_sq_DrawImg("interface2/yosin/eventsystem.img", 1, X - 2 + (15 * i), Y - 24); + } + L_sq_DrawImg("interface2/yosin/eventsystem.img", 2, X - 2 + (15 * Len - 1), Y - 24); + L_sq_DrawCode(ObjectId, X + 5, Y - 17, sq_RGBA(255, 255, 255, 250), 0, 1); + } + } + + function SyncEventIcon() { + local Count = L_sq_RA(L_sq_RA(0x1A39C2C) + 0x6c); + X = EventList_Obj.X + (((Count + PosIdx) % 8) * 20); + Y = EventList_Obj.Y - ((Count + PosIdx) / 8) * 20; + } + + //逻辑入口 + function Proc(obj) { + //同步图标位置 + SyncEventIcon(); + LenheartNewUI_Windows.SyncPos(X, Y); + } +} + +class Rindro_EventList { + + X = 0; + Y = 0; + + //活动数组 + Events = null; + + function YosinEventIconInfoCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + X = Jso.YosinEventIconInfoXpos; + Y = Jso.YosinEventIconInfoYpos; + + getroottable()["LenheartEventOffset"] <- { + x = X - 456, + y = Y + }; + } + + constructor() { + + Events = []; + Pack_Control.rawset(30002, YosinEventIconInfoCallBack.bindenv(this)); + + } + + //添加活动 + function AddEvent(Name, Idx, WindowObject, ...) { + local Window = LenheartNewUI_CreateWindow(Rindro_Event, Name, 0, 0, 20, 20, 0) + local Flag = Events.len(); + local ImgPath = "interface2/yosin/eventsystemlist.img"; + if (vargc == 1) ImgPath = vargv[0]; + local ButtonBuf = LenheartNewUI_EventButton(0, 0, ImgPath, Idx); + ButtonBuf.BindObj = WindowObject; + ButtonBuf.ShowName = Name; + ButtonBuf.OnClick = function(B_obj) { + if (B_obj.BindObj) B_obj.BindObj.OpenCallBack(); + }.bindenv(this); + Window.AddChild(ButtonBuf); + Window.PosIdx = Events.len(); + Events.append(Window); + } + + //检测是否悬停活动图标 + function CheckInEvent(MousePos_X, MousePos_Y) { + if (sq_GetPopupWindowMainCotrol(244)) return; + foreach(Window in Events) { + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Window.X, Window.Y, Window.Width, Window.Height)) { + getroottable().WindowsShowABFlag <- true; + } + } + } +} + +getroottable().rawdelete("EventList_Obj") + +function Lenheart_EventList_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("EventList_Obj")) { + RootTab.rawset("EventList_Obj", Rindro_EventList()); + } +} + +//获取活动图标坐标 在活动图标变动时会被调用 +function Sq_Get_Event_Pos_X() { + if (getroottable().rawin("LenheartEventOffset")) { + return getroottable()["LenheartEventOffset"].x; + } else { + getroottable()["LenheartEventOffset"] <- { + x = 277, + y = 530 + }; + return getroottable()["LenheartEventOffset"].x; + } +} + +function Sq_Get_Event_Pos_Y() { + if (getroottable().rawin("LenheartEventOffset")) { + return getroottable()["LenheartEventOffset"].y; + } else { + getroottable()["LenheartEventOffset"] <- { + x = 277, + y = 530 + }; + return getroottable()["LenheartEventOffset"].y; + } +} + + + +/* +//活动图标类 +class Rindro_EventIcon extends LenheartNewUI_CommonUi { + //Key + Key = null; + //活动图标文字 + EventStr = null; + //活动图标Ani编号 + EventFrame = null; + //绑定对象 + BandObject = null; + + //图标img路径 + ImgPath = "interface2/yosin/eventsystemlist.img"; + + x = null; + y = null; + + constructor(gEventStr, gEventFrame, gKey, gBandObject) { + this.EventStr = gEventStr; + this.EventFrame = gEventFrame; + this.Key = gKey; + this.BandObject = gBandObject; + + local RootTab = getroottable(); + if (RootTab.rawin("YosinEventSystem")) { + local Arr = RootTab["YosinEventSystem"]; + local TryAppend = true; + local wpos; + foreach(pos, value in Arr) { + if (value.Key == this.Key) { + TryAppend = false; + wpos = pos; + } + } + if (TryAppend) { + Arr.append(this); + RootTab.rawset("YosinEventSystem", Arr); + } else { + Arr[wpos] = this; + RootTab.rawset("YosinEventSystem", Arr); + } + } else { + local Arr = []; + Arr.append(this); + RootTab.rawset("YosinEventSystem", Arr); + } + } + + function Show(obj, X, Y) { + x = X; + y = Y; + + //绘制框 + T_DrawDynamicAni(obj, "common/yosinevent/eventsystemeff.ani", X, Y, "YosinEventIconEffA"); + + try { + if (isLBDown()) { + //绘制活动图标 + L_sq_DrawImg(ImgPath, EventFrame, X, Y + 1); + //T_DrawStayAni(obj, "common/yosinevent/eventsystemlist.ani", X, Y + 1, EventFrame, "YosinEventIconKey" + Key); + } else { + //绘制活动图标 + L_sq_DrawImg(ImgPath, EventFrame, X, Y); + } + } catch (exception) { + if (isLBDown()) { + //绘制活动图标 + T_DrawStayAni(obj, "common/yosinevent/eventsystemlist.ani", X, Y + 1, EventFrame, "YosinEventIconKey" + Key); + } else { + //绘制活动图标 + T_DrawStayAni(obj, "common/yosinevent/eventsystemlist.ani", X, Y, EventFrame, "YosinEventIconKey" + Key); + } + } + } + + function StrShow(obj, X, Y) { + //悬停 + if (isInRect() && EventStr) { + local count = EventStr.len() / 3; + T_DrawStayAni(obj, "common/yosinevent/eventsystem.ani", X - (count * 7), Y - 24, 0, "YosinEventIconStrEffL"); + for (local i = 0; i< count; i++) { + T_DrawStayAni(obj, "common/yosinevent/eventsystem.ani", X - (count * 7) + 5 + (i * 15), Y - 24, 1, "YosinEventIconStrEffZ"); + } + T_DrawStayAni(obj, "common/yosinevent/eventsystem.ani", X - (count * 7) + 5 + (count * 15), Y - 24, 2, "YosinEventIconStrEffR"); + L_sq_DrawCode(EventStr, X - (count * 4), Y - 17, sq_RGBA(255, 255, 255, 250), 0, 1); + } + if (isLBActive()) { + BandObject.MainState = true; + BandObject.OpenClassCallBack(); + } + } + + //悬停状态 + function isInRect() { + if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, x, y, 20, 20)) return true; + else return false; + } + //左键按下状态 + function isLBDown() { + if (isInRect() && Mobj.Lb == 1) return true; + else return false; + } + //左键弹起状态 + function isLBUp() { + if (isInRect() && Mobj.Lb == 0) return true; + else return false; + } + + //左键单击状态 + function isLBActive() { + if (isInRect() && Mobj.LbEvent) return true; + else return false; + } +} +*/ \ No newline at end of file diff --git a/Base/UI/Lenheart_UI_Class.nut b/Base/UI/Lenheart_UI_Class.nut new file mode 100644 index 0000000..4172256 --- /dev/null +++ b/Base/UI/Lenheart_UI_Class.nut @@ -0,0 +1,1100 @@ +/* +文件名:Lenheart_UI_Class.nut +路径:Base/UI/Lenheart_UI_Class.nut +创建日期:2024-08-06 18:56 +文件用途:UI +*/ + +//新窗口队列 +L_Windows_List <- []; +//渲染窗口的默认层在下层 即A层 +WindowsShowABFlag <- false; +//左键单击过的Flag 因为要模拟左键单击还原鼠标状态如果存在这个Flag将不响应鼠标消息一次 +Rindro_MouseClickFlag <- false; + + +//鼠标类 +class R_Mouse { + //是否锁定鼠标 + function IsLock() { + return L_sq_RAB(0x1B46886); + } + //锁定鼠标 + function Lock() { + L_sq_WAB(0x1B46886, 1); + } + //解锁鼠标 + function UnLock() { + L_sq_WAB(0x1B46886, 0); + } + //获取鼠标工作类型 + function GetType() { + // return L_sq_RAB(0x1b46898); + } + //设置鼠标工作类型 + function SetType(Type) { + // L_sq_WAB(0x1b46898, Type); + } + //鼠标0状态下是否按下 + function GetBaseState() { + // return L_sq_RAB(0x1B46874); + } + //鼠标0状态设置是否按下 + function SetBaseState(Flag) { + // return L_sq_WAB(0x1B46874, Flag); + } + + //还原鼠标 + function Restore() { + //这里判断是否有锁定鼠标 如果有就解锁 + if (R_Mouse.IsLock()) R_Mouse.UnLock(); + //如果鼠标工作类型不是0则设置为0 + if (R_Mouse.GetType() != 0) R_Mouse.SetType(0); + //如果鼠标是按下状态则设置为未按下 + // if (R_Mouse.GetBaseState() != 0) R_Mouse.SetBaseState(0); + } +} +//基础窗口类 所有UI类继承与本类 +class LenheartNewUI_BaseWindow extends Rindro_BaseToolClass { + //父控件 + Parent = null; + //子控件 + Childrens = null; + //回调事件 + CallBackFunc = null; + + constructor() { + + } + + //鼠标事件回调 + function OnMouseProc(Flag, MousePos_X, MousePos_Y) { + foreach(Window in Childrens) { + Window.OnMouseProc(Flag, MousePos_X, MousePos_Y); + } + } + //鼠标左键按下回调 + function OnMouseLbDown(MousePos_X, MousePos_Y) { + foreach(Window in Childrens) { + Window.OnMouseLbDown(MousePos_X, MousePos_Y); + } + } + //鼠标左键弹起回调 + function OnMouseLbUp(MousePos_X, MousePos_Y) { + foreach(Window in Childrens) { + Window.OnMouseLbUp(MousePos_X, MousePos_Y); + } + } + //鼠标右键按下回调 + function OnMouseRbDown(MousePos_X, MousePos_Y) { + foreach(Window in Childrens) { + Window.OnMouseRbDown(MousePos_X, MousePos_Y); + } + } + //鼠标右键弹起回调 + function OnMouseRbUp(MousePos_X, MousePos_Y) { + foreach(Window in Childrens) { + Window.OnMouseRbUp(MousePos_X, MousePos_Y); + } + } + //鼠标滚轮时间回调 + function OnMouseWheel(Flag, MousePos_X, MousePos_Y) { + foreach(Window in Childrens) { + Window.OnMouseWheel(Flag, MousePos_X, MousePos_Y); + } + } + //设置回调事件 + function SetCallBackFunc(Func) { + CallBackFunc = Func; + } + //显示 + function Show(obj) { + foreach(Window in Childrens) { + if (Window.CallBackFunc) Window.CallBackFunc(Window); + if (!Window.rawin("Visible")) print(Window.ObjectId + " 显示失败"); + if (Window.Visible) { + Window.Show(obj); + Window.TopShow(obj); + } + } + } + //同步坐标 + function SyncPos(X, Y) { + foreach(Window in Childrens) { + Window.SyncPos(X, Y); + } + } +} + +//游戏窗口类 +class LenheartNewUI_Windows extends LenheartNewUI_BaseWindow { + //窗口名称 + 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; + + //时间片段 + Duration = 0.0; + DurationFlag = 0.0; + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + ObjectId = gObjectId; + //宽度 + Width = gWidth; + //高度 + Height = gHeight; + //标题高度 + TitleH = gTitleH; + + //X坐标 + X = gX; + //Y坐标 + Y = gY; + + ResetFocus(); + + //调用原生方法 + LenheartNewUI_BaseWindow.constructor(); + } + + //切换到最上层窗口 即得到焦点时 + function ResetFocus() { + //遍历全局窗口数组将自己移除重新添加在末尾 + foreach(Index, WindowObj in L_Windows_List) { + if (WindowObj.ObjectId == this.ObjectId) L_Windows_List.remove(Index); + } + L_Windows_List.append(this); + //切换上层显示 + getroottable().WindowsShowABFlag <- true; + } + + /* + * @函数作用: 移除子对象 + * @参数 子对象名称 + */ + function RemoveChild(ChildName) { + foreach(_Index, _Child in Childrens) { + if (_Child.ObjectId == ChildName) { + Childrens.remove(_Index); + return; + } + } + } + /* + * @函数作用: 移除子对象类 + * @参数 类 如果传入第二个参数false 则移除所有非该类的子对象 + * @返回值 + */ + function RemoveChilds(ClassName, ...) { + local RemoveIndexArr = []; + if (vargc == 1 && vargv[0] == false) { + foreach(_Index, _Child in Childrens) { + if (!(_Child instanceof ClassName)) { + RemoveIndexArr.append(_Index - RemoveIndexArr.len()); + } + } + } else { + foreach(_Index, _Child in Childrens) { + if (_Child instanceof ClassName) { + RemoveIndexArr.append(_Index - RemoveIndexArr.len()); + } + } + } + foreach(SaveIndex in RemoveIndexArr) { + Childrens.remove(SaveIndex); + } + } + + /* + * @函数作用: 添加子对象 + * @参数 name + */ + function AddChild(gChild) { + this.Childrens.append(gChild); + gChild.Parent = this; + } + + //关闭窗口 -并没有销毁只是隐藏 + function CloseWindow() { + this.Visible = false; + //还原鼠标 + R_Mouse.Restore(); + //左键单击还原游戏状态 + // L_sq_MouseClick(); + } + //销毁窗口 + function DestroyWindow() { + foreach(Index, WindowObj in L_Windows_List) { + if (WindowObj.ObjectId == this.ObjectId) L_Windows_List.remove(Index); + } + //还原鼠标 + R_Mouse.Restore(); + //左键单击还原游戏状态 + // L_sq_MouseClick(); + } + + ItemInfoDrawS = null; + //绘制道具相信信息 + ItemObject = null; + + //绘制道具带道具信息 带道具边框 + function DrawItemEx(X, Y, Id, Count) { + if (!Rindro_ItemInfoObject.rawin(Id)) Id = 3037; + if (Id != -1) { + local Rarity = Rindro_ItemInfoObject[Id].Rarity ? Rindro_ItemInfoObject[Id].Rarity : 0; + L_sq_DrawImg("interface2/rindro_reward.img", Rarity, X - 3, Y - 3); + L_Sq_DrawItem(X, Y, Id, Count, 0, 0, 0); + if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, 24, 24)) { + ItemInfoDrawS = {}; + ItemInfoDrawS.X <- X; + ItemInfoDrawS.Y <- Y; + ItemInfoDrawS.ItemId <- Id; + } + } + } + //绘制道具带道具信息 + function DrawItemBase(X, Y, Id, Count) { + if (!Rindro_ItemInfoObject.rawin(Id)) Id = 3037; + if (Id != -1) { + local Rarity = Rindro_ItemInfoObject[Id].Rarity ? Rindro_ItemInfoObject[Id].Rarity : 0; + L_Sq_DrawItem(X, Y, Id, Count, 0, 0, 0); + if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, 24, 24)) { + ItemInfoDrawS = {}; + ItemInfoDrawS.X <- X; + ItemInfoDrawS.Y <- Y; + ItemInfoDrawS.ItemId <- Id; + } + } + } + //绘制悬停 + function DrawItemInfo() { + if (ItemInfoDrawS) { + if (!ItemObject) { + local ItemId = ItemInfoDrawS.ItemId; + if (Rindro_ItemInfoObject.rawin(ItemId)) { + ItemObject = ItemInfoClass(Rindro_ItemInfoObject[ItemId]); + } + } + ItemObject.Show(ItemInfoDrawS.X, ItemInfoDrawS.Y - ItemObject.PageLength); + } else { + ItemObject = null; + } + } + + //生成DT + function GenerateDt() { + try { + local CurT = L_Getmicroseconds(); + Duration = (CurT - DurationFlag); + DurationFlag = CurT; + } catch (exception) { + + } + } + + function Show(obj) { + GenerateDt(); + if (!Visible) return; + + //调用原生方法 + LenheartNewUI_BaseWindow.Show(obj); + if (DeBugMode) DeBug(obj); + + + DrawItemInfo(); + //初始化绘制道具 + ItemInfoDrawS = null; + } + + function TopShow(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 (Flag == 1) { + if (MoveFlag) { + //左键拖动 + X = B_X - (M_Xpos - MousePos_X); + Y = B_Y - (M_Ypos - MousePos_Y); + } + } + //调用原生方法 + LenheartNewUI_BaseWindow.OnMouseProc(Flag, MousePos_X, 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; + } + } + //调用原生方法 + LenheartNewUI_BaseWindow.OnMouseLbDown(MousePos_X, MousePos_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; + } + //调用原生方法 + LenheartNewUI_BaseWindow.OnMouseLbUp(MousePos_X, MousePos_Y); + } + //override + //鼠标右键按下回调 + function OnMouseRbDown(MousePos_X, MousePos_Y) { + if (!Visible) return; + //调用原生方法 + LenheartNewUI_BaseWindow.OnMouseRbDown(MousePos_X, MousePos_Y); + } + //override + //鼠标右键弹起回调 + function OnMouseRbUp(MousePos_X, MousePos_Y) { + if (!Visible) return; + //调用原生方法 + LenheartNewUI_BaseWindow.OnMouseRbUp(MousePos_X, MousePos_Y); + } + //override + //鼠标滚轮事件回调 + function OnMouseWheel(Flag, MousePos_X, MousePos_Y) { + if (!Visible) return; + //调用原生方法 + LenheartNewUI_BaseWindow.OnMouseWheel(Flag, MousePos_X, MousePos_Y); + } +} + + +//创建窗口 如果已存在则返回窗口 +function LenheartNewUI_CreateWindow(ClassName, gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + foreach(Index, WindowObj in L_Windows_List) { + if (WindowObj.ObjectId == gObjectId) { + return WindowObj; + } + } + return ClassName(gObjectId, gX, gY, gWidth, gHeight, gTitleH); +} +//销毁窗口 +function LenheartNewUI_DestoryWindow(gObjectId) { + foreach(Index, WindowObj in L_Windows_List) { + if (WindowObj.ObjectId == gObjectId) { + L_Windows_List.remove(Index); + return true; + } + } + return false; +} + + +//遍历窗口查询是否有悬停在新窗口中 +function CheackMouseInNewWindows(MousePos_X, MousePos_Y) { + local Flag = false; + foreach(Window in L_Windows_List) { + if (!Window.Visible) continue; + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Window.X, Window.Y, Window.Width, Window.Height)) { + Flag = true; + // print(Window.ObjectId); + // Sout("%L",Window.ObjectId); + return Flag; + } + } + return Flag; +} +//遍历是否悬停在原生窗口上 +function CheackMouseInOldWindows() { + // if (!NotOldWindowsMap.rawin(L_sq_RA(0x1A32950)) && (L_sq_RA(0x1A32950) <= 2390 || L_sq_RA(0x1A32950) >= 2500) && (L_sq_RA(0x1A32950) <= 120 || L_sq_RA(0x1A32950) >= 140)) { + // return true; + // } + // local Id = L_sq_RA(0x1A32950); + // if (Id == Rindro_Info_Base_Nowindow || Id <= 300) return false; + // return true; + + + //城镇基础背景窗口 副本背景 城镇背景 拓展技能按钮 切换技能页按钮 + local OldBaseWindowArr = [0x184D0C4, 0x0184CF6C, 0x15A249C, 0x184D174]; + local WindowAddress = L_sq_RA(0x1B474D4); + if (WindowAddress) { + local Flag = L_sq_RA(WindowAddress); + // print(format("%02X", Flag)); + foreach(value in OldBaseWindowArr) { + if (Flag == value) { + // if ((L_sq_RA(WindowAddress + 0x14) == 0 && L_sq_RA(WindowAddress + 0x18) == 0) || Flag == 0x184D0C4) { + // print(false); + return false; + // } + } + } + } + return true; +} + +//设定鼠标逻辑 +function RunMouseLogic(MousePos_X, MousePos_Y) { + //解锁鼠标 如果鼠标已处于锁定状态 并且没有悬停在任何窗口上 解锁鼠标 + if (R_Mouse.IsLock()) { + //不在任何新窗口上 + if (!CheackMouseInNewWindows(MousePos_X, MousePos_Y)) { + //还原鼠标 + R_Mouse.Restore(); + } + //在任何老窗口上 并且渲染层未A层 也就是下层渲染 + else if (CheackMouseInOldWindows() && !getroottable().WindowsShowABFlag) { + //还原鼠标 + R_Mouse.Restore(); + } + } + //锁定鼠标 如果鼠标处于未锁定状态 并且悬停在任意一个窗口上 + else if (!R_Mouse.IsLock() && CheackMouseInNewWindows(MousePos_X, MousePos_Y)) { + //如果没有悬停任何原生窗口直接锁 + if (!CheackMouseInOldWindows()) { + //锁定鼠标 + R_Mouse.Lock(); + //设置鼠标模式 + R_Mouse.SetType(1); + } + //如果有悬停原生窗口 就要判断AB层 + else { + if (getroottable().WindowsShowABFlag) { + //锁定鼠标 + R_Mouse.Lock(); + //设置鼠标模式 + R_Mouse.SetType(1); + } + } + } +} + +//鼠标消息回调 +function L_MouseCallBack(MouseState, MouseFlag, MousePos_X, MousePos_Y) { + + // //获取基础无窗口的位置的值 + // if (!Rindro_Info_Base_Nowindow) { + // if (!sq_getMyCharacter()) return; + // if (!Rindro_Info_Base_Nowindow) { + // IMouse.SetPos((800 * 0.45).tointeger(), (600 * 0.1).tointeger()); + // if (MousePos_X == (getroottable().Rindro_Scr_Width * 0.45).tointeger() && MousePos_Y == (getroottable().Rindro_Scr_High * 0.1).tointeger()) { + // Rindro_Info_Base_Nowindow = L_sq_RA(0x1A32950); + // } + // } + // } + //用于抵消Esc造成的点击事件 + // if (Rindro_MouseClickFlag) { + // Rindro_MouseClickFlag--; + // return; + // } + if (MouseState == 0x200) { + //常规事件就要设定鼠标是否锁定逻辑 + RunMouseLogic(MousePos_X, MousePos_Y); + } + + //判断是否悬停活动图标 + if (getroottable().rawin("EventList_Obj")) EventList_Obj.CheckInEvent(MousePos_X, MousePos_Y); + //如果渲染层级在下级 即A层 或者是 鼠标没有悬停在任何新窗口上时 执行判断 如果悬停在原生窗口 就解除鼠标锁定 如果点击 就改变渲染层级 + if (!getroottable().WindowsShowABFlag || !CheackMouseInNewWindows(MousePos_X, MousePos_Y)) { + if (CheackMouseInOldWindows()) { + //如果点击了原生窗口 或者使用了滚轮 就把渲染队列改成下 + if (MouseState == 0x201 || MouseState == 0x20a) getroottable().WindowsShowABFlag <- false; + if (MouseState != 0x20a) 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; + //点击动画 + if (getroottable().WindowsShowABFlag) L_sq_WA(0x1B46874, 1); + Window.OnMouseLbDown(MousePos_X, MousePos_Y); + break; + + } + //左键松开 + case 0x202: { + if (getroottable().WindowsShowABFlag) L_sq_WA(0x1B46874, 0); + 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; + } + } +} +//打开原生窗口回调 +function L_OpenOldWindowCallBack(WindowIndex) { + //将新窗口渲染队列改为下层 抵消窗口 Esc窗口 登录可能显示的任务窗口 + if (WindowIndex != 170 && WindowIndex != 176) { + getroottable().WindowsShowABFlag <- false; + } +} + +//窗口逻辑入口 +function L_WindowsLogic(obj) { + //是否存在一个窗口Flag + local WindowExistence = false; + //遍历窗口队列 如果可见则调用Show 只要有一个可见就写入Flag + foreach(Window in L_Windows_List) { + Window.Proc(obj); + if (Window.Visible) { + Window.Show(obj); + Window.TopShow(obj); + if (!Window.rawin("NoWindow")) { + WindowExistence = true; + } + } + } + + //如果可见 需要调用一个原生窗口抵消ESC + if (WindowExistence) { + local W = sq_GetPopupWindowMainCotrol(170); + if (!W) L_NewWindows("Lenheart", 170, 0x65535); + else { + W.SetVisible(false); + W.SetEnable(false); + } + } + //没有任何新窗口打开 并且原生窗口开启者 + else { + local W = sq_GetPopupWindowMainCotrol(170); + if (W) { + L_sq_UseSkill(DIK_ESCAPE); + } + } + //如果按下ESC键要将所有的窗口关闭 + if (KeyPressNB.isKeyPress(48, "AllLenheartWindows")) { + local Flag = false; + foreach(Window in L_Windows_List) { + if (!Window.rawin("NoWindow")) { + Flag = true; + Window.CloseWindow(); + } + } + if (Flag) { + //还原鼠标 + R_Mouse.Restore(); + L_sq_MouseClick(); + Rindro_MouseClickFlag = 5; + } + } +} +//绘制下层回调 +function L_DrawWindow_A() { + local obj = sq_getMyCharacter(); + if (!obj) return; + + //A层只在下层渲染 + if (getroottable().WindowsShowABFlag == false) L_WindowsLogic(obj); +} +//绘制上层回调 +function L_DrawWindow_B() { + local obj = sq_getMyCharacter(); + if (!obj) return; + + //B层只在上层渲染 + if (getroottable().WindowsShowABFlag) L_WindowsLogic(obj); + + local RootTab = getroottable(); + if (RootTab.rawin("LenheartTopFuncTab")) { + local LenheartFunc = RootTab["LenheartTopFuncTab"]; + foreach(Func in LenheartFunc) { + Func(obj); + } + } +} + + + + +class LenheartNewUI_CommonUi extends LenheartNewUI_BaseWindow { + X = 0; + Y = 0; + Localtion_X = 0; + Localtion_Y = 0; + Width = null; + Height = null; + isLBDown = false; + isInRect = false; + + OnClick = null; + ObjectId = null; + + Visible = true; + + TopCallBackFunc = null; + + constructor(x, y, width, height) { + this.Localtion_X = x; + this.Localtion_Y = y; + this.Width = width; + this.Height = height; + + ObjectId = Clock(); + } + + //同步坐标 + function SyncPos(x, y) { + this.X = Localtion_X + x; + this.Y = Localtion_Y + y; + } + + //鼠标事件回调 + function OnMouseProc(Flag, MousePos_X, MousePos_Y) { + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) isInRect = true; + else isInRect = false; + } + //鼠标左键按下回调 + function OnMouseLbDown(MousePos_X, MousePos_Y) { + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) isLBDown = true; + } + //鼠标左键弹起回调 + function OnMouseLbUp(MousePos_X, MousePos_Y) { + if (isLBDown && OnClick) { + local obj = sq_getMyCharacter(); + obj.sq_PlaySound("CLICK_BUTTON1"); + OnClick(); + } + isLBDown = false; + } + + //鼠标右键按下回调 + function OnMouseRbDown(MousePos_X, MousePos_Y) { + + } + //鼠标右键弹起回调 + function OnMouseRbUp(MousePos_X, MousePos_Y) { + + } + //鼠标滚轮时间回调 + function OnMouseWheel(Flag, MousePos_X, MousePos_Y) { + + } + + function TopShow(obj) { + if (TopCallBackFunc) TopCallBackFunc(obj, this); + } +} + +class LenheartNewUI_BaseButton extends LenheartNewUI_CommonUi { + State = 0; + BaseIdx = 29; + DWidth = null; + Path = null; + Idx = null; + + + constructor(X, Y, W, H, Path, Idx) { + this.DWidth = W; + this.Path = Path; + this.Idx = Idx; + LenheartNewUI_CommonUi.constructor(X, Y, W, H); + + } + + function SetFrame(gPath, gIdx) { + if (gPath) Path = gPath; + Idx = gIdx; + } + + function Show(obj) { + //不可用 + if (State == 8) { + L_sq_DrawImg(Path, Idx + 3, X, Y + 1); + } else { + //按下 + if (isLBDown) { + L_sq_DrawImg(Path, Idx + 2, X, Y + 1); + } + //悬停 + else if (isInRect) { + L_sq_DrawImg(Path, Idx + 1, X, Y); + } + //普通 + else { + L_sq_DrawImg(Path, Idx, X, Y); + } + } + } +} + +class LenheartNewUI_Button extends LenheartNewUI_CommonUi { + State = 0; + BaseIdx = 29; + DWidth = null; + Path = "interface/lenheartwindowcommon.img"; + Idx = 172; + FillWidth = 2; + FirstWidth = 28; + + + + constructor(X, Y, W) { + this.DWidth = W; + LenheartNewUI_CommonUi.constructor(X, Y, W + 28 * 2, 24); + } + + function SetFrame(gPath, gIdx) { + if (gPath) Path = gPath; + Idx = gIdx; + } + + function Show(obj) { + //不可用 + if (State == 8) { + L_sq_DrawButton(X, Y + 1, this.DWidth, Path, Idx + 9, FillWidth, FirstWidth); + } else { + //按下 + if (isLBDown) { + L_sq_DrawButton(X, Y + 1, this.DWidth, Path, Idx + 3, FillWidth, FirstWidth); + } + //悬停 + else if (isInRect) { + L_sq_DrawButton(X, Y, this.DWidth, Path, Idx + 3, FillWidth, FirstWidth); + } + //普通 + else { + L_sq_DrawButton(X, Y, this.DWidth, Path, Idx, FillWidth, FirstWidth); + } + } + } +} + +class LenheartNewUI_ButtonText extends LenheartNewUI_Button { + TextStr = null; + TextX = null; + TextY = null; + TextColor = null; + TextRColor = null; + + TextXoffset = null; + TextYoffset = null; + + constructor(X, Y, W, Str) { + LenheartNewUI_Button.constructor(X, Y, W); + this.TextStr = Str; + TextColor = sq_RGBA(185, 148, 96, 255); + TextRColor = sq_RGBA(227, 212, 154, 255); + + TextXoffset = 19; + TextYoffset = 3; + } + + function SetTextColor(RGBA) { + TextColor = RGBA; + } + + function SetTextOffset(gX, gY) { + TextXoffset = gX; + TextYoffset = gY; + } + + function Show(obj) { + LenheartNewUI_Button.Show(obj); + local Color = TextColor; + local SY = Y + TextYoffset; + if (State != 8) { + if (isLBDown) { + SY = Y + TextYoffset + 1; + } + if (isInRect || State == 1) { + Color = TextRColor; + } + } + L_sq_DrawCode(TextStr, X + TextXoffset + 19, SY + 5, Color, 0, 1); + } +} + +class LenheartNewUI_BaseInput extends LenheartNewUI_CommonUi { + State = 0; + InputState = 0; + DWidth = null; + str = ""; + sliceCode = "|"; + BaseTime = 0; + InputController = null; + + constructor(X, Y, W, H) { + this.DWidth = W; + LenheartNewUI_CommonUi.constructor(X, Y, W, H); + } + + function sliceCodeFlicker() { + local T = Clock(); + if ((T - 500) >= BaseTime) { + BaseTime = T; + if (sliceCode.len() > 0) sliceCode = ""; + else if (sliceCode.len() == 0) sliceCode = "|"; + } + } + + function Show(obj) { + //光标闪烁 + if (InputState == 1) sliceCodeFlicker(); + else sliceCode = ""; + + L_sq_DrawImg("interface/lenheartwindowcommon.img", 63, this.X, this.Y); + for (local i = 0; i< this.Width; i++) { + L_sq_DrawImg("interface/lenheartwindowcommon.img", 64, this.X + 3 + i, this.Y); + } + L_sq_DrawImg("interface/lenheartwindowcommon.img", 65, this.X + 3 + this.Width, this.Y); + L_sq_DrawCode(str + sliceCode, this.X + 4, this.Y + 3, sq_RGBA(179, 169, 135, 255), 0, 1); + this.OnClick = function() { + InputController = L_sq_NewInputBox(this.X, this.Y, this.Width, this.Height, str); + InputState = 1; + } + + + if (InputController) { + local StrBuf = L_sq_GetInputBoxStr(InputController); + if (StrBuf != "LenheartNULL") str = StrBuf; + else { + InputController = null; + InputState = 0; + } + } + } +} + +//复选框 +class LenheartNewUI_SwitchButton extends LenheartNewUI_CommonUi { + State = 0; + ImgIndex = null; + + constructor(X, Y) { + LenheartNewUI_CommonUi.constructor(X, Y, 14, 15); + } + + function Show(obj) { + //不可用 + if (State == 8) { + L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex + 3 : 141, X, Y + 1); + } else { + //悬停 + if (isLBDown) { + L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex + 2 : 140, X, Y + 1); + } + //按下 + else if (isInRect) { + if (State == 0) + L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex + 1 : 139, X, Y); + if (State == 1) + L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex + 2 : 140, X, Y); + } + //普通 + else { + if (State == 0) + L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex : 138, X, Y); + if (State == 1) + L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex + 2 : 140, X, Y); + + } + } + } +} + +class LenheartNewUI_SwitchButtonText extends LenheartNewUI_SwitchButton { + + TextStr = null; + TextX = 0; + TextY = 0; + TextColor = null; + TextRColor = null; + + + constructor(X, Y, Str) { + LenheartNewUI_SwitchButton.constructor(X, Y); + this.TextStr = Str; + TextColor = sq_RGBA(221, 197, 147, 250); + TextRColor = sq_RGBA(255, 255, 184, 250); + } + + function SetTextColor(RGBA) { + TextColor = RGBA; + } + + function SetTextPos(gX, gY) { + TextX = gX; + TextY = gY; + } + + function Show(obj) { + LenheartNewUI_SwitchButton.Show(obj); + local Color = TextColor; + local SY = Y; + if (State != 8) { + if (isLBDown) { + SY = Y + 1; + } + if (isInRect || State == 1) { + Color = TextRColor; + } + } + L_sq_DrawCode(TextStr, X + 16 + TextX, SY + 1 + TextY, Color, 0, 1); + } +} + +class LenheartNewUI_Tabbars extends LenheartNewUI_CommonUi { + State = 0; + Path = "interface/lenheartwindowcommon.img"; + Idx = 29; + + constructor(X, Y, ...) { + if (vargc == 2) { + LenheartNewUI_CommonUi.constructor(X, Y, vargv[0], vargv[1]); + } else { + LenheartNewUI_CommonUi.constructor(X, Y, 61, 19); + } + } + + function SetFrame(gPath, gIdx) { + if (gPath) Path = gPath; + Idx = gIdx; + } + + function Show(obj) { + //不可用 + if (State == 8) { + L_sq_DrawImg(Path, Idx + 3, X, Y); + } else { + //按下 + if (isLBDown) { + L_sq_DrawImg(Path, Idx + 1, X, Y + 1); + } + //悬停 + else if (isInRect) { + if (State == 0) + L_sq_DrawImg(Path, Idx + 1, X, Y); + if (State == 1) + L_sq_DrawImg(Path, Idx + 2, X, Y); + } + //普通 + else { + if (State == 0) + L_sq_DrawImg(Path, Idx, X, Y); + if (State == 1) + L_sq_DrawImg(Path, Idx + 2, X, Y); + } + } + } +} + +class LenheartNewUI_TabbarsText extends LenheartNewUI_Tabbars { + TextStr = null; + TextX = null; + TextY = null; + TextColor = null; + TextRColor = null; + + TextXoffset = null; + TextYoffset = null; + + constructor(X, Y, Str, ...) { + if (vargc == 2) { + LenheartNewUI_Tabbars.constructor(X, Y, vargv[0], vargv[1]); + } else { + LenheartNewUI_Tabbars.constructor(X, Y); + } + this.TextStr = Str; + TextColor = sq_RGBA(124, 110, 82, 255); + TextRColor = sq_RGBA(185, 172, 145, 255); + + TextXoffset = 19; + TextYoffset = 3; + } + + function SetTextColor(RGBA) { + TextColor = RGBA; + } + + function SetTextOffset(gX, gY) { + TextXoffset = gX; + TextYoffset = gY; + } + + function Show(obj) { + LenheartNewUI_Tabbars.Show(obj); + local Color = TextColor; + local SY = Y + TextYoffset; + if (State != 8) { + if (isLBDown) { + SY = Y + TextYoffset + 1; + } + if (isInRect || State == 1) { + Color = TextRColor; + } + } + if (State == 1) + L_sq_DrawCode(TextStr, X + TextXoffset, SY, Color, 0, 1); + if (State == 0 || State == 8) + L_sq_DrawCode(TextStr, X + TextXoffset, SY + 2, Color, 0, 1); + } +} \ No newline at end of file diff --git a/Base/UI/OldWindowsMap.nut b/Base/UI/OldWindowsMap.nut new file mode 100644 index 0000000..80f1567 --- /dev/null +++ b/Base/UI/OldWindowsMap.nut @@ -0,0 +1,52 @@ +/* +文件名:OldWindowsMap.nut +路径:Base/UI/OldWindowsMap.nut +创建日期:2024-08-06 18:56 +文件用途:用于查询是否鼠标悬停在原生窗口上的Flag 以下编号代表着没有悬停其他均为悬停在原生窗口 +*/ +NotOldWindowsMap <- {} +NotOldWindowsMap.rawset(92, 1); +NotOldWindowsMap.rawset(79, 1); +NotOldWindowsMap.rawset(2395, 1); +NotOldWindowsMap.rawset(2396, 1); +NotOldWindowsMap.rawset(3877, 1); +NotOldWindowsMap.rawset(3878, 1); +NotOldWindowsMap.rawset(3873, 1); +NotOldWindowsMap.rawset(3874, 1); +NotOldWindowsMap.rawset(3858, 1); +NotOldWindowsMap.rawset(3871, 1); +NotOldWindowsMap.rawset(3857, 1); +NotOldWindowsMap.rawset(3861, 1); +NotOldWindowsMap.rawset(3862, 1); +NotOldWindowsMap.rawset(93, 1); +NotOldWindowsMap.rawset(94, 1); +NotOldWindowsMap.rawset(95, 1); +NotOldWindowsMap.rawset(96, 1); +NotOldWindowsMap.rawset(97, 1); +NotOldWindowsMap.rawset(98, 1); +NotOldWindowsMap.rawset(99, 1); +NotOldWindowsMap.rawset(100, 1); +NotOldWindowsMap.rawset(101, 1); +NotOldWindowsMap.rawset(114, 1); +NotOldWindowsMap.rawset(88, 1); +NotOldWindowsMap.rawset(102, 1); +NotOldWindowsMap.rawset(108, 1); +NotOldWindowsMap.rawset(109, 1); +NotOldWindowsMap.rawset(103, 1); +NotOldWindowsMap.rawset(104, 1); +NotOldWindowsMap.rawset(110, 1); +NotOldWindowsMap.rawset(111, 1); +NotOldWindowsMap.rawset(105, 1); +NotOldWindowsMap.rawset(106, 1); +NotOldWindowsMap.rawset(112, 1); +NotOldWindowsMap.rawset(113, 1); +NotOldWindowsMap.rawset(107, 1); +NotOldWindowsMap.rawset(87, 1); +NotOldWindowsMap.rawset(86, 1); +NotOldWindowsMap.rawset(80, 1); +NotOldWindowsMap.rawset(81, 1); +NotOldWindowsMap.rawset(82, 1); +NotOldWindowsMap.rawset(83, 1); +NotOldWindowsMap.rawset(4067, 1); +NotOldWindowsMap.rawset(122, 1); +NotOldWindowsMap.rawset(120, 1); \ No newline at end of file diff --git a/Base/_ENUM/_ENUM_KEY.nut b/Base/_ENUM/_ENUM_KEY.nut new file mode 100644 index 0000000..0e3f235 --- /dev/null +++ b/Base/_ENUM/_ENUM_KEY.nut @@ -0,0 +1,241 @@ +/* +文件名:_ENUM_KEY.nut +路径:Base/_ENUM/_ENUM_KEY.nut +创建日期:2024-08-06 22:09 +文件用途:按键枚举类 +*/ +//反遍历 +L_sq_WA(0x1370FD7, 0); +DIK_ESCAPE <- 0x01 +DIK_1 <- 0x02 +DIK_2 <- 0x03 +DIK_3 <- 0x04 +DIK_4 <- 0x05 +DIK_5 <- 0x06 +DIK_6 <- 0x07 +DIK_7 <- 0x08 +DIK_8 <- 0x09 +DIK_9 <- 0x0A +DIK_0 <- 0x0B +DIK_MINUS <- 0x0C /* - on main keyboard */ +DIK_EQUALS <- 0x0D +DIK_BACK <- 0x0E /* backspace */ +DIK_TAB <- 0x0F +DIK_Q <- 0x10 +DIK_W <- 0x11 +DIK_E <- 0x12 +DIK_R <- 0x13 +DIK_T <- 0x14 +DIK_Y <- 0x15 +DIK_U <- 0x16 +DIK_I <- 0x17 +DIK_O <- 0x18 +DIK_P <- 0x19 +DIK_LBRACKET <- 0x1A +DIK_RBRACKET <- 0x1B +DIK_RETURN <- 0x1C /* Enter on main keyboard */ +DIK_LCONTROL <- 0x1D +DIK_A <- 0x1E +DIK_S <- 0x1F +DIK_D <- 0x20 +DIK_F <- 0x21 +DIK_G <- 0x22 +DIK_H <- 0x23 +DIK_J <- 0x24 +DIK_K <- 0x25 +DIK_L <- 0x26 +DIK_SEMICOLON <- 0x27 +DIK_APOSTROPHE <- 0x28 +DIK_GRAVE <- 0x29 /* accent grave */ +DIK_LSHIFT <- 0x2A +DIK_BACKSLASH <- 0x2B +DIK_Z <- 0x2C +DIK_X <- 0x2D +DIK_C <- 0x2E +DIK_V <- 0x2F +DIK_B <- 0x30 +DIK_N <- 0x31 +DIK_M <- 0x32 +DIK_COMMA <- 0x33 +DIK_PERIOD <- 0x34 /* . on main keyboard */ +DIK_SLASH <- 0x35 /* / on main keyboard */ +DIK_RSHIFT <- 0x36 +DIK_MULTIPLY <- 0x37 /* * on numeric keypad */ +DIK_LMENU <- 0x38 /* left Alt */ +DIK_SPACE <- 0x39 +DIK_CAPITAL <- 0x3A +DIK_F1 <- 0x3B +DIK_F2 <- 0x3C +DIK_F3 <- 0x3D +DIK_F4 <- 0x3E +DIK_F5 <- 0x3F +DIK_F6 <- 0x40 +DIK_F7 <- 0x41 +DIK_F8 <- 0x42 +DIK_F9 <- 0x43 +DIK_F10 <- 0x44 +DIK_NUMLOCK <- 0x45 +DIK_SCROLL <- 0x46 /* Scroll Lock */ +DIK_NUMPAD7 <- 0x47 +DIK_NUMPAD8 <- 0x48 +DIK_NUMPAD9 <- 0x49 +DIK_SUBTRACT <- 0x4A /* - on numeric keypad */ +DIK_NUMPAD4 <- 0x4B +DIK_NUMPAD5 <- 0x4C +DIK_NUMPAD6 <- 0x4D +DIK_ADD <- 0x4E /* + on numeric keypad */ +DIK_NUMPAD1 <- 0x4F +DIK_NUMPAD2 <- 0x50 +DIK_NUMPAD3 <- 0x51 +DIK_NUMPAD0 <- 0x52 +DIK_DECIMAL <- 0x53 /* . on numeric keypad */ +DIK_OEM_102 <- 0x56 /* <> or \| on RT 102-key keyboard (Non-U.S.) */ +DIK_F11 <- 0x57 +DIK_F12 <- 0x58 +DIK_F13 <- 0x64 /* (NEC PC98) */ +DIK_F14 <- 0x65 /* (NEC PC98) */ +DIK_F15 <- 0x66 /* (NEC PC98) */ +DIK_KANA <- 0x70 /* (Japanese keyboard) */ +DIK_ABNT_C1 <- 0x73 /* /? on Brazilian keyboard */ +DIK_CONVERT <- 0x79 /* (Japanese keyboard) */ +DIK_NOCONVERT <- 0x7B /* (Japanese keyboard) */ +DIK_YEN <- 0x7D /* (Japanese keyboard) */ +DIK_ABNT_C2 <- 0x7E /* Numpad . on Brazilian keyboard */ +DIK_NUMPADEQUALS <- 0x8D /* = on numeric keypad (NEC PC98) */ +DIK_PREVTRACK <- 0x90 /* Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) */ +DIK_AT <- 0x91 /* (NEC PC98) */ +DIK_COLON <- 0x92 /* (NEC PC98) */ +DIK_UNDERLINE <- 0x93 /* (NEC PC98) */ +DIK_KANJI <- 0x94 /* (Japanese keyboard) */ +DIK_STOP <- 0x95 /* (NEC PC98) */ +DIK_AX <- 0x96 /* (Japan AX) */ +DIK_UNLABELED <- 0x97 /* (J3100) */ +DIK_NEXTTRACK <- 0x99 /* Next Track */ +DIK_NUMPADENTER <- 0x9C /* Enter on numeric keypad */ +DIK_RCONTROL <- 0x9D +DIK_MUTE <- 0xA0 /* Mute */ +DIK_CALCULATOR <- 0xA1 /* Calculator */ +DIK_PLAYPAUSE <- 0xA2 /* Play / Pause */ +DIK_MEDIASTOP <- 0xA4 /* Media Stop */ +DIK_VOLUMEDOWN <- 0xAE /* Volume - */ +DIK_VOLUMEUP <- 0xB0 /* Volume + */ +DIK_WEBHOME <- 0xB2 /* Web home */ +DIK_NUMPADCOMMA <- 0xB3 /* , on numeric keypad (NEC PC98) */ +DIK_DIVIDE <- 0xB5 /* / on numeric keypad */ +DIK_SYSRQ <- 0xB7 +DIK_RMENU <- 0xB8 /* right Alt */ +DIK_PAUSE <- 0xC5 /* Pause */ +DIK_HOME <- 0xC7 /* Home on arrow keypad */ +DIK_UP <- 0xC8 /* UpArrow on arrow keypad */ +DIK_PRIOR <- 0xC9 /* PgUp on arrow keypad */ +DIK_LEFT <- 0xCB /* LeftArrow on arrow keypad */ +DIK_RIGHT <- 0xCD /* RightArrow on arrow keypad */ +DIK_END <- 0xCF /* End on arrow keypad */ +DIK_DOWN <- 0xD0 /* DownArrow on arrow keypad */ +DIK_NEXT <- 0xD1 /* PgDn on arrow keypad */ +DIK_INSERT <- 0xD2 /* Insert on arrow keypad */ +DIK_DELETE <- 0xD3 /* Delete on arrow keypad */ +DIK_LWIN <- 0xDB /* Left Windows key */ +DIK_RWIN <- 0xDC /* Right Windows key */ +DIK_APPS <- 0xDD /* AppMenu key */ +DIK_POWER <- 0xDE /* System Power */ +DIK_SLEEP <- 0xDF /* System Sleep */ +DIK_WAKE <- 0xE3 /* System Wake */ +DIK_WEBSEARCH <- 0xE5 /* Web Search */ +DIK_WEBFAVORITES <- 0xE6 /* Web Favorites */ +DIK_WEBREFRESH <- 0xE7 /* Web Refresh */ +DIK_WEBSTOP <- 0xE8 /* Web Stop */ +DIK_WEBFORWARD <- 0xE9 /* Web Forward */ +DIK_WEBBACK <- 0xEA /* Web Back */ +DIK_MYCOMPUTER <- 0xEB /* My Computer */ +DIK_MAIL <- 0xEC /* Mail */ +DIK_MEDIASELECT <- 0xED /* Media Select */ + +function Rindro_GetEquAddr(addr) { + switch (addr) { + case 1: + return 0x3038; + break; + case 2: + return 0x304C; + break; + case 3: + return 0x3048; + break; + case 4: + return 0x3050; + break; + case 5: + return 0x3044; + break; + case 6: + return 0x3040; + break; + case 7: + return 0x3058; + break; + case 8: + return 0x305C; + break; + case 9: + return 0x3054; + break; + case 10: + return 0x3060; + break; + case 11: + return 0x3064; + break; + case 12: + return 0x303c; + break; + + + case 13: //帽子 + return 0x3010; + break; + case 14: //头部 + return 0x3014; + break; + case 15: //脸 + return 0x3018; + break; + case 16: + return 0x301c; + break; + case 17: + return 0x3020; + break; + case 18: + return 0x3024; + break; + case 19: + return 0x3028; + break; + case 20: + return 0x302c; + break; + case 21: + return 0x3030; + break; + case 22: + return 0x3034; + break; + case 23: + return 0x3030; + break; + case 24: + return 0x3068; + break; + case 25: + return 0x306C; + break; + case 26: + return 0x3070; + break; + case 27: + return 0x3074; + break; + } + return -1; +} \ No newline at end of file diff --git a/Base/_Tool/BaseTool_Class.nut b/Base/_Tool/BaseTool_Class.nut new file mode 100644 index 0000000..42f85a8 --- /dev/null +++ b/Base/_Tool/BaseTool_Class.nut @@ -0,0 +1,277 @@ +/* +文件名:BaseTool_Class.nut +路径:Base/_Tool/BaseTool_Class.nut +创建日期:2024-08-06 23:49 +文件用途:基础工具类 +*/ +//Json类 +class Json { + function Encode(Table) { + local Size = Table.len(); + local Pos = 0; + local Str = "{"; + foreach(Key, Value in Table) { + ++Pos; + Str += "\""; + Str += Key.tostring(); + Str += "\""; + Str += ":"; + if (typeof(Value) == "string") { + Str += "\""; + Str += Value; + Str += "\""; + } else if (typeof(Value) == "table") { + Str += Json.Encode(Value); + } else if (typeof(Value) == "array") { + Str += "["; + foreach(ArrObj in Value) { + if (typeof(ArrObj) == "table") Str += Json.Encode(Value); + else { + Str += ArrObj; + Str += ","; + } + } + Str = Str.slice(0, Str.len() - 1); + Str += "]"; + } else Str += Value; + if (Pos != Size) Str += ","; + } + Str += "}"; + return Str; + } + + function Decode(Str) { + Str = L_sq_DecondeJson(Str); + local Str = "local _M = " + Str + ";\n return _M;\n"; + local Func = compilestring(Str); + return Func(); + } +} +//Key 键盘按键类 +class KeyPress { + function KeyDown(obj, KeyValue) { + local KeyEvent = obj.getVar(KeyValue.tostring()); //声明储存器 + KeyEvent.clear_vector(); //清空储存器的向量位 + if (sq_IsKeyDown(KeyValue, ENUM_SUBKEY_TYPE_ALL) && KeyEvent.getInt(0) == 0) { + KeyEvent.setInt(0, 1); + return true; + } + } + + function KeyUp(obj, KeyValue) { + local KeyEvent = obj.getVar(KeyValue.tostring()); //声明储存器 + if (sq_IsKeyUp(KeyValue, ENUM_SUBKEY_TYPE_ALL)) { + KeyEvent.setInt(0, 0); + } + } + + function isKeyPress(KeyValue) { + local obj = sq_getMyCharacter(); + if (KeyPress.KeyDown(obj, KeyValue)) { + return true; + } + KeyPress.KeyUp(obj, KeyValue); + } +} +//Key 键盘按键类 +class KeyPressNB { + function KeyDown(obj, KeyValue, VarKey) { + local KeyEvent = obj.getVar(VarKey); //声明储存器 + KeyEvent.clear_vector(); //清空储存器的向量位 + if (sq_IsKeyDown(KeyValue, ENUM_SUBKEY_TYPE_ALL) && KeyEvent.getInt(0) == 0) { + KeyEvent.setInt(0, 1); + return true; + } + } + + function KeyUp(obj, KeyValue, VarKey) { + local KeyEvent = obj.getVar(VarKey); //声明储存器 + if (sq_IsKeyUp(KeyValue, ENUM_SUBKEY_TYPE_ALL)) { + KeyEvent.setInt(0, 0); + } + } + + function isKeyPress(KeyValue, VarKey) { + local obj = sq_getMyCharacter(); + obj = sq_GetCNRDObjectToActiveObject(obj); + if (KeyPressNB.KeyDown(obj, KeyValue, VarKey)) { + return true; + } + KeyPressNB.KeyUp(obj, KeyValue, VarKey); + } +} +//基础工具类 +class Rindro_BaseToolClass { + + function SendPack(T) { + local str = Json.Encode(T); + L_sq_SendPackType(130); + L_sq_SendPackWChar(str); + L_sq_SendPack(); + } + + function SendPackEx(T) { + local str = L_sq_EncondeJson(T); + L_sq_SendPackType(130); + L_sq_SendPackWChar(str); + L_sq_SendPack(); + } + + //绘制简易静态Ani // obj -- ani路径 -- X -- Y -- 第几帧 -- ani名字 + function T_DrawStayAni(obj, aniFileName, x, y, index, aniname) { + local SelectAni = obj.getVar().GetAnimationMap(aniname, aniFileName); + //sq_AnimationProc(SelectAni); + sq_DrawSpecificFrame(SelectAni, x, y, false, index, false, 1.0); + return SelectAni; + } + + //绘制简易静态Ani // obj -- ani路径 -- X -- Y -- 第几帧 -- ani名字 + function T_DrawStayAniRate(obj, aniFileName, x, y, index, aniname, rate) { + local SelectAni = obj.getVar().GetAnimationMap(aniname, aniFileName); + SelectAni.setImageRateFromOriginal(rate, rate); + //sq_AnimationProc(SelectAni); + sq_DrawSpecificFrame(SelectAni, x, y, false, index, false, 1.0); + return SelectAni; + } + + //绘制简易动态Ani // obj -- ani路径 -- X -- Y -- ani名字 + function T_DrawDynamicAni(obj, aniFileName, x, y, aniname) { + local ani = obj.getVar().GetAnimationMap(aniname, aniFileName); + sq_AnimationProc(ani); + sq_drawCurrentFrame(ani, x, y, true); + return ani; + } + + + //初始化根表成员 + function InitClass(Name) { + local RootTab = getroottable(); + if (RootTab.rawin(Name) == true) { + RootTab.rawdelete(Name); + } + } + + //获取交互Npc名称 + function GetEachNpcId() { + local OneAddress = L_sq_RA(0x1ADE0E0); + if (OneAddress) { + local TowAddress = L_sq_RA(OneAddress + 8); + if (TowAddress) { + local Id = L_sq_RA(TowAddress + 0x210); + return Id; + } + } + return null; + } + +} +//获取文字绘制长度 +class LenheartTextClass { + + function GetStringLength(str) { + return L_sq_GetStringDrawLength(str); + } + +} +class MemoryTool { + //给指定地址写入字节数组 + function WirteByteArr(Address, ByteArr) { + for (local i = 0; i< ByteArr.len(); i++) { + L_sq_WAB(Address + i, ByteArr[i]); + } + } + + //解密读取内存地址的数据 + function DecodeMemoryData(Address) { + local nEax, nEcx8, nEsi, nEdx, nTmp; + nEax = L_sq_RA(Address); + if (nEax == -1) return nEax; + nEcx8 = L_sq_RA(Address + 8); + if (nEcx8 == -1) return nEcx8; + nEsi = L_sq_RA(0x1AF8D78); + nEdx = nEax >> 16; + nTmp = (nEdx << 2) + nEsi + 36; + nEdx = L_sq_RA(nTmp); + if (nEdx == -1) return nEdx; + nEax = nEax & 65535; + nTmp = (nEax << 2) + nEdx + 8468; + nEax = L_sq_RA(nTmp); + if (nEax == -1) return nEax; + nEdx = nEax & 0xFFFF; + nEsi = nEdx << 16; + nEsi = nEsi | nEdx; + nEax = nEsi ^ nEcx8; + return nEax; + } + + //加密写入内存地址数据 + function EncodeMemoryData() { + local JEdi, JEcx, JEax, JEsi, JEdx, JSs; + JEcx = AddreSs; + JEax = L_sq_RA(0x1AF8DB8); + JEax = JEax + 1; + L_sq_WA(0x1AF8DB8, JEax); + JEdx = JEax; + JEdx = JEdx >> 8; + JEdx = JEdx << 24; + JEdx = JEdx >> 24; + JEdx = L_sq_RA(JEdx * 2 + 0x1843F58); + JEdx = JEdx & 0xFFFF; + JEax = JEax << 24; + JEax = JEax >> 24; + JSs = L_sq_RA(JEax * 2 + 0x1844158); + JSs = JSs & 0xFFFF; + JEdx = JEdx ^ JSs; + JEax = JEdx; + JEax = JEax & 0xFFFF; + JEsi = Data; + JEdx = JEsi >> 16; + + JSs = JEsi & 0xFFFF; + JEdx = JEdx + JSs; + JEdx = JEdx ^ JEax; + JEdi = JEdx; + JEdx = JEax; + JEax = JEax << 16; + JEax = JEax + JEdx; + JEsi = Data; + JEax = JEax ^ JEsi; + JEsi = AddreSs + 8; + L_sq_WA(JEsi, JEax); + JEax = L_sq_RA(AddreSs); + JEsi = L_sq_RA(0x1AF8D78); + + JEcx = JEdi; + JEcx = JEcx << 16; + JEcx = JEcx + JEdx; + JEdx = JEax; + JEdx = JEdx >> 16; + JEdx = L_sq_RA(JEsi + JEdx * 4 + 36); + JEax = JEax & 0xFFFF; + L_sq_WA(JEdx + JEax * 4 + 8468, JEcx); + } + + function DecodeMemoryDataF(Address) { + local Value = MemoryTool.DecodeMemoryData(Address); + local Bl = blob(); + Bl.writen(Value, 'i'); + Bl.seek(0); + return Bl.readn('f'); + } + + function ReadFloat(Address) { + local Arr = []; + for (local i = 0; i< 4; i++) { + Arr.append(L_sq_RAB(Address + i)); + } + // local Value = L_sq_RAB(Address); + // print(Value); + local Bl = blob(); + foreach(intvalue in Arr) { + Bl.writen(intvalue, 'c'); + } + // Bl.writen(Value, 'i'); + Bl.seek(0); + return Bl.readn('f'); + } +} \ No newline at end of file diff --git a/Base/_Z_Data/CharacterInfoData.nut b/Base/_Z_Data/CharacterInfoData.nut new file mode 100644 index 0000000..e497694 --- /dev/null +++ b/Base/_Z_Data/CharacterInfoData.nut @@ -0,0 +1,113 @@ +/* +文件名:CharacterInfoData.nut +路径:Base/_Z_Data/CharacterInfoData.nut +创建日期:2024-09-03 11:34 +文件用途:角色信息数据 +*/ + +//读取属性数据 +function Lenheart_Character_GetAttribute(Address) { + //传入读传入不传读自己 + local ObjectAddress = Address; + if (ObjectAddress == null) + ObjectAddress = L_sq_RA(0x1AB7CDC); + if (!ObjectAddress) return; + + local Info = {}; + //当前HP + Info.CurHp <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x2BEC); + //总HP + Info.MaxHp <- L_sq_RA(ObjectAddress + 0x36A0); + //当前MP + Info.CurMp <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x2BF8); + //总MP + Info.MaxMp <- L_sq_RA(ObjectAddress + 0x36A4); + + //力量 + Info.Strength <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x2364); + //智力 + Info.Intellect <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x2394); + //体力 + Info.Vitality <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x237C); + //精神 + Info.Spirit <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x23AC); + //物理攻击 (没读武器精通) + Info.PhysicalAttack <- (MemoryTool.DecodeMemoryData(ObjectAddress + 0x1E54) * (Info.Strength.tofloat() * 0.004 + 1)).tointeger() + MemoryTool.DecodeMemoryData(ObjectAddress + 0x1EB4); + //魔法攻击 + Info.MagicalAttack <- (MemoryTool.DecodeMemoryData(ObjectAddress + 0x1E84) * (Info.Intellect.tofloat() * 0.004 + 1)).tointeger() + MemoryTool.DecodeMemoryData(ObjectAddress + 0x1ED8); + //独立攻击力 //TODO 需要加上成长独立攻击力 需要服务端发送给我 + Info.IndependentAttack <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x22C8) + MemoryTool.DecodeMemoryData(ObjectAddress + 0x22F8); + + //物理防御 + Info.PhysicalDefend <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x273C); + //魔法防御 + Info.MagicalDefend <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x276C); + //物理暴击 + Info.PhysicalCrit <- MemoryTool.DecodeMemoryDataF(ObjectAddress + 0x1F14); + //魔法暴击 + Info.MagicalCrit <- MemoryTool.DecodeMemoryDataF(ObjectAddress + 0x1F20); + + //攻击速度 + Info.AttackSpeed <- (MemoryTool.DecodeMemoryDataF(ObjectAddress + 0x2688) - 1.0) * 100.0; + //释放速度 + Info.ReleaseSpeed <- (MemoryTool.DecodeMemoryDataF(ObjectAddress + 0x26A0) - 1.0) * 100.0; + //移动速度 + Info.MoveSpeed <- (MemoryTool.DecodeMemoryDataF(ObjectAddress + 0x2670) - 1.0) * 100.0; + + //抗魔值 + local Kbuf = 0; + for (local i = 1; i< 13; ++i) { + local EquOffset = Rindro_GetEquAddr(i); + local AbAddress = L_sq_RA(ObjectAddress + EquOffset); + if (AbAddress) { + Kbuf += MemoryTool.DecodeMemoryData(AbAddress + 0xAD4); + } + } + Info.AntiMagic <- Kbuf; + + + //命中率 + Info.HitRate <- MemoryTool.DecodeMemoryDataF(ObjectAddress + 0x1F50); + //闪避率 + Info.DodgeRate <- MemoryTool.DecodeMemoryDataF(ObjectAddress + 0x1C50); + //HP回复量 + Info.HPRecovery <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1D64) * 1.6; + //MP回复量 + Info.MPRecovery <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1D7C) * 7.2; + //僵直度 + Info.StunRate <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1DF4); + //硬直 + Info.StunResist <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1DDC); + + //火属性强化 + Info.FireStrength <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1B54); + //冰属性强化 + Info.IceStrength <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1B60); + //光属性强化 + Info.LightStrength <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1B78); + //暗属性强化 + Info.DarkStrength <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1B6C); + //火属性抗性 + Info.FireResist <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1AF4); + //冰属性抗性 + Info.IceResist <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1B00); + //光属性抗性 + Info.LightResist <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1B18); + //暗属性抗性 + Info.DarkResist <- MemoryTool.DecodeMemoryData(ObjectAddress + 0x1B0C); + + //名望值 + Info.Fame <- 0; + //最终伤害 + Info.FinalDamage <- 0; + + return Info; +} + +function Rindro_GetCharacterInfoCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + Jso.op <- 20069011; + Jso.Info <- Lenheart_Character_GetAttribute(null); + Rindro_BaseToolClass.SendPackEx(Jso); +} +Pack_Control.rawset(20069010, Rindro_GetCharacterInfoCallBack); \ No newline at end of file diff --git a/Base/_Z_Data/ItemData.nut b/Base/_Z_Data/ItemData.nut new file mode 100644 index 0000000..76aa720 --- /dev/null +++ b/Base/_Z_Data/ItemData.nut @@ -0,0 +1,302 @@ +/* +文件名:ItemData.nut +路径:Base/_Z_Data/ItemData.nut +创建日期:2024-08-06 23:58 +文件用途:用于存放Item数据 +*/ +if (!getroottable().rawin("Rindro_ItemInfoObject")) Rindro_ItemInfoObject <- {}; +if (!getroottable().rawin("Rindro_ItemInfoBuf")) Rindro_ItemInfoBuf <- ""; +if (!getroottable().rawin("RINDRO_INIT_FLAG")) RINDRO_INIT_FLAG <- false; + +//获取本地配置 +function Rindro_GetLocalConfig() { + local Buf = L_sq_GetLocalConfig(); + if (!Buf) { + return { + md5 = -1 + }; + } else return Json.Decode(Buf); +} +// if (!getroottable().rawin("RINDRO_CONFIG")) +RINDRO_CONFIG <- Rindro_GetLocalConfig(); + +//获取本地信息版本 +function Rindro_GetMd5() { + return RINDRO_CONFIG.md5; +} + +//初始化各种信息 +function Rindro_Init() { + //道具信息 + local ItemArray = getroottable().RINDRO_CONFIG.itemInfo; + Rindro_ItemInfoBuf = ""; + foreach(Value in ItemArray) { + if (Value.Name2.len() == 0) + Value.Name2 = "Rindro-Team"; + getroottable().Rindro_ItemInfoObject[Value.Id] <- Value; + } + RINDRO_INIT_FLAG = true; +} +//更新本地配置 +function Rindro_ItemInfoCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + if ("ZipSEnd" in Jso) { + getroottable().Rindro_ItemInfoObject <- {}; + Rindro_ItemInfoBuf += Jso.ZipS; + local ZlibStrBuf = L_sq_Dezlib(Rindro_ItemInfoBuf); + if (ZlibStrBuf == "null") { + Rindro_ItemInfoBuf = ""; + return; + } + L_sq_SetLocalConfig(ZlibStrBuf); + + getroottable().RINDRO_CONFIG <- Json.Decode(ZlibStrBuf); + + Rindro_Init(); + } else { + Rindro_ItemInfoBuf += Jso.ZipS; + } +} +Pack_Control.rawset(20240422, Rindro_ItemInfoCallBack); +//无需更新本地配置 +Pack_Control.rawset(20240424, function(Chunk) { + Rindro_Init(); +}); + + +//道具绘制类 +class ItemInfoClass { + + //Gm模式 + GmModel = true; + + Info = null; + PageLength = 0; + + //静态品级颜色 + static RarityColor = [ + 0xFFFFFFFF, //白 + 0xFFEDD568, //蓝 + 0xFFFF6BB3, //紫 + 0xFFF000FF, //粉 + 0xFF00B1FF, //黄 + 0xFF6666FF, //红 + 0xFF0055FF, //橙 + ]; + + //我的品级颜色 + MyRarityColor = null; + //我的售价长度 + MyPriceLength = null; + //我的冷却时间长度 + MyCoolTimeLength = null; + + //获取真实类型 + function GetRealType(Type) { + switch (Type) { + case "[material]": + return "材料"; + case "[recipe]": + return "设计图"; + case "[upgradable legacy]": + return "袖珍罐"; + case "[quest]": + return "任务"; + case "[booster random]": + case "[multi upgradable legacy]": + case "[booster selection]": + case "[cera booster]": + case "[unlimited waste]": + case "[usable cera package]": + case "[only effect]": + return "消耗品"; + case "[weapon]": + return "武器"; + case "[title name]": + return "称号"; + case "[coat]": + return "上衣"; + case "[pants]": + return "下衣"; + case "[hat]": + return "帽子"; + case "[shoulder]": + return "护肩"; + case "[waist]": + return "腰带"; + case "[shoes]": + return "鞋子"; + case "[amulet]": + return "项链"; + case "[wrist]": + return "手镯"; + case "[ring]": + return "戒指"; + case "[support]": + return "辅助装备"; + case "[aurora avatar]": + return "光环"; + case "[magic stone]": + return "魔法石"; + case "[creature]": + return "寵物"; + case "[artifact red]": + return "宠物装备 红"; + case "[artifact blue]": + return "宠物装备 蓝"; + case "[artifact green]": + return "宠物装备 绿"; + case "[skin avatar]": + return "皮肤"; + case "[hair avatar]": + return "头部装扮"; + case "[waist avatar]": + return "腰部装扮"; + case "[hat avatar]": + return "帽子装扮"; + case "[coat avatar]": + return "上衣装扮"; + case "[face avatar]": + return "脸部装扮"; + case "[breast avatar]": + return "胸部装扮"; + case "[pants avatar]": + return "下装装扮"; + case "[shoes avatar]": + return "鞋装扮"; + default: + return "道具"; + } + } + + constructor(gInfo) { + Info = clone(gInfo); + + //Gm模式显示编号 + if (GmModel) Info.Name += "[" + Info.Id + "]"; + + //配置品级颜色 + if (Info.Rarity< 0 || Info.Rarity > 6) { + MyRarityColor = Info.Rarity; + } else { + MyRarityColor = RarityColor[Info.Rarity]; + } + + //配置售价长度 + if ("Price" in Info) { + MyPriceLength = LenheartTextClass.GetStringLength(Info.Price.tostring()); + } + + //配置冷却时间长度 + if ("CoolTime" in Info) { + MyCoolTimeLength = LenheartTextClass.GetStringLength((Info.CoolTime / 1000.0).tostring()); + } + + //配置类型 + if ("Type" in Info) { + Info.Type = GetRealType(Info.Type); + } + //配置装备类型 + else if ("EquipmentType" in Info) { + Info.Type <- GetRealType(Info.EquipmentType); + } + + PageLength += 72; + CheckStrLength(); + } + + function CheckInfoLength(TableKey, AddLength) { + if (TableKey in Info) { + PageLength += AddLength; + } + } + + function CheckStrLength() { + if ("Explain" in Info) { + // local Buf = LenheartTextClass.GetStringLength(Info.Explain.tostring()); + // local Pn = (Buf / 211.0); + // if (Pn< 1) PageLength += 12; + // if (Pn > 1) Pn = Pn.tointeger() + 1; + // PageLength += (16 * Pn); + + local Buf = L_sq_GetStringDrawArray(Info.Explain, 220); + PageLength += (Buf.len() * 16); + // PageLength += 12; + } + } + + //高级绘制文字(带换行) + function L_sq_DrawCode_Ex(str, x, y, rgba, mb, jc, hl) { + local strarr = []; + if (str.find("\n") == null) L_sq_DrawCode(str, x, y, rgba, mb, jc); + else { + local Bpos = 0; + while (true) { + local Npos = str.find("\n", Bpos); + if (!Npos) { + local strbuff = str.slice(Bpos, str.len()); + strarr.append(strbuff); + break; + } + local strbuff = str.slice(Bpos, Npos); + strarr.append(strbuff); + Bpos = Npos + 1; + } + for (local z = 0; z< strarr.len(); z++) { + L_sq_DrawCode(strarr[z], x, y + (z * 14), rgba, mb, jc); + } + } + } + + function Show(X, Y) { + if (X< 0) X = 0; + if ((X + 211) > 800) X = (800 - 211); + if (Y< 0) Y = 0; + if (Y + PageLength > 600) Y = 600 - PageLength; + + //Item信息框一般为211的宽度 + L_sq_DrawWindow(X, Y, 211, PageLength, "interface2/popup/popup.img", 134, 6, 12, 6, 13); + + //绘制名字 和 图标 + if ("Id" in Info) L_Sq_DrawItem(X + 8 + 174, Y + 8, Info.Id, 1, 0, 0, 0); + if ("Name2" in Info) L_sq_DrawCode(Info.Name2, X + 8, Y + 9, MyRarityColor, 1, 1); + if ("Name" in Info) L_sq_DrawCode(Info.Name, X + 8, Y + 23, MyRarityColor, 1, 1); + + + //绘制线 + L_sq_DrawImg("interface2/popup/popup.img", 270, X + 7, Y + 26 + 16); + + //绘制重量 + if ("Weight" in Info) { + L_sq_DrawCode((Info.Weight.tofloat() / 1000.0).tostring() + "kg", X + 7, Y + 24 + 24, 0xFFFFFFFF, 1, 1); + } + + //绘制售价 + if ("Price" in Info) { + L_sq_DrawCode("金币", X + 186, Y + 24 + 24, 0xFFFFFFFF, 1, 1); + L_sq_DrawCode(Info.Price.tostring(), X - MyPriceLength + 186, Y + 24 + 24, 0xFFFFFFFF, 1, 1); + } + + + //绘制类型 + if ("Type" in Info) { + L_sq_DrawCode(Info.Type.tostring(), X + 7, Y + 48 + 16, 0xFFFFFFFF, 1, 1); + } + + + + //绘制冷却时间 + if ("CoolTime" in Info) { + L_sq_DrawCode("秒", X + 186 + 12, Y + 48 + 16, 0xFFFFFFFF, 1, 1); + L_sq_DrawCode((Info.CoolTime / 1000.0).tostring(), X - MyCoolTimeLength + 214 - 18, Y + 48 + 16, 0xFFFFFFFF, 1, 1); + } + + //绘制普通描述 + if ("Explain" in Info) { + local a = L_sq_GetStringDrawArray(Info.Explain, 220); + foreach(Pos, va in a) { + L_sq_DrawCode(va, X + 7, Y + 48 + 12 + 24 + (Pos * 16), 0xFFEDD568, 1, 1); + } + } + } +} \ No newline at end of file diff --git a/DofileList.nut b/DofileList.nut new file mode 100644 index 0000000..5cf172e --- /dev/null +++ b/DofileList.nut @@ -0,0 +1,49 @@ +//枚举类 +dofile("sqr/Base/_ENUM/_ENUM_KEY.nut"); //按键枚举类 +//枚举类 + +//基础工具类 +dofile("sqr/Base/_Tool/BaseTool_Class.nut"); //基础工具类 +//基础工具类 + +//回调注册类 +dofile("sqr/Base/PackControl/PackControl.nut"); //收包类 +dofile("sqr/Base/CallBack/DrawMain.nut"); //绘制入口 +dofile("sqr/Base/CallBack/DrawHudMain.nut"); //hud绘制入口 +dofile("sqr/Base/CallBack/Window_Get.nut"); //原始窗口HOOK +dofile("sqr/Base/CallBack/PushDamage.nut"); //Push伤害 +// dofile("sqr/Base/CallBack/Window_Get.nut"); //原始窗口HOOK + +//数据类 +dofile("sqr/Base/_Z_Data/ItemData.nut"); //Item数据 +dofile("sqr/Base/_Z_Data/CharacterInfoData.nut"); //角色信息数据 +//数据类 + +//UI框架类 +dofile("sqr/Base/UI/OldWindowsMap.nut"); //窗口Map +dofile("sqr/Base/UI/Lenheart_UI_Class.nut"); //UI +dofile("sqr/Base/UI/Lenheart_Ani_Class.nut"); //Ani +dofile("sqr/Base/UI/Lenheart_Event_Class.nut"); //活动图标 +dofile("sqr/Base/UI/Lenheart_Character_Info_Class.nut"); //个人信息属性面板 +//----------------------------------------------------------------------------------------------------- + + + + + +dofile("sqr/Project/Tuguan/Tuguan.nut"); //土罐 +dofile("sqr/Project/HellExLogic/HellExLogic.nut"); //深渊派对特殊逻辑 +dofile("sqr/Project/RepairWorldMap/RepairWorldMap.nut"); //修补世界地图 + +dofile("sqr/Project/OnilneSign/OnilneSign.nut"); //在线签到 +dofile("sqr/Project/FightSign/FightSign.nut"); //每日签到 +dofile("sqr/Project/CombatRank/CombatRank.nut"); //战斗力系统 +dofile("sqr/Project/Anton/Rindro_Anton.nut"); //安图恩 +dofile("sqr/Project/AradPass/AradPass.nut"); //战令 +dofile("sqr/Project/MidsummerParty/MidsummerParty.nut"); //希曼音乐会 +dofile("sqr/Project/ServerAuction/ServerAuction.nut"); //全服竞拍 +dofile("sqr/Project/OnlineAnnouncement/OnlineAnnouncement.nut"); //上线公告 +dofile("sqr/Project/Shapeshifting/Shapeshifting.nut"); //时装变身 +dofile("sqr/Project/HudUi/HudUi.nut"); //百级UI +dofile("sqr/Project/DamagePerSecond/DamagePerSecond.nut"); //秒伤统计 +dofile("sqr/Project/CollectionBox/CollectionBox.nut"); //收集箱 diff --git a/Project/Anton/Rindro_Anton.nut b/Project/Anton/Rindro_Anton.nut new file mode 100644 index 0000000..45b4260 --- /dev/null +++ b/Project/Anton/Rindro_Anton.nut @@ -0,0 +1,424 @@ +/* +文件名:Rindro_Anton.nut +路径:Project/Anton/Rindro_Anton.nut +创建日期:2024-08-13 09:30 +文件用途:安图恩 +*/ + + +dofile("sqr/Project/Anton/Rindro_Anton_CreateParty.nut"); +dofile("sqr/Project/Anton/Rindro_Anton_FightSituation.nut"); +dofile("sqr/Project/Anton/Rindro_Anton_Noti.nut"); +dofile("sqr/Project/Anton/Rindro_Anton_Party.nut"); +dofile("sqr/Project/Anton/Rindro_Anton_PartyApplyJoin.nut"); +dofile("sqr/Project/Anton/Rindro_Anton_PartyFormation.nut"); +dofile("sqr/Project/Anton/Rindro_Anton_PartyHall.nut"); +dofile("sqr/Project/Anton/Rindro_Anton_PartyInfo.nut"); +dofile("sqr/Project/Anton/Rindro_Anton_PartyMemberInfo.nut"); +dofile("sqr/Project/Anton/Rindro_Anton_PlayerInteractive.nut"); +dofile("sqr/Project/Anton/Rindro_Anton_Reward.nut"); + + +//安图恩核心数据类 +class RinDro_Anton extends Rindro_BaseToolClass { + //基础配置 + BaseConfig = null; + //攻坚配置 + FightConfig = null; + + //我的攻坚队状态 + MyRaidState = null; + //我的攻坚队伍 + MyRaidTeam = null; + //我的攻坚队伍ID + MyRaidTeamId = null; + //我的Cid + MyCid = null; + //我是否是攻坚队队长 + IsCaptain = null; + //结束时间 + EndTime = null; + //我的攻坚队攻坚阶段 + RaidStage = 0; + //我的攻坚队伍头像存储 + Portrait = null; + + + //安图恩我的队伍窗口 + PartyWindow_Object = null; + //攻坚战况表窗口 + FightSituationWindow_Object = null; + //攻坚大厅窗口 + PartyHallWindow_Object = null; + //翻牌奖励窗口 + RewardWindow_Object = null; + //编队窗口 + PartyFormationWindow_Object = null; + + + + + + //攻坚开始动画的Flag + DrawStartAniMark = false; + + + //请求基础信息配置 + function GetFiendwarBase() { + local T = { + op = 20064501, + } + SendPackEx(T); + } + //请求掉线配置信息 + function GetFiendwarDown() { + local T = { + op = 20064063, + } + SendPackEx(T); + } + + //基础信息配置 + function FiendwarBase(Chunk) { + BaseConfig = Json.Decode(Chunk); + FiendwarChannelTownLogicCallBack(); + } + + //基础攻坚信息配置 + function AntonFightBase(Chunk) { + FightConfig = Json.Decode(Chunk); + } + + //团本专属频道上线城镇移动包 + function FiendwarChannelTownLogicCallBack() { + if (BaseConfig.channel_index.find("18")) { + if (L_sq_GetTownIndex() != BaseConfig.town_index) { + L_sq_MoveTown(BaseConfig.town_index, 0, 474, 249); + } + } else { + //在安图恩区域的 要转移回普通城镇 + if (L_sq_GetTownIndex() == BaseConfig.town_index) { + L_sq_MoveTown(1, 1, 474, 249); + } + } + } + + + //获取攻坚队信息回调 + function GetTeamInfoCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + local ZlibStr = Jso.ZipS; + Jso.ZipS = Json.Decode(L_sq_Dezlib(Jso.ZipS)); + Jso.team <- Jso.ZipS.team; + + //取的窗口对象 + local Win = PartyWindow_Object; + Win.InfoFlag = true; + + //如果攻坚队伍信息中已经有了角色成员 清空成员对象集合 + for (local i = 0; i< Win.Childrens.len(); i++) { + local Cobj = Win.Childrens[i]; + if (Cobj instanceof Rindro_AntonPartyInfoMemberC) { + Win.Childrens.remove(i); + i--; + } + } + //重置成员数组 + Win.MembersList = []; + + //清空是否为我的队伍状态 + Win.IsMyTeam = false; + //清空是否为队长状态 + Win.IsCaptain = false; + //赋值队伍名称 + Win.TeamName = Jso.team.TeamName; + //赋值队伍ID + Win.TeamID = Jso.team.TeamId; + + //还原头像 + Portrait = {}; + //遍历Team包 用于构造队伍窗口中的每一位成员 + foreach(_index, MemberObj in Jso.team.characNum) { + // local MemberObj = Jso.team.characNum[0]; + //说明我在这个攻坚队里 + if (Jso.cid == MemberObj.CID) { + Win.IsMyTeam = true; + MyRaidState = Jso.team.State; + MyRaidTeam = PartyWindow_Object; + //向全局类存入我的攻坚队伍ID + MyRaidTeamId = Jso.team.TeamId; + //存入我的CID + MyCid = Jso.cid; + //说明是队长 + if (Jso.cid == Jso.team.captainCid) { + Win.IsCaptain = true; + //存入我是攻坚队队长 + IsCaptain = true; + } + } + //构造CID对应的装备数组方便绘制 + Portrait.rawset(MemberObj.CID, { + EquVos = clone(MemberObj.equVos), + Job = MemberObj.PlayerJob, + TeamId = MemberObj.characNum, + Name = MemberObj.PlayerName, + }); + + local T = { + PartyId = Jso.team.TeamId, //攻坚队ID + TeamId = MemberObj.characNum, //小队编号 + Level = MemberObj.PlayerLevel.tostring(), //等级 + Name = MemberObj.PlayerName, //名字 + JobName = MemberObj.PlayerGrowTypeJob, //职业名 + Job = MemberObj.PlayerJob, //职业编号 + StkHasFlag = MemberObj.isPrepare, //是否拥有攻坚材料 + EquVos = MemberObj.equVos, //装备List 用于显示头像 + Captain = MemberObj.CaptainBool, //是否为攻坚队队长 + Cid = MemberObj.CID, //Cid + OnlineState = MemberObj.onLineStart, //在线状态 + ExitTime = MemberObj.exitTime, //离队时间 + PlayerSession = MemberObj.PlayerSession, //玩家在世界中的Session 用于进行原生用户操作 + ClearanceCount = MemberObj.ClearanceCount, //通关次数 + ClearanceCountMax = FightConfig.rewardCondition, //总通关次数 + } + //通过类构造并添加队伍成员UI对象 + local TeamBuf = Rindro_AntonPartyInfoMemberC(T); + Win.AddChild(TeamBuf); + Win.MembersList.append(TeamBuf); + } + + if (("OpenWin" in Jso)) { + //开启队伍窗口显示 + Win.Visible = true; + //设置置顶 + Win.ResetFocus(); + } + } + + //攻坚队攻坚开始回调 + function RaidStartFightCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + RaidStage = Jso.state; + MyRaidState = Jso.state; + + //在获取一下攻坚队信息 + local Jso = { + op = 20064011 + } + SendPackEx(Jso); + } + + + + //结束时间 + EndTime = null; + //上次刷新信息包的时间 + PackCurT = null; + + //攻坚队信息包 + function RaidFightInfoCallBack(Chunk) { + PackCurT = Clock(); + local Info = Json.Decode(Chunk).fightInfo; + EndTime = Info.endTime; + + if (FightSituationWindow_Object) FightSituationWindow_Object.InitInfo(Info); + + //如果存在 + if (MyRaidTeam && MyRaidTeam.InfoFlag) { + for (local i = 0; i< MyRaidTeam.MembersList.len(); i++) { + local PInfo = MyRaidTeam.MembersList[i].InfoObj; + local CID = PInfo.Cid; + + local Flag = false; + foreach(scid in Info.Standby) { + if (scid == CID) Flag = true; + } + if (Flag) { + MyRaidTeam.MembersList[i].InfoObj.Standby <- true; + } else { + MyRaidTeam.MembersList[i].InfoObj.Standby <- false; + } + } + + } + } + + //收到奖励包 + function RaidRewardInfoCallBack(Chunk) { + local Info = Json.Decode(Chunk); + RewardWindow_Object.Init(Info); + } + + //收到初始化包 + function RaidInitCallBack(Chunk) { + //我的攻坚队状态 + MyRaidState = null; + //我的攻坚队伍 + MyRaidTeam = null; + //我的攻坚队伍ID + MyRaidTeamId = null; + //我的Cid + MyCid = null; + //我是否是攻坚队队长 + IsCaptain = null; + //结束时间 + EndTime = null; + //我的攻坚队攻坚阶段 + RaidStage = 0; + //我的攻坚队伍头像存储 + Portrait = null; + + //安图恩我的队伍窗口 + PartyWindow_Object.DestroyWindow(); + //攻坚战况表窗口 + FightSituationWindow_Object.DestroyWindow(); + //攻坚大厅窗口 + PartyHallWindow_Object.DestroyWindow(); + //翻牌奖励窗口 + RewardWindow_Object.DestroyWindow(); + //编队窗口 + PartyFormationWindow_Object.DestroyWindow(); + + //安图恩我的队伍窗口 + PartyWindow_Object = null; + //攻坚战况表窗口 + FightSituationWindow_Object = null; + //攻坚大厅窗口 + PartyHallWindow_Object = null; + //翻牌奖励窗口 + RewardWindow_Object = null; + //编队窗口 + PartyFormationWindow_Object = null; + + } + + MonsterFMap = [202210052, 202210053, 202210054, 202210055]; + //火山怪物投放包 + function MonsterSendCallBack(Chunk) { + local Info = Json.Decode(Chunk); + if (sq_GetCurrentModuleType() == 3) { + local obj = sq_GetMyMasterCharacter(); + obj = sq_ObjectToSQRCharacter(obj); + obj.sq_SendCreatePassiveObjectPacket(MonsterFMap[Info.id], 0, 120, 1, 0); + } + } + + constructor() { + // DrawStartAniMark = true; + // DrawStartAniT = Clock(); + + Pack_Control.rawset(20064028, RaidStartFightCallBack.bindenv(this)); + Pack_Control.rawset(20064016, RaidFightInfoCallBack.bindenv(this)); + Pack_Control.rawset(20064004, GetTeamInfoCallBack.bindenv(this)); + Pack_Control.rawset(20064036, AntonFightBase.bindenv(this)); + //攻坚奖励包 + Pack_Control.rawset(20064026, RaidRewardInfoCallBack.bindenv(this)); + //初始化包 退出队伍 或者 被 请出队伍 + Pack_Control.rawset(20064008, RaidInitCallBack.bindenv(this)); + //火山怪物投放 + Pack_Control.rawset(20064050, MonsterSendCallBack.bindenv(this)); + //绘制动画包 + Pack_Control.rawset(20064038, RaidPlayAniCallBack.bindenv(this)); + + + //获取基础配置回调包 + Pack_Control.rawset(20064502, FiendwarBase.bindenv(this)); + //第一次上线要重新请求一下位置信息 + GetFiendwarBase(); + //看看是否有断线重连 + GetFiendwarDown(); + } + + + function Proc(obj) { + PartyHallWindow_Object = LenheartNewUI_CreateWindow(Rindro_Anton_PartyHallC, "新安图恩攻坚大厅窗口", ((getroottable().Rindro_Scr_Width - 478)).tointeger(), 40, 478, 434, 18); + PartyFormationWindow_Object = LenheartNewUI_CreateWindow(Rindro_AntonPartyFormation, "安图恩我的队伍编队窗口", 375, 190, 294, 192, 18); + FightSituationWindow_Object = LenheartNewUI_CreateWindow(Rindro_AntonFightSituationC, "安图恩攻坚战况表", ((getroottable().Rindro_Scr_Width - 800) / 2).tointeger(), 8, 800, 600, 0); + PartyWindow_Object = LenheartNewUI_CreateWindow(Rindro_AntonPartyInfoC, "安图恩我的队伍窗口", 6, 15, 354, 566, 18); + RewardWindow_Object = LenheartNewUI_CreateWindow(Rindro_Anton_RewardC, "安图恩翻牌奖励窗口", 0, 0, 0, 0, 0); + LenheartNewUI_CreateWindow(Rindro_Anton_NotiC, "安图恩攻坚队伍消息分发", 0, 0, 0, 0, 0); + + if (FightSituationWindow_Object) FightSituationWindow_Object.TopDraw(obj); + + //绘制动画 + DrawPlayAni(obj); + } + + + DrawPlayAniMark = null; + DrawPlayAniT = null; + + function RaidPlayAniCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + DrawPlayAniMark = Jso.type; + DrawPlayAniT = Clock(); + } + + //绘制通关副本动画 + function DrawPlayAni(obj) { + if (!DrawPlayAniMark || !DrawPlayAniT) return; + local Ct = Clock() - DrawPlayAniT; + switch (DrawPlayAniMark) { + case 1: //通关擎天A + case 2: //通关擎天B + case 13: //通关擎天B + local Ani = T_DrawDynamicAni(obj, "common/anton/title/04_clear_back.ani", 0, 180, "安图恩通关擎天A" + DrawPlayAniT); + local str = "擎天之柱A"; + if (DrawPlayAniMark == 2) str = "擎天之柱B" + if (DrawPlayAniMark == 13) str = "黑色火山" + if (Ct >= 350 && Ct <= 1400) L_sq_DrawCode(str, 236 + 158 - LenheartTextClass.GetStringLength(str) / 2, 244, sq_RGBA(255, 146, 0, 250), 0, 1); + break; + case 5: + T_DrawDynamicAni(obj, "common/anton/title/00_start_back.ani", 430, 210 + 26, "安图恩阻截开始" + DrawPlayAniT); + break; + case 6: + T_DrawDynamicAni(obj, "common/anton/title/02_success_back.ani", 430, 210 + 26, "安图恩阻截成功" + DrawPlayAniT); + break; + case 7: + T_DrawDynamicAni(obj, "common/anton/title/01_fail_back.ani", 430, 210 + 26, "安图恩阻截失败" + DrawPlayAniT); + break; + case 8: + T_DrawDynamicAni(obj, "common/anton/title/00_start_back_1.ani", 430, 210 + 26, "安图恩灭杀开始" + DrawPlayAniT); + break; + case 9: + T_DrawDynamicAni(obj, "common/anton/title/02_success_back_1.ani", 430, 210 + 26, "安图恩灭杀成功" + DrawPlayAniT); + break; + case 10: + T_DrawDynamicAni(obj, "common/anton/title/01_fail_back_1.ani", 430, 210 + 26, "安图恩灭杀失败" + DrawPlayAniT); + break; + case 11: + case 12: + T_DrawDynamicAni(obj, "common/anton/title/03_warning_back.ani", 0, 210 + 26, "安图恩火山警告" + DrawPlayAniT); + local str = "火山能量即将过载,请立即前往压制!!!"; + if (DrawPlayAniMark == 12) str = "震颤的大地已经复活,请立即前往压制!!!" + if (Ct >= 350 && Ct <= 1600) L_sq_DrawCode(str, 236 + 158 - LenheartTextClass.GetStringLength(str) / 2, 320, sq_RGBA(255, 50, 50, 250), 0, 1); + break; + default: + break; + } + + if (Ct >= 3000) { + DrawPlayAniMark = null; + DrawPlayAniT = null; + } + } +} + +getroottable().rawdelete("RinDro_Anton_Obj"); + +function Lenheart_Rindro_Anton_New(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("RinDro_Anton_Obj")) { + RootTab.rawset("RinDro_Anton_Obj", RinDro_Anton()); + } else { + RootTab["RinDro_Anton_Obj"].Proc(obj); + } +} + +if (getroottable().rawin("LenheartTopFuncTab")) { + getroottable()["LenheartTopFuncTab"].rawset("Lenheart_Rindro_Anton_NewFunc", Lenheart_Rindro_Anton_New); +} else { + local T = {}; + T.rawset("Lenheart_Rindro_Anton_NewFunc", Lenheart_Rindro_Anton_New); + getroottable().rawset("LenheartTopFuncTab", T); +} \ No newline at end of file diff --git a/Project/Anton/Rindro_Anton_CreateParty.nut b/Project/Anton/Rindro_Anton_CreateParty.nut new file mode 100644 index 0000000..1f93b4c --- /dev/null +++ b/Project/Anton/Rindro_Anton_CreateParty.nut @@ -0,0 +1,106 @@ +/* +文件名:Rindro_Anton_CreateParty.nut +路径:Plugins/New_Anton/Rindro_Anton_CreateParty.nut +创建日期:2024-07-15 20:28 +文件用途:安图恩创建队伍窗口 +*/ + + +class Rindro_AntonCreatePartyC extends LenheartNewUI_Windows { + //调试模式 + DeBugMode = false; + + X = 290; + Y = 220; + //输入框 + InputObject = null; + + //时装 帽子 头部 脸 上衣 下装 鞋子 胸部 腰部 皮肤 光环 + AvatarInfoIdx = [0x3038, 0x3010, 0x3014, 0x3018, 0x301c, 0x3020, 0x3024, 0x3028, 0x302c, 0x3030, 0x3034]; + + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(266, 2, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + DestroyWindow(); + }.bindenv(this); + AddChild(CloseButton); + + local OkButton = LenheartNewUI_ButtonText(78, 124, 5, "确定"); + OkButton.SetTextOffset(0, 1); + OkButton.OnClick = function() { + + //如果队伍名输出框的文字长度大于0就创建队伍 创建时告诉服务端自己的 头发 帽子 脸部 皮肤 + if (InputObject.str.len() > 0) { + + local C_Object = L_sq_RA(0x1ab7cdc); + local avataritemsbuf = []; + foreach(offset in AvatarInfoIdx) { + local AvatarEquiAddress = L_sq_RA(C_Object + offset); + if (AvatarEquiAddress >= 0x400000) { + local Ab = []; + local NormalIndex = L_sq_RA(AvatarEquiAddress + 0x1c); + local ExIndex = L_sq_RA(AvatarEquiAddress + 0x13E0); + Ab.append(NormalIndex); + Ab.append(ExIndex); + avataritemsbuf.append(Ab); + } else { + local Ab = []; + Ab.append(0); + Ab.append(0); + avataritemsbuf.append(Ab); + } + } + + local T = { + op = 20064001, + teamsName = InputObject.str, + items = avataritemsbuf, + } + SendPackEx(T); + DestroyWindow(); + } + }.bindenv(this); + AddChild(OkButton); + + local CloseButton = LenheartNewUI_ButtonText(144, 124, 5, "取消"); + CloseButton.SetTextOffset(0, 1); + CloseButton.OnClick = function() { + DestroyWindow(); + }.bindenv(this); + AddChild(CloseButton); + + InputObject = LenheartNewUI_BaseInput(62, 68, 152, 20); + AddChild(InputObject); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + } + + //绘制主界面 + 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/rindroanton/raid/raid_areaimg_fiend.img", 0, X + 11, Y + 21); + + L_sq_DrawImg("hud/rindroanton.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/rindroanton.img", 10, X + 72, Y + 44); + + } + + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + } + +} \ No newline at end of file diff --git a/Project/Anton/Rindro_Anton_FightSituation.nut b/Project/Anton/Rindro_Anton_FightSituation.nut new file mode 100644 index 0000000..5bd57ac --- /dev/null +++ b/Project/Anton/Rindro_Anton_FightSituation.nut @@ -0,0 +1,934 @@ +/* +文件名:Rindro_AntonFightSituation.nut +路径:Plugins/Rindro_Anton/Rindro_AntonFightSituation.nut +创建日期:2024-04-10 21:28 +文件用途:安图恩攻坚战况 +*/ +//复选框 +class RinDro_Anton_LenheartNewUI_SwitchButton extends LenheartNewUI_CommonUi { + //透明度 + AlphaValue = 1.0; + State = 0; + ImgIndex = null; + + constructor(X, Y) { + LenheartNewUI_CommonUi.constructor(X, Y, 14, 15); + } + + function SyncAlpha(Value) { + AlphaValue = Value; + } + + function Show(obj) { + //不可用 + if (State == 8) { + L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex + 3 : 141, X, Y + 1, 1, sq_RGBA(255, 255, 255, (250 * AlphaValue).tointeger()), 1.0, 1.0); + } else { + //悬停 + if (isLBDown) { + L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex + 2 : 140, X, Y + 1, 1, sq_RGBA(255, 255, 255, (250 * AlphaValue).tointeger()), 1.0, 1.0); + } + //按下 + else if (isInRect) { + if (State == 0) + L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex + 1 : 139, X, Y, 1, sq_RGBA(255, 255, 255, (250 * AlphaValue).tointeger()), 1.0, 1.0); + if (State == 1) + L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex + 2 : 140, X, Y, 1, sq_RGBA(255, 255, 255, (250 * AlphaValue).tointeger()), 1.0, 1.0); + } + //普通 + else { + if (State == 0) + L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex : 138, X, Y, 1, sq_RGBA(255, 255, 255, (250 * AlphaValue).tointeger()), 1.0, 1.0); + if (State == 1) + L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex + 2 : 140, X, Y, 1, sq_RGBA(255, 255, 255, (250 * AlphaValue).tointeger()), 1.0, 1.0); + + } + } + } +} + +class Rindro_AntonFightSituationC extends LenheartNewUI_Windows { + + Visible = false; + //调试模式 + // DeBugMode = true; + //透明度 + AlphaValue = 1.0; + + //攻坚战况信息 + Info = null; + //战况消息外部窗口 + ExternalWindow = null; + + //选择进入地下城指针状态 + SelectDgnMarkFlag = 0; + + //X Y 裁切开始X Y 裁切结束X Y + OffsetArr = [ + //男鬼剑士 + [56, 112, 220, 222], + //女格斗家 + [54, 103, 240, 278], + //男神枪手 + [55, 130, 236, 246], + //女魔法师 + [57, 88, 234, 291], + //男圣职者 + [57, 124, 208, 190], + //女神枪手 + [56, 119, 226, 209], + //暗夜使者 + [56, 117, 225, 212], + //男格斗家 + [56, 118, 233, 212], + //男魔法师 + [54, 103, 236, 276], + //黑暗武士 + [56, 112, 220, 222], + //缔造者 + [57, 88, 234, 291], + ] + + MapIndexTable = null; //判断孵化进入的操作表 + MapMoveMark = false; //副本中移动的标志 + HuoShanMonserTable = null; //火山怪物投放表 + + //获取攻坚信息 + function GetInfo() { + local T = { + op = 20064053, + } + SendPackEx(T); + } + + //火山怪物投放包 + function HuoShanMonsterEvent(Chunk) { + local Info = Json.Decode(Chunk); + if (sq_GetCurrentModuleType() == 3) { + local obj = sq_GetMyMasterCharacter(); + obj = sq_ObjectToSQRCharacter(obj); + obj.sq_SendCreatePassiveObjectPacket(HuoShanMonserTable[Info.FuHuaId], 0, 120, 1, 0); + } + } + + //设置伤害值回调 + function SetCharacterDamageRate(Chunk) { + local Jso = Json.Decode(Chunk); + local Rate = Jso.damageMarkup.tofloat() / 100.0; + //伤害设置 + if (getroottable().rawin("LenheartRaidModuleDamageRate")) { + getroottable()["LenheartRaidModuleDamageRate"] = Rate; + } + } + + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + + //初始化判断孵化进入操作表 + MapIndexTable = {}; + MapIndexTable.rawset(33100, 7); + MapIndexTable.rawset(33103, 8); + MapIndexTable.rawset(33119, 9); + MapIndexTable.rawset(33116, 10); + //火山怪物投放表 + HuoShanMonserTable = {}; + HuoShanMonserTable.rawset(1, 202210052); + HuoShanMonserTable.rawset(2, 202210053); + HuoShanMonserTable.rawset(3, 202210054); + HuoShanMonserTable.rawset(4, 202210055); + + Pack_Control.rawset(20064040, HuoShanMonsterEvent.bindenv(this)); + Pack_Control.rawset(20064030, SetCharacterDamageRate.bindenv(this)); + + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + ExternalWindow = Rindro_Anton_FightSituatioExternalC("安图恩攻坚战况表外部窗口", getroottable().Rindro_Scr_Width.tointeger() - 103, 8, 103, 22, 0); + ExternalWindow.AddParentWin(this); + + GetInfo(); + + } + + //副本List + DgnList = null; + //初始化信息 + function InitInfo(InfoObj) { + Info = InfoObj; + //取出副本信息 + InfoObj = InfoObj.dunList; + + DgnList = []; + //当前构造时间 + local Time_C = Clock(); + + foreach(DgnObj in InfoObj) { + //黑雾之源 + if (DgnObj.id == 0) { + DgnObj.BackGroundIdx <- 6; + DgnObj.X <- 78; + DgnObj.Y <- 330; + DgnObj.BloodType <- 4; + DgnObj.NameIdx <- 0; + } + //震颤A + else if (DgnObj.id == 1) { + DgnObj.BackGroundIdx <- 15; + DgnObj.Timer <- Time_C; + DgnObj.X <- 246; + DgnObj.Y <- 286; + DgnObj.BloodType <- 1; + DgnObj.NameIdx <- 4; + //死了读复活 活着读爆炸 + if (DgnObj.state == 0) DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.ZhenChan_BaoZhaShiJian; + else DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.ZhenChan_FuHuoShiJian; + } + //震颤B + else if (DgnObj.id == 11) { + DgnObj.BackGroundIdx <- 15; + DgnObj.Timer <- Time_C; + DgnObj.X <- 480; + DgnObj.Y <- 286; + DgnObj.BloodType <- 1; + DgnObj.NameIdx <- 5; + //死了读复活 活着读爆炸 + if (DgnObj.state == 0) DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.ZhenChan_BaoZhaShiJian; + else DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.ZhenChan_FuHuoShiJian; + } + //舰炮 + else if (DgnObj.id == 3) { + DgnObj.BackGroundIdx <- 15; + DgnObj.Timer <- Time_C; + DgnObj.X <- 340; + DgnObj.Y <- 168; + DgnObj.BloodType <- 1; + DgnObj.NameIdx <- 1; + //死了读复活 活着读爆炸 + if (DgnObj.state == 0) DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.JianPao_BaoZhaShiJian; + else DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.JianPao_FuHuoShiJian; + } + //擎天A + else if (DgnObj.id == 2) { + DgnObj.BackGroundIdx <- 6; + DgnObj.X <- 200; + DgnObj.Y <- 400; + DgnObj.BloodType <- 2; + DgnObj.NameIdx <- 2; + } + //擎天B + else if (DgnObj.id == 21) { + DgnObj.BackGroundIdx <- 6; + DgnObj.X <- 510; + DgnObj.Y <- 400; + DgnObj.BloodType <- 2; + DgnObj.NameIdx <- 3; + } + //能源 + else if (DgnObj.id == 4) { + DgnObj.BackGroundIdx <- 6; + DgnObj.X <- 340; + DgnObj.Y <- 210; + DgnObj.BloodType <- 2; + DgnObj.NameIdx <- 7; + } + //火山 + else if (DgnObj.id == 5) { + DgnObj.BackGroundIdx <- 6; + DgnObj.X <- 336; + DgnObj.Y <- 75; + DgnObj.BloodType <- 2; + DgnObj.NameIdx <- 6; + } + //第1孵化 + else if (DgnObj.id == 7) { + DgnObj.BackGroundIdx <- 15; + DgnObj.X <- 110; + DgnObj.Y <- 340; + DgnObj.BloodType <- 2; + DgnObj.NameIdx <- 9; + DgnObj.Timer <- Time_C; + //死了读复活 活着读爆炸 + if (DgnObj.state == 0) DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.FuHua_TouSon_ShiJian; + else DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.FuHua_FuHuo_ShiJian; + } + //第2孵化 + else if (DgnObj.id == 8) { + DgnObj.BackGroundIdx <- 6; + DgnObj.X <- 240; + DgnObj.Y <- 340; + DgnObj.BloodType <- 2; + DgnObj.NameIdx <- 10; + DgnObj.Timer <- Time_C; + //死了读复活 活着读爆炸 + if (DgnObj.state == 0) DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.FuHua_TouSon_ShiJian; + else DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.FuHua_FuHuo_ShiJian; + } + //第3孵化 + else if (DgnObj.id == 9) { + DgnObj.BackGroundIdx <- 6; + DgnObj.X <- 470; + DgnObj.Y <- 340; + DgnObj.BloodType <- 2; + DgnObj.NameIdx <- 11; + DgnObj.Timer <- Time_C; + //死了读复活 活着读爆炸 + if (DgnObj.state == 0) DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.FuHua_TouSon_ShiJian; + else DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.FuHua_FuHuo_ShiJian; + } + //第4孵化 + else if (DgnObj.id == 10) { + DgnObj.BackGroundIdx <- 6; + DgnObj.X <- 600; + DgnObj.Y <- 340; + DgnObj.BloodType <- 2; + DgnObj.NameIdx <- 12; + DgnObj.Timer <- Time_C; + //死了读复活 活着读爆炸 + if (DgnObj.state == 0) DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.FuHua_TouSon_ShiJian; + else DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.FuHua_FuHuo_ShiJian; + } + //心脏 + else if (DgnObj.id == 12) { + DgnObj.BackGroundIdx <- 15; + DgnObj.X <- 330; + DgnObj.Y <- 286; + DgnObj.BloodType <- 5; + DgnObj.NameIdx <- 8; + } + + + + + DgnList.append(clone(DgnObj)); + } + /* + + //初始化黑雾之源副本 + local T = { + Id = 0, //相对ID 服务端进图逻辑 + Timer = null, + BackGroundIdx = 6, + NameIdx = 0, + BloodType = 4, + NowBlood = InfoObj.HeiWu_State, + Party = InfoObj.HeiWu_Party, + X = 78, + Y = 330 + } + DgnList.append(T); + + //黑雾之源已经死亡 + if (InfoObj.HeiWu_State == 4) { + + + + + } + */ + + + } + + BaseSituationBtn = null; + //简易战况表是否开启 + BaseSituationFlag = 1; + + function RegisterWidget() { + //进入地下城 + local GoDgnButton = LenheartNewUI_BaseButton(578, 519, 95, 29, "hud/newantondungeonbutton.img", 6); + GoDgnButton.OnClick = function() { + SelectDgnMarkFlag = 1; + }.bindenv(this); + Childrens.append(GoDgnButton); + + //返回城镇 + local ReturnTownButton = LenheartNewUI_BaseButton(678, 519, 95, 29, "hud/newantondungeonbutton.img", 9); + ReturnTownButton.OnClick = function() { + local T = { + op = 20064305, + } + SendPackEx(T); + }.bindenv(this); + Childrens.append(ReturnTownButton); + + //简易战况表复选框 + BaseSituationBtn = RinDro_Anton_LenheartNewUI_SwitchButton(220, 20); + BaseSituationBtn.State = 1; + BaseSituationBtn.ImgIndex = 358; + BaseSituationBtn.Width = 19; + BaseSituationBtn.Height = 19; + BaseSituationBtn.OnClick = function() { + switch (BaseSituationFlag) { + case 0: + BaseSituationFlag = 1; + break; + case 1: + BaseSituationFlag = 0; + break; + } + BaseSituationBtn.State = BaseSituationFlag; + }.bindenv(this); + AddChild(BaseSituationBtn); + + // //关闭按钮 + // local CloseButton = LenheartNewUI_BaseButton(696, 20, 103, 22, "hud/newantondungeonbutton.img", 3); + // CloseButton.OnClick = function() { + // CloseWindow(); + // CloseFlag = Clock(); + // }.bindenv(this); + // Childrens.append(CloseButton); + } + + function DrawParty() { + //绘制待命房间 + DrawImg("interface2/raid/anton/game_navigation/game_navigation.img", 33, X + 20, Y + 488); + + // for (local i = 0; i< 20; i++) { + // sq_DrawBox(X + 26 + (i % 10) * 24, Y + 513 + (i / 10) * 20, 22, 18, 0XFFFFFFFF); + // } + //绘制我的队伍 + if (RinDro_Anton_Obj.MyRaidTeam) { + local Mt = RinDro_Anton_Obj.MyRaidTeam; + if (!Mt) return; + local PartyMaster; + local PosI = 0; + foreach(index, PartyMasterIcon in Mt.MembersList) { + if (!("Standby" in PartyMasterIcon.InfoObj) || !PartyMasterIcon.InfoObj.Standby) continue; + local XOffset = 0; + local YOffset = 9 + (index * 22); + + //绘制队长头像 + foreach(AvatarObj in PartyMasterIcon.InfoObj.EquVos) { + local AXpos = AvatarObj.F[0][2] + X + OffsetArr[PartyMasterIcon.InfoObj.Job][0] - 17 + ((PosI % 10) * 24); + local AYpos = AvatarObj.F[0][3] + Y + OffsetArr[PartyMasterIcon.InfoObj.Job][1] + 512 + ((PosI / 10) * 20); + setClip(AXpos + OffsetArr[PartyMasterIcon.InfoObj.Job][2], AYpos + OffsetArr[PartyMasterIcon.InfoObj.Job][3], AXpos + OffsetArr[PartyMasterIcon.InfoObj.Job][2] + 22, AYpos + OffsetArr[PartyMasterIcon.InfoObj.Job][3] + 18); //开始裁切 + L_sq_DrawImg("character/" + AvatarObj.B + ".img", AvatarObj.F[0][0], AXpos, AYpos); + releaseClip(); //裁切结束 + } + PosI++; + } + } + + } + + PartyBackground = [ + [10, -65, 24, -60, 25, 25], + [9, -65, 0, -60, 1, 1], + [11, -65, 42, -60, 48, 49], + [8, -65, -24, -60, -24, -23], + [12, -65, 64, -60, 71, 72], + ] + //绘制副本 + function DrawDungeon(DgnObj) { + + //普通类型副本 + if (DgnObj.type == 0) { + //绘制血条 + if ("hp" in DgnObj && "BloodType" in DgnObj) { + //已经死亡 + if (DgnObj.hp == DgnObj.BloodType) { + //绘制副本血槽背景 + DrawImg("hud/newantondungeoninfo.img", DgnObj.BackGroundIdx, X + DgnObj.X, Y + DgnObj.Y); + DrawImg("hud/newantondungeoninfo.img", 6, X + DgnObj.X, Y + DgnObj.Y); + + //绘制副本名称重生时间 + DrawImg("hud/newantondungeoninfo2.img", 20, X + DgnObj.X + 42, Y + DgnObj.Y - 18); + } else { + //绘制副本血槽背景 + DrawImg("hud/newantondungeoninfo.img", DgnObj.BackGroundIdx, X + DgnObj.X, Y + DgnObj.Y); + DrawImg("hud/newantondungeoninfo.img", 4, X + DgnObj.X, Y + DgnObj.Y); + //得出血条类型需要的img + local ImgIdx = 0; + if (DgnObj.BloodType == 5) ImgIdx = 0; + else if (DgnObj.BloodType == 4) ImgIdx = 5; + else if (DgnObj.BloodType == 2) ImgIdx = 9; + else if (DgnObj.BloodType == 1) ImgIdx = 11; + //绘制血条 + DrawImg("hud/newantondungeonblood.img", ImgIdx + DgnObj.hp, X + DgnObj.X, Y + DgnObj.Y); + //绘制副本名称外框 + DrawImg("hud/newantondungeoninfo.img", 5, X + DgnObj.X + 42, Y + DgnObj.Y - 18); + //绘制副本名称 + DrawImg("hud/newantondungeonname.img", DgnObj.NameIdx, X + DgnObj.X + 40, Y + DgnObj.Y - 16); + } + } + } + //进度条类型副本 + else if (DgnObj.type == 1) { + //绘制副本血槽背景 + if ("gr" in DgnObj && DgnObj.gr == 1) { + DrawImg("hud/newantondungeoninfo.img", 18, X + DgnObj.X, Y + DgnObj.Y); + } else { + DrawImg("hud/newantondungeoninfo.img", DgnObj.BackGroundIdx, X + DgnObj.X, Y + DgnObj.Y); + } + //如果存活 + if (DgnObj.state == 0) { + //绘制血量 + DrawImg("hud/newantondungeonblood.img", 11, X + DgnObj.X, Y + DgnObj.Y); + + // print(DgnObj.time); + local Remainder = DgnObj.time - (Clock() - DgnObj.Timer); + local Rate = Remainder.tofloat() / DgnObj.MaxTime; + local Idx = (Rate * 100.0).tointeger(); + if (Idx< 0) Idx = 0; + + //绘制时间进度条 + DrawImg("hud/newantondungeonloading2.img", 99 - Idx, X + DgnObj.X, Y + DgnObj.Y); + //绘制时间 + local TimeStr = (Remainder / 1000.0).tointeger().tostring(); + L_sq_DrawCode(TimeStr, X + DgnObj.X + 36 - LenheartTextClass.GetStringLength(TimeStr) / 2, Y + DgnObj.Y + 26, sq_RGBA(255, 255, 255, 255), 0, 1); + //绘制副本名称外框 + DrawImg("hud/newantondungeoninfo.img", 5, X + DgnObj.X + 42, Y + DgnObj.Y - 18); + //绘制副本名称 + DrawImg("hud/newantondungeonname.img", DgnObj.NameIdx, X + DgnObj.X + 40, Y + DgnObj.Y - 16); + } else { + local Remainder = DgnObj.time - (Clock() - DgnObj.Timer); + local Rate = Remainder.tofloat() / DgnObj.MaxTime; + local Idx = (Rate * 100.0).tointeger(); + + + //绘制时间进度条 + L_sq_DrawImg("hud/newantondungeonloading2.img", 99 - Idx, X + DgnObj.X, Y + DgnObj.Y, 1, sq_RGBA(100, 0, 0, (250 * AlphaValue).tointeger()), 1.0, 1.0); + + //绘制时间 + local TimeStr = (Remainder / 1000.0).tointeger().tostring(); + L_sq_DrawCode(TimeStr, X + DgnObj.X + 36 - LenheartTextClass.GetStringLength(TimeStr) / 2, Y + DgnObj.Y + 26, sq_RGBA(255, 85, 0, 255), 0, 1); + //绘制副本名称重生时间 + DrawImg("hud/newantondungeoninfo2.img", 20, X + DgnObj.X + 42, Y + DgnObj.Y - 18); + } + } + //黑色火山 + else if (DgnObj.type == 2) { + //绘制副本血槽背景 + DrawImg("hud/newantondungeoninfo.img", 16, X + DgnObj.X, Y + DgnObj.Y); + //如果存活 + if (DgnObj.state == 0) { + //绘制时间进度条 + L_sq_DrawImg("hud/newantondungeonloading3.img", (100 - (DgnObj.time / 100)), X + DgnObj.X, Y + DgnObj.Y, 1, sq_RGBA(255, 255, 255, (250 * AlphaValue).tointeger()), 1.0, 1.0); + + local TimeStr = format("%03d", (DgnObj.time / 100)); + DrawImg("hud/newantondungeoninfonum.img", TimeStr.slice(0, 1).tointeger(), X + DgnObj.X + 18, Y + DgnObj.Y + 40); + DrawImg("hud/newantondungeoninfonum.img", TimeStr.slice(1, 2).tointeger(), X + DgnObj.X + 28, Y + DgnObj.Y + 40); + DrawImg("hud/newantondungeoninfonum.img", TimeStr.slice(2, 3).tointeger(), X + DgnObj.X + 38, Y + DgnObj.Y + 40); + + //绘制副本名称外框 + DrawImg("hud/newantondungeoninfo.img", 5, X + DgnObj.X + 42, Y + DgnObj.Y - 18); + //绘制副本名称 + DrawImg("hud/newantondungeonname.img", DgnObj.NameIdx, X + DgnObj.X + 42, Y + DgnObj.Y - 16); + } + } + //能源副本 + else if (DgnObj.type == 3) { + //绘制副本血槽背景 + DrawImg("hud/newantondungeoninfo.img", DgnObj.BackGroundIdx, X + DgnObj.X, Y + DgnObj.Y); + //如果存活 + if (DgnObj.state == 0) { + DrawImg("hud/newantondungeoninfo.img", 17, X + DgnObj.X, Y + DgnObj.Y); + //绘制血量 + DrawImg("hud/newantondungeonblood.img", 11, X + DgnObj.X, Y + DgnObj.Y); + //绘制副本名称外框 + DrawImg("hud/newantondungeoninfo.img", 5, X + DgnObj.X + 42, Y + DgnObj.Y - 18); + //绘制副本名称 + DrawImg("hud/newantondungeonname.img", DgnObj.NameIdx, X + DgnObj.X + 40, Y + DgnObj.Y - 16); + } + } + + + + + //绘制队伍信息 + local PartyCount = DgnObj.Party.len(); + for (local i = 0; i< PartyCount; i++) { + local ImgInfo = PartyBackground[i]; + DrawImg("hud/newantondungeoninfo.img", ImgInfo[0], X + DgnObj.X + ImgInfo[1], Y + DgnObj.Y + ImgInfo[2]); + local cid = DgnObj.Party[i][0]; + local count = DgnObj.Party[i][1] - 1; + local CharacV = RinDro_Anton_Obj.Portrait[cid]; + + local XOffset = 0; + local YOffset = 9; + + //绘制队长头像 + foreach(AvatarObj in CharacV.EquVos) { + local AXpos = AvatarObj.F[0][2] + X + OffsetArr[CharacV.Job][0] + DgnObj.X + ImgInfo[3] - 28; + local AYpos = AvatarObj.F[0][3] + Y + OffsetArr[CharacV.Job][1] + DgnObj.Y + ImgInfo[4] + 2; + setClip(AXpos + OffsetArr[CharacV.Job][2], AYpos + OffsetArr[CharacV.Job][3], AXpos + OffsetArr[CharacV.Job][2] + 22, AYpos + OffsetArr[CharacV.Job][3] + 18); //开始裁切 + L_sq_DrawImg("character/" + AvatarObj.B + ".img", AvatarObj.F[0][0], AXpos, AYpos); + releaseClip(); //裁切结束 + } + + //绘制队伍人数 + for (local z = 0; z< count; z++) { + DrawImg("hud/newantondungeoninfo.img", 13, X + DgnObj.X + ImgInfo[3] + 40, Y + DgnObj.Y + 4 + ImgInfo[5] + (z * 6)); + } + + //绘制队伍编号 + DrawImg("hud/newantondungeonpartymark.img", CharacV.TeamId, X + DgnObj.X + ImgInfo[3] - 3, Y + DgnObj.Y + 3 + ImgInfo[4]); + + } + + + } + + DgnIdTName = { + d0 = "黑雾之源", + d2 = "擎天之柱\nA区", + d21 = "擎天之柱\nB区", + d1 = "震颤的大地\nA区", + d11 = "震颤的大地\nB区", + d3 = "舰炮防御战", + + d4 = "能量阻截战", + d5 = "黑色火山", + d7 = "第一孵化中心", + d8 = "第二孵化中心", + d9 = "第三孵化中心", + d10 = "第四孵化中心", + d12 = "安图恩的心脏", + } + + //高级绘制文字(带换行) + function L_sq_DrawCode_Ex(str, x, y, rgba, mb, jc) { + local strarr = []; + if (str.find("\n") == null) L_sq_DrawCode(str, x, y, rgba, mb, jc); + else { + local Bpos = 0; + while (true) { + local Npos = str.find("\n", Bpos); + if (!Npos) { + local strbuff = str.slice(Bpos, str.len()); + strarr.append(strbuff); + break; + } + local strbuff = str.slice(Bpos, Npos); + strarr.append(strbuff); + Bpos = Npos + 1; + } + for (local z = 0; z< strarr.len(); z++) { + L_sq_DrawCode(strarr[z], x, y + (z * 14), rgba, mb, jc); + } + } + } + + //绘制简易战况表 + function DrawSimpleSituation() { + if (!BaseSituationFlag || !DgnList) return; + local X = 0; + + //绘制背景 + foreach(Index, d_obj in DgnList) { + local Obj_X = 0; + local Obj_Y = 0 + (Index * 35); + + local ImgIdX = 80; + if (d_obj.id == 2 || d_obj.id == 21 || d_obj.id == 1 || d_obj.id == 11) ImgIdX = 81; + DrawImg("hud/newantondungeoninfo2.img", ImgIdX, X + Obj_X, Y + 300 + Obj_Y); + // L_sq_DrawWindow(X + Obj_X, Y + 300 + Obj_Y, 180, 40, "interface/lenheartwindowcommon.img", 204, 4, 14, 4, 14); + } + //绘制上层 + foreach(Index, d_obj in DgnList) { + local Obj_X = 0; + local Obj_Y = 0 + (Index * 35); + + //绘制队伍底槽 + for (local i = 0; i< 4; i++) { + DrawImg("hud/partytype.img", 22, X + 2 + Obj_X + (i * 24), Y + 300 + Obj_Y + 20); + } + foreach(pos, pobj in d_obj.Party) { + local cid = pobj[0]; + local CharacV = RinDro_Anton_Obj.Portrait[cid]; + //绘制队伍编号 + DrawImg("hud/partytype.img", 1 + CharacV.TeamId, X + 2 + Obj_X + (pos * 24), Y + 300 + Obj_Y + 20); + } + + local DgnName = DgnIdTName["d" + d_obj.id]; + local Yoffset = 16; + if (d_obj.id == 2 || d_obj.id == 21 || d_obj.id == 1 || d_obj.id == 11) Yoffset = 0; + local RGBA = sq_RGBA(255, 177, 0, 250); + if (d_obj.id != 5) RGBA = sq_RGBA(255, 255, 255, 255); + //绘制名字 + L_sq_DrawCode_Ex(DgnName, X + 102, Y + 305 + Obj_Y + Yoffset, RGBA, 0, 1); + + //绘制血槽背景 + DrawImg("hud/newantondungeoninfo2.img", 82, X + Obj_X + 2, Y + 300 + Obj_Y + 2); + local BloodIdx = 83; + if (d_obj.id == 5 || d_obj.id == 2 || d_obj.id == 21) BloodIdx = 84; + + local Rate = (88.0 - 88.0 * (d_obj.hp.tofloat() / d_obj.BloodType.tofloat())).tointeger(); + if (d_obj.type == 1) { + local Remainder = d_obj.time - (Clock() - d_obj.Timer); + local RateBuf = Remainder.tofloat() / d_obj.MaxTime; + Rate = (RateBuf * 88.0).tointeger(); + } else if (d_obj.type == 2) { + Rate = 88; + } else if (d_obj.type == 3) { + Rate = 88; + } + //绘制生命值 + setClip(X + Obj_X + 6, Y + 300 + Obj_Y + 6, X + Obj_X + 6 + Rate, Y + 300 + Obj_Y + 6 + 9); //开始裁切 + DrawImg("hud/newantondungeoninfo2.img", BloodIdx, X + Obj_X + 6, Y + 300 + Obj_Y + 6); + releaseClip(); //裁切结束 + } + } + + //绘制主界面 + function DrawMain(obj) { + + //绘制背景框 + DrawImg("hud/newantondungeoninfo.img", 0, X + 7, Y); + //绘制乌龟 + DrawImg("hud/newantondungeoninfo.img", 3, X + 28, Y + 50); + //绘制简易战况表 + DrawImg("hud/newantondungeoninfo2.img", 62, X + 220, Y + 19); + + //绘制待命房间 + DrawParty(); + //绘制小队移动 + DrawImg("hud/newantondungeoninfo.img", 14, X + 570, Y + 488); + + + if (DgnList) { + foreach(d_obj in DgnList) { + DrawDungeon(d_obj); + } + } + + + + //绘制主界面复活币剩余 + DrawImg("hud/newantondungeoninfo2.img", 85, X + 45 + 350, Y + 488); + + + //绘制主界面复活币剩余 + local CoinCount = (RinDro_Anton_Obj.FightConfig.rebornNum - Info.ResurrectionNum).tostring(); + for (local i = 0; i< 2; i++) { + if (CoinCount.len() >= (i + 1)) + DrawImg("hud/newantonrewardtime.img", CoinCount.slice(0 + i, 1 + i).tointeger(), X + 45 + 75 + (i * 18) + 350, Y + 515); + } + } + + function DrawImg(Path, Index, XPos, YPos) { + L_sq_DrawImg(Path, Index, XPos, YPos, 1, sq_RGBA(255, 255, 255, (250 * AlphaValue).tointeger()), 1.0, 1.0); + } + + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + + //结束时间 + if (RinDro_Anton_Obj.EndTime) { + DrawFightTime(obj); + } + } + + + //攻坚时间 + function DrawFightTime(obj) { + local X = ((getroottable().Rindro_Scr_Width - 146 - 103 - 550)).tointeger() + L_sq_DrawImg("hud/newantondungeoninfo.img", 1, X + 542, Y); + L_sq_DrawImg("hud/newantondungeoninfo.img", 2, X + 542 + 38, Y + 2); + if (RinDro_Anton_Obj.EndTime != null) { + if (RinDro_Anton_Obj.EndTime< 0) RinDro_Anton_Obj.EndTime = 0; + local RealTime = RinDro_Anton_Obj.EndTime - (Clock() - RinDro_Anton_Obj.PackCurT); + + local seconds = RealTime / 1000; + local hours = seconds / 3600; + local minutes = seconds / 60; + + seconds %= 60; + hours = format("%02d", hours); + seconds = format("%02d", seconds).slice(-2); + minutes = format("%02d", minutes).slice(-2); + + local X1 = 551; + local X2 = X1 + 18; + + local Offset = 0; + L_sq_DrawImg("hud/newantondungeonnum.img", hours.slice(0, 1).tointeger(), X + X1 + Offset, Y + 28); + L_sq_DrawImg("hud/newantondungeonnum.img", hours.slice(1).tointeger(), X + X2 + Offset, Y + 28); + Offset += 46; + L_sq_DrawImg("hud/newantondungeonnum.img", minutes.slice(0, 1).tointeger(), X + X1 + Offset, Y + 28); + L_sq_DrawImg("hud/newantondungeonnum.img", minutes.slice(1).tointeger(), X + X2 + Offset, Y + 28); + Offset += 46; + L_sq_DrawImg("hud/newantondungeonnum.img", seconds.slice(0, 1).tointeger(), X + X1 + Offset, Y + 28); + L_sq_DrawImg("hud/newantondungeonnum.img", seconds.slice(1).tointeger(), X + X2 + Offset, Y + 28); + } + + } + + + + //判断是否可重合 + function PosEvent(Pos, MPos) { + local Offset = abs(Pos - MPos); + if (Offset< 10) return true; + else return false; + } + //判断自身地图相关事件 + function MapEventTest(obj) { + if (sq_GetCurrentModuleType() != 3) return; + local stage = sq_GetGlobaludpModuleStage(); + local MapIndex = sq_GetMapIndex(stage); + if (MapIndexTable.rawin(MapIndex)) { + local X = obj.getXPos(); + local Y = obj.getYPos(); + local Mark = false; + if (MapIndex == 33103 && PosEvent(X, 737) && PosEvent(Y, 354)) Mark = true; + if (MapIndex == 33100 && PosEvent(X, 369) && PosEvent(Y, 387)) Mark = true; + if (MapIndex == 33116 && PosEvent(X, 365) && PosEvent(Y, 374)) Mark = true; + if (MapIndex == 33119 && PosEvent(X, 838) && PosEvent(Y, 424)) Mark = true; + + if (Mark == true && MapMoveMark == false) { + local T = { + op = 20064303, + DunId = MapIndexTable[MapIndex] + } + SendPackEx(T); + MapMoveMark = true; + } else if (Mark == false) MapMoveMark = false; + } else { + MapMoveMark = false; + } + } + + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + MapEventTest(obj); + if (SelectDgnMarkFlag) { + L_sq_WA(0x1b46898, 47); + } + + + } + + //鼠标左键弹起回调 + function OnMouseLbUp(MousePos_X, MousePos_Y) { + if (SelectDgnMarkFlag != 0) { + SelectDgnMarkFlag = 0; + L_sq_WA(0x1b46898, 0); + foreach(d_obj in DgnList) { + if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X + d_obj.X, Y + d_obj.Y, 71, 71)) { + local T = { + op = 20064301, + DunId = d_obj.id + } + SendPackEx(T); + //关闭攻坚战况表窗口 + CloseWindow(); + //关闭攻坚队窗口 + RinDro_Anton_Obj.PartyWindow_Object.CloseWindow(); + //关闭攻坚队大厅窗口 + RinDro_Anton_Obj.PartyHallWindow_Object.CloseWindow(); + } + } + } + LenheartNewUI_Windows.OnMouseLbUp(MousePos_X, MousePos_Y); + } + + + MainButton = null; + CloseMainButton = null; + CloseFlag = false; + //顶层绘制 + function TopDraw(obj) { + //界面未打开 + if (!this.Visible) { + //在甲板 + if (RinDro_Anton_Obj.BaseConfig && "channel_index" in RinDro_Anton_Obj.BaseConfig && RinDro_Anton_Obj.BaseConfig.channel_index.find("18") && "town_index" in RinDro_Anton_Obj.BaseConfig && L_sq_GetTownIndex() == RinDro_Anton_Obj.BaseConfig.town_index && (RinDro_Anton_Obj.MyRaidState == 1 || RinDro_Anton_Obj.MyRaidState == 3) && !CloseFlag) { + + } + + if (CloseFlag) { + if (Clock() - CloseFlag >= 10) + CloseFlag = false; + } + } else { + + } + + } +} + + +class Rindro_Anton_FightSituatioExternalC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + NoWindow = true; + + //操作窗口 + Window = null; + + //是否可见 + // Visible = false; + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + } + + function RegisterWidget() { + //开启按钮 + local CloseButton = LenheartNewUI_BaseButton(0, 0, 103, 22, "hud/newantondungeonbutton.img", 0); + CloseButton.OnClick = function() { + if (!Window.Visible) { + Window.Visible = true; + Window.ResetFocus(); + Window.GetInfo(); + } else { + Window.CloseWindow(); + } + }.bindenv(this); + CloseButton.SetCallBackFunc(function(button) { + if (!Window.Visible) { + button.Idx = 0; + } else { + button.Idx = 3; + } + }.bindenv(this)); + Childrens.append(CloseButton); + } + + function AddParentWin(Win) { + Window = Win; + } + + //绘制主界面 + function DrawMain(obj) {} + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + + } + + function TopShow(obj) { + //结束时间 + if (RinDro_Anton_Obj.EndTime) { + Window.DrawFightTime(obj); + + } + Window.DrawSimpleSituation(); + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + + //在甲板 + if (RinDro_Anton_Obj.BaseConfig && "channel_index" in RinDro_Anton_Obj.BaseConfig && RinDro_Anton_Obj.BaseConfig.channel_index.find("18") && "town_index" in RinDro_Anton_Obj.BaseConfig && L_sq_GetTownIndex() == RinDro_Anton_Obj.BaseConfig.town_index && (RinDro_Anton_Obj.MyRaidState == 1 || RinDro_Anton_Obj.MyRaidState == 3)) { + Visible = true; + } else { + Visible = false; + } + } + +} \ No newline at end of file diff --git a/Project/Anton/Rindro_Anton_Noti.nut b/Project/Anton/Rindro_Anton_Noti.nut new file mode 100644 index 0000000..dc4ee7a --- /dev/null +++ b/Project/Anton/Rindro_Anton_Noti.nut @@ -0,0 +1,127 @@ +/* +文件名:Rindro_Anton_Noti.nut +路径:Plugins/Rindro_Anton_/Rindro_Anton_Noti.nut +创建日期:2024-04-12 22:12 +文件用途:超时空攻坚战队伍消息 +*/ +class Rindro_Anton_NotiC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + //不要窗口模式 + NoWindow = true; + //消息内容 + Msg = null; + //队长名称 + Name = null; + //消息时间 + Timer = null; + + + //X Y 裁切开始X Y 裁切结束X Y + OffsetArr = [ + //男鬼剑士 + [56, 112, 220, 222], + //女格斗家 + [54, 103, 240, 278], + //男神枪手 + [55, 130, 236, 246], + //女魔法师 + [57, 88, 234, 291], + //男圣职者 + [57, 124, 208, 190], + //女神枪手 + [56, 119, 226, 209], + //暗夜使者 + [56, 117, 225, 212], + //男格斗家 + [56, 118, 233, 212], + //男魔法师 + [54, 103, 236, 276], + //黑暗武士 + [56, 112, 220, 222], + //缔造者 + [57, 88, 234, 291], + ] + + //队伍聊天消息分发 + function Rindro_Anton_PartyNotiCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + Name = Jso.Name; + Msg = Jso.msg; + Timer = Clock(); + } + + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + //队伍聊天消息分发 + Pack_Control.rawset(20064018, Rindro_Anton_PartyNotiCallBack.bindenv(this)); + } + + function RegisterWidget() { + + } + + //队长头像 + PartyMasterIcon = null; + //绘制主界面 + function DrawMain(obj) { + + if (!Name || !Msg) return; + local Ct = Clock() - Timer; + T_DrawDynamicAni(obj, "common/anton/title/06_leader_message_00.ani", 180, 180, "攻坚队团长消息分发" + Timer); + + if (RinDro_Anton_Obj.MyRaidTeam) { + local Mt = RinDro_Anton_Obj.MyRaidTeam; + local PartyMaster = null; + foreach(index, value in Mt.MembersList) { + if (value.InfoObj.Captain) { + PartyMasterIcon = clone(value); + } + } + + if (Ct >= 200) { + //绘制队长头像 + foreach(AvatarObj in PartyMasterIcon.InfoObj.EquVos) { + local AXpos = AvatarObj.F[0][2] + X + OffsetArr[PartyMasterIcon.InfoObj.Job][0] - 9 + 150; + local AYpos = AvatarObj.F[0][3] + Y + OffsetArr[PartyMasterIcon.InfoObj.Job][1] + 184; + setClip(AXpos + OffsetArr[PartyMasterIcon.InfoObj.Job][2], AYpos + OffsetArr[PartyMasterIcon.InfoObj.Job][3], AXpos + OffsetArr[PartyMasterIcon.InfoObj.Job][2] + 22, AYpos + OffsetArr[PartyMasterIcon.InfoObj.Job][3] + 18); //开始裁切 + L_sq_DrawImg("character/" + AvatarObj.B + ".img", AvatarObj.F[0][0], AXpos, AYpos); + releaseClip(); //裁切结束 + } + } + } + + //绘制消息 + if (Ct >= 200) L_sq_DrawCode(Msg, X + 270 + LenheartTextClass.GetStringLength(Name), Y + 190, sq_RGBA(230, 200, 155, 255), 0, 1); + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + if (Name && Msg) + ResetFocus(); + else + // CloseWindow(); + + if (Timer) { + if (Clock() - Timer >= 3000) { + Timer = null; + Name = null; + Msg = null; + } + } + } + +} \ No newline at end of file diff --git a/Project/Anton/Rindro_Anton_Party.nut b/Project/Anton/Rindro_Anton_Party.nut new file mode 100644 index 0000000..efe4f3e --- /dev/null +++ b/Project/Anton/Rindro_Anton_Party.nut @@ -0,0 +1,79 @@ +/* +文件名:Rindro_Anton_Party.nut +路径:Plugins/New_Anton/Rindro_Anton_Party.nut +创建日期:2024-07-15 21:02 +文件用途:安图恩队伍对象 +*/ + +class Rindro_AntonPartyC extends LenheartNewUI_CommonUi { + X = 0; + Y = 0; + Width = null; + Height = null; + TeamObj = null; + //选中状态 + SelectState = false; + //攻坚状态 + OffensiveState = 0; + + constructor(gTeamObj) { + //拿到信息Map + TeamObj = gTeamObj; + //设定宽高 坐标不重要 会被父窗口的Sync同步坐标 + this.Width = 458; + this.Height = 21; + + this.OnClick = function() { + //还原父对象中其他攻坚队伍类 选中自己 + foreach(Obj in Parent.Childrens) { + if (Obj instanceof Rindro_AntonPartyC) { + Obj.SelectState = false; + } + } + SelectState = !SelectState; + //发送查看攻坚队具体信息包 + local T = { + op = 20064013, + teamsId = TeamObj.TeamId + } + SendPackEx(T); + } + LenheartNewUI_CommonUi.constructor(10, 82, this.Width, this.Height); + } + + function Show(obj) { + //绘制底槽 + L_sq_DrawImg("hud/rindroanton.img", 4, X, Y); + + //绘制队伍编号 + L_sq_DrawCode(TeamObj.TeamId, X + 22 - LenheartTextClass.GetStringLength(TeamObj.TeamId) / 2, Y + 5, sq_RGBA(134, 120, 79, 255), 0, 1); + //绘制队长头像 + L_sq_DrawImg("interface/lenheartwindowcommon.img", 55, X + 52, Y + 7); + try { + local channel_index = FiendwarTotal.GetInstance().BaseConfig.channel_index; + channel_index = channel_index.slice(channel_index.len() - 2, channel_index.len()); + //绘制频道信息 + L_sq_DrawCode(channel_index, X + 102 - LenheartTextClass.GetStringLength(channel_index) / 2, Y + 5, sq_RGBA(134, 120, 79, 255), 0, 1); + } catch (exception) { + + } + //绘制攻坚队名称 + L_sq_DrawCode(TeamObj.TeamName, X + 130, Y + 5, sq_RGBA(134, 120, 79, 255), 0, 1); + // print(TeamObj.State); + //绘制攻坚队攻坚状态 + L_sq_DrawImg("hud/newantonui.img", 4 + TeamObj.State, X + 314, Y + 2); + + local PartyPlayerCountStr = TeamObj.TeamPlayerCount + " / " + 20; + //绘制攻坚队队员数量 + L_sq_DrawCode(PartyPlayerCountStr, X + 434 - LenheartTextClass.GetStringLength(PartyPlayerCountStr) / 2, Y + 5, sq_RGBA(134, 120, 79, 255), 0, 1); + + if (SelectState) { + L_sq_DrawImg("hud/rindroanton.img", 5, X, Y); + } + + if (isInRect) { + L_sq_DrawImg("hud/rindroanton.img", 5, X, Y); + } + } + +} \ No newline at end of file diff --git a/Project/Anton/Rindro_Anton_PartyApplyJoin.nut b/Project/Anton/Rindro_Anton_PartyApplyJoin.nut new file mode 100644 index 0000000..fb0d68a --- /dev/null +++ b/Project/Anton/Rindro_Anton_PartyApplyJoin.nut @@ -0,0 +1,258 @@ +/* +文件名:Rindro_Anton_PartyApplyJoin.nut +路径:Plugins/New_Anton/Rindro_Anton_PartyApplyJoin.nut +创建日期:2024-07-16 21:54 +文件用途:安图恩玩家申请加入攻坚队 +*/ +class Rindro_AntonApplyJoinC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //角色对象 + Charc = null; + //角色等级 + Level = "100级"; + //角色名称 + Name = "凌众K"; + //角色职业 + Job = 0; + //角色决斗等级 + PvpLevel = 1; + //职业名称 + JobName = "大暗黑天"; + //角色复活币 + Coin = "139个"; + //角色疲劳值 + Fatigue = "156"; + //战斗力 + Combat = "170051206"; + //通过次数 + ClearanceCount = 63; + //玩家世界Session + PlayerSession = 0; + + //请求者信息集合 + RequestJoinTeamArr = null; + NowSelectJoinIndex = 0; + + //角色头像集合 + AvatarArr = null; + + //初始化Flag + InitFlag = false; + + //X Y 裁切开始X Y 裁切结束X Y + OffsetArr = [ + //男鬼剑士 + [56, 112, 220, 222], + //女格斗家 + [54, 103, 240, 278], + //男神枪手 + [55, 130, 236, 246], + //女魔法师 + [57, 88, 234, 291], + //男圣职者 + [57, 124, 208, 190], + //女神枪手 + [56, 119, 226, 209], + //暗夜使者 + [56, 117, 225, 212], + //男格斗家 + [56, 118, 233, 212], + //男魔法师 + [54, 103, 236, 276], + //黑暗武士 + [56, 112, 220, 222], + //缔造者 + [57, 88, 234, 291], + ] + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + RequestJoinTeamArr = []; + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + } + + function InitInfo() { + local InfoObj = RequestJoinTeamArr[NowSelectJoinIndex]; + Charc = InfoObj.Charc; + //角色等级 + Level = InfoObj.Level; + //角色名称 + Name = InfoObj.Name; + //角色职业 + Job = InfoObj.Job; + //角色决斗等级 + PvpLevel = InfoObj.PvpLevel; + //职业名称 + JobName = InfoObj.JobName; + //角色复活币 + Coin = InfoObj.Coin + "个"; + //角色疲劳值 + Fatigue = InfoObj.Fatigue.tostring(); + //战斗力 + Combat = InfoObj.Combat; + //通过次数 + ClearanceCount = InfoObj.ClearanceCount; + //头像 + AvatarArr = InfoObj.AvatarArr; + //玩家世界Session + this.PlayerSession = InfoObj.PlayerSession; + + Childrens = []; + //注册控件 + RegisterWidget(); + InitFlag = true; + } + + function PopOne() { + if (RequestJoinTeamArr.len() > 1) { + RequestJoinTeamArr.remove(0); + InitInfo(); + } else { + RequestJoinTeamArr = []; + CloseWindow(); + } + } + + function RegisterWidget() { + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(244, 0, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + PopOne(); + }.bindenv(this); + AddChild(CloseButton); + + //冒险团按钮 + local MButton = LenheartNewUI_ButtonText(24, 114, 15, "冒险团信息"); + MButton.SetTextOffset(-13, 2); + AddChild(MButton); + //冒险图鉴按钮 + local FQButton = LenheartNewUI_ButtonText(95, 113, 15, "冒险图鉴"); + FQButton.State = 8; + FQButton.SetTextOffset(-7, 2); + AddChild(FQButton); + //查看信息按钮 + local CButton = LenheartNewUI_ButtonText(166, 114, 15, "查看信息"); + CButton.SetTextOffset(-7, 2); + CButton.OnClick = function() { + local obj = sq_GetMyMasterCharacter(); + // obj.sq_PlaySound("CLICK_BUTTON1"); + L_sq_SendPackType(8); + L_sq_SendPackWord(this.PlayerSession); + L_sq_SendPackByte(3); + L_sq_SendPack(); + getroottable().WindowsShowABFlag <- false; //让原生窗口置顶 + }.bindenv(this); + AddChild(CButton); + + //确认按钮 + local OkButton = LenheartNewUI_ButtonText(74, 192, -1, "是"); + OkButton.SetTextOffset(3, 2); + OkButton.OnClick = function() { + local T = { + op = 20064003, + teamsId = RinDro_Anton_Obj.MyRaidTeamId, + applyCid = Charc.CID + } + SendPackEx(T); + PopOne(); + }.bindenv(this); + AddChild(OkButton); + //拒绝按钮 + local NoButton = LenheartNewUI_ButtonText(130, 192, -1, "否"); + NoButton.SetTextOffset(3, 2); + NoButton.OnClick = function() { + local T = { + op = 20064019, + charac = Charc.CID + } + SendPackEx(T); + PopOne(); + }.bindenv(this); + AddChild(NoButton); + + //左翻页按钮 + local LeftButton = LenheartNewUI_BaseButton(90, 220, 15, 15, "interface/lenheartwindowcommon.img", 34); + LeftButton.OnClick = function() { + if (NowSelectJoinIndex > 0) NowSelectJoinIndex--; + InitInfo(); + }.bindenv(this); + AddChild(LeftButton); + + //右翻页按钮 + local RightButton = LenheartNewUI_BaseButton(154, 220, 15, 15, "interface/lenheartwindowcommon.img", 38); + RightButton.OnClick = function() { + if (NowSelectJoinIndex< RequestJoinTeamArr.len() - 1) NowSelectJoinIndex++; + InitInfo(); + }.bindenv(this); + AddChild(RightButton); + } + + //绘制主界面 + function DrawMain(obj) { + if (!InitFlag) return; + //标题栏 + L_sq_DrawButton(X - 2, Y, 252, "interface/lenheartwindowcommon.img", 609, 2, 7); + //绘制窗口名字 + L_sq_DrawCode("攻坚队申请", X + 100, Y + 4, sq_RGBA(134, 120, 79, 255), 0, 1); + //Item信息框一般为211的宽度 + L_sq_DrawWindow(X, Y + 16, 240, 200, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); + //绘制背景 + L_sq_DrawImg("hud/fiendwarl.img", 15, X + 6, Y + 22); + //绘制角色背景 + L_sq_DrawImg("hud/fiendwarl.img", 14, X + 8, Y + 40); + //绘制角色头像 + if (AvatarArr) { + foreach(AvatarObj in AvatarArr) { + local AXpos = AvatarObj.F[0][2] + X + OffsetArr[Job][0] - 8; + local AYpos = AvatarObj.F[0][3] + Y + OffsetArr[Job][1] + 40; + setClip(AXpos + OffsetArr[Job][2], AYpos + OffsetArr[Job][3], AXpos + OffsetArr[Job][2] + 22, AYpos + OffsetArr[Job][3] + 18); //开始裁切 + L_sq_DrawImg("character/" + AvatarObj.B + ".img", AvatarObj.F[0][0], AXpos, AYpos); + releaseClip(); //裁切结束 + } + } + //绘制角色等级 + L_sq_DrawCode(Level, X + 78 - LenheartTextClass.GetStringLength(Level) / 2, Y + 45, sq_RGBA(134, 120, 79, 255), 0, 1); + //绘制角色名字 + L_sq_DrawCode(Name, X + 137 - LenheartTextClass.GetStringLength(Name) / 2, Y + 45, sq_RGBA(134, 120, 79, 255), 0, 1); + //绘制角色职业类型图标 + if (Job != 4) L_sq_DrawImg("hud/fiendwarl.img", 16, X + 176, Y + 43); + //绘制角色职业名称 + L_sq_DrawCode(JobName, X + 224 - LenheartTextClass.GetStringLength(JobName) / 2, Y + 45, sq_RGBA(134, 120, 79, 255), 0, 1); + //Item信息框一般为211的宽度 + L_sq_DrawWindow(X + 21, Y + 65, 30, 30, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); + L_sq_DrawWindow(X + 62, Y + 65, 156, 30, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); + //绘制决斗等级 + local PvpImg = PvpLevel / 6; + L_sq_DrawImg("hud/fiendwarl1.img", 99, X + 25, Y + 74); + L_sq_DrawCode(PvpLevel.tostring(), X + 45 - LenheartTextClass.GetStringLength(PvpLevel.tostring()) / 2, Y + 91, sq_RGBA(134, 120, 79, 255), 0, 1); + //绘制各项信息 + L_sq_DrawCode("复活币:", X + 70, Y + 76, sq_RGBA(134, 120, 79, 255), 0, 1); + L_sq_DrawCode(Coin, X + 134 - LenheartTextClass.GetStringLength(Coin) / 2, Y + 76, sq_RGBA(134, 120, 79, 255), 0, 1); + L_sq_DrawCode("疲劳值:", X + 158, Y + 76, sq_RGBA(134, 120, 79, 255), 0, 1); + L_sq_DrawCode(Fatigue, X + 216 - LenheartTextClass.GetStringLength(Fatigue) / 2, Y + 76, sq_RGBA(134, 120, 79, 255), 0, 1); + L_sq_DrawCode("战斗力:", X + 70, Y + 93, sq_RGBA(134, 120, 79, 255), 0, 1); + L_sq_DrawCode(Combat, X + 170 - LenheartTextClass.GetStringLength(Combat) / 2, Y + 93, sq_RGBA(74, 162, 86, 255), 0, 1); + L_sq_DrawCode("通关超时空攻坚战" + ClearanceCount + "次", X + 130 - LenheartTextClass.GetStringLength("通关超时空攻坚战" + ClearanceCount + "次") / 2, Y + 144, sq_RGBA(221, 213, 147, 255), 0, 1); + L_sq_DrawCode("申请加入攻坚队。", X + 87, Y + 160, sq_RGBA(160, 132, 75, 255), 0, 1); + L_sq_DrawCode("请确定是否同意?", X + 87, Y + 176, sq_RGBA(160, 132, 75, 255), 0, 1); + + L_sq_DrawWindow(X + 77, Y + 216, 100, 20, "interface/lenheartwindowcommon.img", 204, 4, 14, 4, 14); + //绘制页数 + local Str = (NowSelectJoinIndex + 1) + " / " + RequestJoinTeamArr.len(); + L_sq_DrawCode(Str, X + 137 - LenheartTextClass.GetStringLength(Str) / 2, Y + 222, sq_RGBA(134, 120, 79, 255), 0, 1); + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + } +} \ No newline at end of file diff --git a/Project/Anton/Rindro_Anton_PartyFormation.nut b/Project/Anton/Rindro_Anton_PartyFormation.nut new file mode 100644 index 0000000..32e4e15 --- /dev/null +++ b/Project/Anton/Rindro_Anton_PartyFormation.nut @@ -0,0 +1,121 @@ +/* +文件名:Rindro_Anton_PartyFormation.nut +路径:Plugins/New_Anton/Rindro_Anton_PartyFormation.nut +创建日期:2024-07-16 16:22 +文件用途:安图恩 队内编队 +*/ +//编队用按钮需要传递参数所以重写 +class Rindro_AntonPartyInfoEdit_BaseButton extends LenheartNewUI_BaseButton { + MyInfoIndex = 0; + constructor(X, Y, W, H, Path, Idx, InfoIndex) { + MyInfoIndex = InfoIndex; + LenheartNewUI_BaseButton.constructor(X, Y, W, H, Path, Idx); + } + + //鼠标左键弹起回调 + function OnMouseLbUp(MousePos_X, MousePos_Y) { + if (isLBDown && OnClick) { + OnClick(MyInfoIndex); + } + isLBDown = false; + } +} +//编队窗口 +class Rindro_AntonPartyFormation extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + Visible = false; + + PartyMarkFlag = -1; + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + } + + + function RegisterWidget() { + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(278, 0, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + CloseWindow(); + }.bindenv(this); + AddChild(CloseButton); + + //搜索按钮 + local QdButton = LenheartNewUI_ButtonText(10, 157, 5, "签到"); + QdButton.State = 8; + QdButton.SetTextOffset(0, 1); + AddChild(QdButton); + + //解散队伍按钮 + local BreakPartyButton = LenheartNewUI_ButtonText(80, 158, 5, "解散队伍"); + BreakPartyButton.SetTextOffset(-12, 1); + BreakPartyButton.OnClick = function() { + PartyMarkFlag = 99; + }.bindenv(this); + AddChild(BreakPartyButton); + + //关闭按钮 + local CloseButton = LenheartNewUI_ButtonText(150, 158, 5, "关闭"); + CloseButton.SetTextOffset(0, 1); + CloseButton.OnClick = function() { + CloseWindow(); + }.bindenv(this); + AddChild(CloseButton); + + for (local i = 0; i< 8; i++) { + //右翻页按钮 + local PartyIndexButton = Rindro_AntonPartyInfoEdit_BaseButton(12 + (i % 2 * 136), 35 + ((i / 2) * 30), 41, 17, "interface/newstyle/windows/party/party_icon.img", 3 + (i * 3), i); + //继承类 并重写 调用时传入InfoIndex + PartyIndexButton.OnClick = function(MyInfoIndex) { + PartyMarkFlag = MyInfoIndex; + }.bindenv(this); + AddChild(PartyIndexButton); + } + } + + //绘制主界面 + function DrawMain(obj) { + //标题栏 + L_sq_DrawButton(X - 1, Y, 284, "interface/lenheartwindowcommon.img", 609, 2, 7); + //Item信息框一般为211的宽度 + L_sq_DrawWindow(X, Y + 17, 272, 154, "interface/lenheartwindowcommon.img", 213, 12, 2, 13, 2); + + for (local q = 0; q< 8; q++) { + L_sq_DrawImg("interface/lenheartwindowcommon.img", 358, X + 60 + (q % 2 * 136), Y + 34 + ((q / 2) * 30)); + for (local i = 0; i< 3; i++) { + L_sq_DrawImg("interface/lenheartwindowcommon.img", 361, X + 80 + (q % 2 * 136) + (i * 20), Y + 34 + ((q / 2) * 30)); + } + } + + if (PartyMarkFlag != -1) { + L_sq_WA(0x1b46898, 47); + } + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + + } + + //鼠标左键弹起回调 + function OnMouseLbUp(MousePos_X, MousePos_Y) { + //还原编队的鼠标指针 + if (this.PartyMarkFlag != -1) { + this.PartyMarkFlag = -1; + L_sq_WA(0x1b46898, 0); + } + LenheartNewUI_Windows.OnMouseLbUp(MousePos_X, MousePos_Y); + } +} \ No newline at end of file diff --git a/Project/Anton/Rindro_Anton_PartyHall.nut b/Project/Anton/Rindro_Anton_PartyHall.nut new file mode 100644 index 0000000..20fffa2 --- /dev/null +++ b/Project/Anton/Rindro_Anton_PartyHall.nut @@ -0,0 +1,350 @@ +/* +文件名:Rindro_Anton_PartyHall.nut +路径:Plugins/New_Anton/Rindro_Anton_PartyHall.nut +创建日期:2024-07-15 16:50 +文件用途:安图恩组队大厅 +*/ +class Rindro_Anton_PartyHallC extends LenheartNewUI_Windows { + + Visible = false; + //调试模式 + // DeBugMode = true; + + + //页数 + Page = 0; + //一页放多少个队伍 + PageMaxCount = 13; + //攻坚队List + PartyList = null; + + + + //获取所有队伍 + function GetAllTeamCall() { + local Jso = { + op = 20064011 + } + SendPack(Jso); + } + + //获取所有队伍收包 + function GetAllTeamCallCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + + //清除原来的List PartyList可以直接清除 但是Childrens中的窗口需要调用底层方法清除队伍类 + PartyList = []; + + RemoveAllParty(); + //遍历包构造攻坚队UI对象 + foreach(TeamsSimple in Jso.TeamSimList) { + local RealState = 0; + if (TeamsSimple.State == 1) RealState = 1; + else if (TeamsSimple.State == 2) RealState = 0; + else if (TeamsSimple.State == 3) RealState = 2; + else if (TeamsSimple.State == 4) RealState = 3; + local T = { + TeamId = TeamsSimple.TeamId.tostring(), + TeamName = TeamsSimple.TeamName, + TeamPlayerCount = TeamsSimple.TeamPlayerCount, + State = RealState + } + local TeamBuf = Rindro_AntonPartyC(T); + AddChild(TeamBuf); + PartyList.append(TeamBuf); + } + //收到刷新队伍列表包时需要将队伍窗口关闭 //TODO + // if ("Close" in Jso) LenheartNewUI_DestoryWindow("超时空我的队伍窗口"); + } + + + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + + PartyList = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + + Pack_Control.rawset(20064002, GetAllTeamCallCallBack.bindenv(this)); + + + GetAllTeamCall(); + } + + + OnlyPreparingBtn = null; + OnlyPreparingFlag = 1; + InputObject = null; + + function RegisterWidget() { + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(457, 0, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + CloseWindow(); + }.bindenv(this); + AddChild(CloseButton); + + + //我的频道复选框 + local MyChannelBtn = LenheartNewUI_SwitchButtonText(16, 30, "我的频道"); + MyChannelBtn.State = 1; + MyChannelBtn.ImgIndex = 358; + MyChannelBtn.SetTextPos(12, 2); + MyChannelBtn.Width = 76; + MyChannelBtn.Height = 16; + AddChild(MyChannelBtn); + + //只查看招募中的攻坚队 + OnlyPreparingBtn = LenheartNewUI_SwitchButtonText(110, 30, "只查看招募中的攻坚队"); + OnlyPreparingBtn.ImgIndex = 358; + OnlyPreparingBtn.SetTextPos(12, 2); + OnlyPreparingBtn.Width = 76; + OnlyPreparingBtn.Height = 16; + OnlyPreparingBtn.OnClick = function() { + switch (OnlyPreparingFlag) { + case 0: + OnlyPreparingFlag = 1; + break; + case 1: + OnlyPreparingFlag = 0; + break; + } + OnlyPreparingBtn.State = OnlyPreparingFlag; + }.bindenv(this); + AddChild(OnlyPreparingBtn); + + //搜索队伍输入框 + InputObject = LenheartNewUI_BaseInput(260, 31, 80, 20); + AddChild(InputObject); + + //搜索按钮 + local FindButton = LenheartNewUI_ButtonText(348, 28, 5, "搜索"); + FindButton.SetTextOffset(0, 1); + FindButton.OnClick = function() { + if (InputObject.str.len() > 0) { + + } + }.bindenv(this); + AddChild(FindButton); + + //重置按钮 + local ResetButton = LenheartNewUI_ButtonText(408, 28, 5, "重置"); + ResetButton.SetTextOffset(0, 1); + ResetButton.OnClick = function() { + InputObject.str = ""; + }.bindenv(this); + AddChild(ResetButton); + + //编号按钮 + local ModelButton = LenheartNewUI_ButtonText(9, 56, -18, "编号"); + ModelButton.Idx = 163; + ModelButton.DWidth = -8; + ModelButton.SetTextOffset(-9, 1); + AddChild(ModelButton); + + //状态按钮 + local StateButton = LenheartNewUI_ButtonText(51, 56, -18, "状态"); + StateButton.Idx = 163; + StateButton.DWidth = -8; + StateButton.SetTextOffset(-9, 1); + AddChild(StateButton); + + //频道按钮 + local ChannelButton = LenheartNewUI_ButtonText(93, 56, -18, "频道"); + ChannelButton.Idx = 163; + ChannelButton.DWidth = -8; + ChannelButton.SetTextOffset(-9, 1); + AddChild(ChannelButton); + + //攻坚队名称按钮 + local PartyNameButton = LenheartNewUI_ButtonText(135, 56, 100, "攻坚队名称"); + PartyNameButton.Idx = 163; + PartyNameButton.DWidth = 223; + PartyNameButton.FillWidth = 1; + PartyNameButton.FirstWidth = 21; + PartyNameButton.SetTextOffset(26, 1); + AddChild(PartyNameButton); + + //阶段按钮 + local StageButton = LenheartNewUI_ButtonText(289, 56, 52, "阶段"); + StageButton.Idx = 163; + StageButton.DWidth = 140; + StageButton.FillWidth = 1; + StageButton.FirstWidth = 21; + StageButton.SetTextOffset(26, 1); + AddChild(StageButton); + + //队员数量按钮 + local TeammembersButton = LenheartNewUI_ButtonText(402, 56, 50, "队员数量"); + TeammembersButton.Idx = 163; + TeammembersButton.FillWidth = 1; + TeammembersButton.FirstWidth = 21; + TeammembersButton.DWidth = 47; + TeammembersButton.SetTextOffset(-8, 1); + AddChild(TeammembersButton); + + //创建攻坚队按钮 + local MyPartyButton = LenheartNewUI_ButtonText(15, 395, 30, "创建攻坚队"); + MyPartyButton.SetTextOffset(-6, 1); + MyPartyButton.OnClick = function() { + //有队伍则查看队伍信息 + if (RinDro_Anton_Obj.MyRaidTeamId) { + //发送查看攻坚队具体信息包 + local T = { + op = 20064013, + teamsId = RinDro_Anton_Obj.MyRaidTeamId + } + SendPackEx(T); + } + //否则创建队伍 + else { + local Win = LenheartNewUI_CreateWindow(Rindro_AntonCreatePartyC, "安图恩创建队伍窗口", 290, 220, 284, 154, 18); + Win.Visible = true; + Win.ResetFocus(); + } + }.bindenv(this); + //设置动态回调改变按钮名称 + MyPartyButton.SetCallBackFunc(function(window) { + if (RinDro_Anton_Obj.MyRaidTeamId) window.TextStr = "我的攻坚队"; + else window.TextStr = "创建攻坚队"; + }.bindenv(this)); + + AddChild(MyPartyButton); + + //左翻页按钮 + local LeftButton = LenheartNewUI_BaseButton(160, 400, 15, 15, "interface/lenheartwindowcommon.img", 34); + LeftButton.OnClick = function() { + if (Page > 0) Page--; + }.bindenv(this); + AddChild(LeftButton); + + //右翻页按钮 + local RightButton = LenheartNewUI_BaseButton(220, 400, 15, 15, "interface/lenheartwindowcommon.img", 38); + RightButton.OnClick = function() { + if (Page<(((PartyList.len() / PageMaxCount)))) Page++; + }.bindenv(this); + AddChild(RightButton); + + //进入待机按钮 + local FQButton = LenheartNewUI_ButtonText(300, 394, 20, "进入待机"); + FQButton.SetTextOffset(-5, 2); + FQButton.State = 8; + AddChild(FQButton); + + //刷新按钮 + local RefreshButton = LenheartNewUI_BaseButton(410, 395, 25, 25, "interface/lenheartwindowcommon.img", 366); + RefreshButton.OnClick = function() { + GetAllTeamCall(); + }.bindenv(this); + AddChild(RefreshButton); + + //设置按钮 + local SettingButton = LenheartNewUI_BaseButton(440, 394, 15, 15, "interface/lenheartwindowcommon.img", 362); + SettingButton.State = 8; + AddChild(SettingButton); + } + + //绘制主界面 + function DrawMain(obj) { + //Item信息框一般为211的宽度 + L_sq_DrawWindow(X, Y + 10, 540 * 0.85, 420 * 0.9, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); + + L_sq_DrawWindow(X + 6, Y + 19, 528 * 0.85, 47, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); + + //绘制背景框标题栏 + L_sq_DrawImg("hud/rindroanton.img", 3, X + 1, Y); + + L_sq_DrawCode("寻找攻坚队", X + 217, Y + 3, sq_RGBA(179, 169, 135, 255), 0, 1); + + //绘制队伍List + DrawPartyList(obj); + + L_sq_DrawWindow(X + 6, Y + 382, 528 * 0.85, 24, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); + + //计算页数 + local PageStr = Page + 1 + " / " + ((PartyList.len() / PageMaxCount) + 1); + //绘制当前页数 + L_sq_DrawCode(PageStr, X + 166 + LenheartTextClass.GetStringLength(PageStr) / 2, Y + 402, sq_RGBA(134, 120, 79, 255), 0, 1); + } + + //重置所有选中 + function ResetAllSelect() { + foreach(Index, TeamObj in PartyList) { + TeamObj.SelectState = false; + } + } + + //移除队伍 + function RemoveParty(TeamId) { + local ObjectID = null; + for (local i = 0; i< Childrens.len(); i++) { + local Cobj = Childrens[i]; + if (Cobj instanceof Rindro_AntonPartyC) { + if (Cobj.TeamObj.TeamId.tointeger() == TeamId.tointeger()) { + ObjectID = Cobj.ObjectId; + } + } + } + if (ObjectID) RemoveChild(ObjectID); + } + + //移除所有队伍 + function RemoveAllParty() { + for (local i = 0; i< Childrens.len(); i++) { + local Cobj = Childrens[i]; + if (Cobj instanceof Rindro_AntonPartyC) { + Childrens.remove(i); + i--; + } + } + } + + //绘制队伍信息 + function DrawPartyList(obj) { + if (PartyList.len() <= 0) return; + //先遍历一遍全部挪走 + foreach(Index, TeamObj in PartyList) { + TeamObj.SyncPos(9999, 9999); + } + //在遍历需要显示的同步坐标 + foreach(Index, TeamObj in PartyList.slice((((Page) * PageMaxCount) > 0) ? ((Page) * PageMaxCount) : 0, ((Page + 1) * PageMaxCount) > PartyList.len() ? PartyList.len() : ((Page + 1) * PageMaxCount))) { + TeamObj.SyncPos(X, Y + 2 + (Index % PageMaxCount) * 23); + } + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + + } + + MainButton = null; + //逻辑入口 + function Proc(obj) { + + + //界面未打开 + if (!this.Visible && L_sq_RA(0x1A5FB4C, "0x14+0x28+")< 2) { + //在甲板 + if (RinDro_Anton_Obj.BaseConfig && RinDro_Anton_Obj.BaseConfig.channel_index.find("18") && L_sq_GetTownIndex() == RinDro_Anton_Obj.BaseConfig.town_index && L_sq_GetRegionIndex() >= 1) { + local PaW = sq_GetPopupWindowMainCotrol(6); + if (PaW) { + L_sq_UseSkill(DIK_ESCAPE); + this.Visible = true; + GetAllTeamCall(); + } + } + } + + + + + + LenheartNewUI_Windows.SyncPos(X, Y); + } + +} \ No newline at end of file diff --git a/Project/Anton/Rindro_Anton_PartyInfo.nut b/Project/Anton/Rindro_Anton_PartyInfo.nut new file mode 100644 index 0000000..1a5f14b --- /dev/null +++ b/Project/Anton/Rindro_Anton_PartyInfo.nut @@ -0,0 +1,311 @@ +/* +文件名:Rindro_Anton_PartyInfo.nut +路径:Plugins/New_Anton/Rindro_Anton_PartyInfo.nut +创建日期:2024-07-15 22:12 +文件用途:安图恩队伍信息窗口 +*/ +class Rindro_AntonPartyInfoC extends LenheartNewUI_Windows { + + Visible = false; + //调试模式 + // DeBugMode = true; + + //是否存在信息 + InfoFlag = false; + + //队员列表 + MembersList = null; + + //队伍名称 + TeamName = ""; + //队伍ID + TeamID = 99999999; + + //是否是我的攻坚队 + IsMyTeam = false; + //是否是队长 + IsCaptain = false; + + + + //收到请求加入攻坚队包 + function JoinTeamCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + local win = LenheartNewUI_CreateWindow(Rindro_AntonApplyJoinC, "安图恩申请加入队伍窗口", 542, 348, 257, 240, 18); + win.Visible = true; + win.ResetFocus(); + local T = { + Charc = Jso.charac, //角色对象 + Level = Jso.charac.PlayerLevel, + Name = Jso.charac.PlayerName, + Job = Jso.charac.PlayerJob, + PvpLevel = Jso.charac.pvp, + JobName = Jso.charac.PlayerGrowTypeJob, + Coin = Jso.charac.PlayCoin, + Fatigue = Jso.charac.PlayFatigue, + Combat = Jso.charac.ZL, + ClearanceCount = Jso.charac.ClearanceCount, + AvatarArr = Jso.charac.equVos, + PlayerSession = Jso.charac.PlayerSession + } + //没人 + if (win.RequestJoinTeamArr.len() == 0) { + win.RequestJoinTeamArr.append(T); + win.InitInfo(); + } else win.RequestJoinTeamArr.append(T); + } + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + //注册控件 + // RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + + Pack_Control.rawset(20064006, JoinTeamCallBack.bindenv(this)); + + RegisterWidget(); + } + + function RegisterWidget() { + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(336, 0, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + CloseWindow(); + }.bindenv(this); + AddChild(CloseButton); + + + //队伍按钮 + local ModelButton = LenheartNewUI_ButtonText(9, 60, -18, "队伍"); + ModelButton.Idx = 163; + ModelButton.DWidth = -8; + ModelButton.SetTextOffset(-9, 1); + AddChild(ModelButton); + + //等级按钮 + local StateButton = LenheartNewUI_ButtonText(51, 60, -18, "等级"); + StateButton.Idx = 163; + StateButton.DWidth = -8; + StateButton.SetTextOffset(-9, 1); + AddChild(StateButton); + + //角色名按钮 + local ChannelButton = LenheartNewUI_ButtonText(93, 60, 44, "角色名"); + ChannelButton.Idx = 163; + ChannelButton.DWidth = 120; + ChannelButton.FillWidth = 1; + ChannelButton.FirstWidth = 21; + ChannelButton.SetTextOffset(17, 1); + AddChild(ChannelButton); + + //攻坚队名称按钮 + local PartyNameButton = LenheartNewUI_ButtonText(196, 60, 36, "职业名"); + PartyNameButton.Idx = 163; + PartyNameButton.DWidth = 100; + PartyNameButton.FillWidth = 1; + PartyNameButton.FirstWidth = 21; + PartyNameButton.SetTextOffset(11, 1); + AddChild(PartyNameButton); + + //入场材料按钮 + local StageButton = LenheartNewUI_ButtonText(289, 60, 0, "入场材料"); + StageButton.Idx = 163; + StageButton.DWidth = 26; + StageButton.FillWidth = 1; + StageButton.FirstWidth = 21; + StageButton.SetTextOffset(-14, 1); + StageButton.SetCallBackFunc(function(window) { + if (RinDro_Anton_Obj.EndTime) window.TextStr = "通关次数"; + else window.TextStr = "入场材料"; + }.bindenv(this)); + AddChild(StageButton); + + //如果不是我的队伍 并且我没有攻坚队 + local JoinPartyButton = LenheartNewUI_ButtonText(10, 268 + 275, 10, "参加攻坚队"); + JoinPartyButton.SetTextOffset(-15, 1); + JoinPartyButton.OnClick = function() { + + //时装 帽子 头部 脸 上衣 下装 鞋子 胸部 腰部 皮肤 光环 + local AvatarInfoIdx = [0x3038, 0x3010, 0x3014, 0x3018, 0x301c, 0x3020, 0x3024, 0x3028, 0x302c, 0x3030, 0x3034]; + + local C_Object = L_sq_RA(0x1ab7cdc); + local avataritemsbuf = []; + foreach(offset in AvatarInfoIdx) { + local AvatarEquiAddress = L_sq_RA(C_Object + offset); + if (AvatarEquiAddress >= 0x400000) { + local Ab = []; + local NormalIndex = L_sq_RA(AvatarEquiAddress + 0x1c); + local ExIndex = L_sq_RA(AvatarEquiAddress + 0x13E0); + Ab.append(NormalIndex); + Ab.append(ExIndex); + avataritemsbuf.append(Ab); + } else { + local Ab = []; + Ab.append(0); + Ab.append(0); + avataritemsbuf.append(Ab); + } + } + + local T = { + op = 20064005, + teamsId = TeamID, + items = avataritemsbuf, + } + SendPackEx(T); + + }.bindenv(this); + JoinPartyButton.SetCallBackFunc(function(window) { + if (!IsMyTeam && !RinDro_Anton_Obj.MyRaidTeamId) + window.X = 10; + else window.X = 90000; + }.bindenv(this)); + AddChild(JoinPartyButton); + + //如果是我的队伍 + //退出按钮 + local ExitButton = LenheartNewUI_ButtonText(220, 268 + 275, 5, "退出"); + ExitButton.SetTextOffset(-1, 1); + ExitButton.OnClick = function() { + local T = { + op = 20064009, + teamsId = TeamID + } + SendPackEx(T); + RinDro_Anton_Obj.MyCid = null; + RinDro_Anton_Obj.MyRaidTeamId = null; + RinDro_Anton_Obj.IsCaptain = null; + + //重置所有选中 并且从攻坚大厅对象中移除这个子对象 + local HallWin = LenheartNewUI_CreateWindow(Rindro_Anton_PartyHallC, "新安图恩攻坚大厅窗口", 320, 40, 478, 434, 18); + HallWin.ResetAllSelect(); + HallWin.RemoveParty(this.TeamID); + DestroyWindow(); + }.bindenv(this); + ExitButton.SetCallBackFunc(function(window) { + if (!IsMyTeam) window.X = X + 900000; + else window.X = X + 220; + }.bindenv(this)); + AddChild(ExitButton); + + + //队伍编制按钮 + local PartyEditButton = LenheartNewUI_ButtonText(10, 268 + 275, 5, "队伍编制"); + PartyEditButton.SetTextOffset(-12, 1); + PartyEditButton.OnClick = function() { + local win = LenheartNewUI_CreateWindow(Rindro_AntonPartyFormation, "安图恩我的队伍编队窗口", 105, 40, 294, 192, 18); + win.Visible = true; + win.ResetFocus(); + }.bindenv(this); + PartyEditButton.SetCallBackFunc(function(window) { + if (!IsMyTeam || !IsCaptain) window.X = X + 900000; + else window.X = X + 10; + }.bindenv(this)); + AddChild(PartyEditButton); + + //修改信息按钮 + local FqButton = LenheartNewUI_ButtonText(100, 267 + 275, 5, "修改信息"); + FqButton.State = 8; + FqButton.SetTextOffset(-12, 1); + FqButton.SetCallBackFunc(function(window) { + if (!IsMyTeam || !IsCaptain) window.X = X + 900000; + else window.X = X + 100; + }.bindenv(this)); + AddChild(FqButton); + + //队伍招募按钮 + local FqButton1 = LenheartNewUI_ButtonText(160, 267 + 275, 5, "队伍招募"); + FqButton1.State = 8; + FqButton1.SetTextOffset(-12, 1); + FqButton1.SetCallBackFunc(function(window) { + if (!IsMyTeam || !IsCaptain) window.X = X + 900000; + else window.X = X + 160; + }.bindenv(this)); + AddChild(FqButton1); + + + //队伍招募按钮 + local FightOpenButton = LenheartNewUI_ButtonText(290, 268 + 275, 5, "开始攻坚"); + FightOpenButton.SetTextOffset(-12, 1); + FightOpenButton.OnClick = function() { + local T = { + op = 20064051, + teamsId = TeamID + } + SendPackEx(T); + }.bindenv(this); + FightOpenButton.SetCallBackFunc(function(window) { + // if (!IsMyTeam || !IsCaptain || RinDro_Anton_Obj.EndTime) window.X = X + 900000; + // else window.X = X + 290; + if ((RinDro_Anton_Obj.MyRaidState == 0 || RinDro_Anton_Obj.MyRaidState == 2) && IsCaptain && IsMyTeam) window.X = X + 290; + else window.X = X + 900000; + }.bindenv(this)); + AddChild(FightOpenButton); + } + + + //绘制主界面 + function DrawMain(obj) { + //如果没有信息则直接返回不绘制 + if (!InfoFlag) return; + //标题栏 + L_sq_DrawButton(X, Y, 344, "interface/lenheartwindowcommon.img", 609, 2, 7); + //绘制队伍名字 + L_sq_DrawCode(TeamName, X + 178 - LenheartTextClass.GetStringLength(TeamName) / 2, Y + 5, sq_RGBA(134, 120, 79, 255), 0, 1); + + //Item信息框一般为211的宽度 + L_sq_DrawWindow(X, Y + 17, 340, 502, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); + //绘制头图 + L_sq_DrawImg("interface2/gcontents/180621_fiendwar/raid/memberwindow.img", 0, X + 10, Y + 24); + //绘制阶段图 //TODO 根据阶段绘制img + L_sq_DrawImg("hud/rindroanton.img", 7, X + 296, Y + 34); + + //绘制队伍List + DrawMembersList(obj); + } + + //绘制队伍信息 + function DrawMembersList(obj) { + if (MembersList.len() <= 0) return; + //遍历需要显示的同步坐标 + foreach(Index, TeamObj in MembersList) { + TeamObj.SyncPos(X, Y + 2 + Index * 23); + } + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + } + + + + /* + # override # " + * @函数作用: + * @参数 name + * @返回值 + */ + //鼠标左键弹起回调 + function OnMouseLbUp(MousePos_X, MousePos_Y) { + foreach(Window in Childrens) { + Window.OnMouseLbUp(MousePos_X, MousePos_Y); + } + LenheartNewUI_Windows.OnMouseLbUp(MousePos_X, MousePos_Y); + //判断没有点到具体角色就隐藏 + if (!sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y + 80, Width, MembersList.len() * 21)) { + //交互窗口需要隐藏 + local Each = LenheartNewUI_CreateWindow(Rindro_AntonPlayerInteractiveC, "安图恩玩家交互", X, Y, 100, 21, 0); + Each.Visible = false; + } + + } +} \ No newline at end of file diff --git a/Project/Anton/Rindro_Anton_PartyMemberInfo.nut b/Project/Anton/Rindro_Anton_PartyMemberInfo.nut new file mode 100644 index 0000000..4e19ce4 --- /dev/null +++ b/Project/Anton/Rindro_Anton_PartyMemberInfo.nut @@ -0,0 +1,192 @@ +/* +文件名:Rindro_Anton_PartyMemberInfo.nut +路径:Plugins/New_Anton/Rindro_Anton_PartyMemberInfo.nut +创建日期:2024-07-15 22:52 +文件用途:安图恩队伍横条 +*/ +//队员显示类 +class Rindro_AntonPartyInfoMemberC extends LenheartNewUI_CommonUi { + X = 0; + Y = 0; + Width = null; + Height = null; + InfoObj = null; + + //构造时间 + ConstructorTime = null; + //选中状态 + SelectState = false; + //攻坚状态 + OffensiveState = 0; + //头像框的颜色 + HandBoxColor = [ + 0xff717272, + 0xff7b2a29, + 0xff874e0d, + 0xff8b8108, + 0xff658e2d, + 0xff0f5c8a, + 0xff27238f, + 0xff4e2491, + 0xff932586, + ] + + //X Y 裁切开始X Y 裁切结束X Y + OffsetArr = [ + //男鬼剑士 + [56, 112, 220, 222], + //女格斗家 + [54, 103, 240, 278], + //男神枪手 + [55, 130, 236, 246], + //女魔法师 + [57, 88, 234, 291], + //男圣职者 + [57, 124, 208, 190], + //女神枪手 + [56, 119, 226, 209], + //暗夜使者 + [56, 117, 225, 212], + //男格斗家 + [56, 118, 233, 212], + //男魔法师 + [54, 103, 236, 276], + //黑暗武士 + [56, 112, 220, 222], + //缔造者 + [57, 88, 234, 291], + ] + + constructor(gInfoObj) { + ConstructorTime = Clock(); + + InfoObj = gInfoObj; + this.Width = 458; + this.Height = 21; + + this.OnClick = function() { + //还原其他 选中自己 + foreach(Obj in Parent.MembersList) { + Obj.SelectState = false; + } + SelectState = !SelectState; + + local win = LenheartNewUI_CreateWindow(Rindro_AntonPartyFormation, "安图恩我的队伍编队窗口", 105, 40, 294, 192, 18); + //编队状态 + if (win.PartyMarkFlag != -1) { + //并且是属于我的攻坚队的成员 + if (RinDro_Anton_Obj.MyRaidTeamId == InfoObj.PartyId) { + local gnum = win.PartyMarkFlag + 1; + if (gnum == 100) gnum = 0; + local T = { + op = 20064015, + teamsId = InfoObj.PartyId, + cidNew = InfoObj.Cid, + num = gnum + } + SendPackEx(T); + win.PartyMarkFlag = -1; + L_sq_WA(0x1b46898, 0); + win.ResetFocus(); + return; + } + //点了其他队伍成员要还原编队状态 + else { + win.PartyMarkFlag = -1; + L_sq_WA(0x1b46898, 0); + } + } + + local Interactive = LenheartNewUI_CreateWindow(Rindro_AntonPlayerInteractiveC, "安图恩玩家交互", 0, 0, 100, 21, 0); + //改变鼠标坐标 + Interactive.X = MousePos_X; + Interactive.Y = MousePos_Y; + //赋值对象参数 + Interactive.InfoObj = InfoObj; + //对象不是我 + if (InfoObj.Cid == RinDro_Anton_Obj.MyCid) { + Interactive.InfoObj.IsMyself <- true; + } + //刷新UI + Interactive.InitInfo(); + } + LenheartNewUI_CommonUi.constructor(10, 82, this.Width, this.Height); + + + //如果没有材料要建立一个购买材料的Button 并且要判断是否是自己 //TODO 这里还不行 要拓展一个函数来比对名字 + /* + local Name = L_Sq_GetObjectName(sq_GetMyMasterCharacter()); + local Name2 = "夜刃"; + Name == Name2 失败了 + */ + // if (!InfoObj.StkHasFlag && InfoObj.Name == L_Sq_GetObjectName(sq_GetMyMasterCharacter())) { + + // } + } + + function Show(obj) { + // print(this); + //绘制底槽 + L_sq_DrawImg("hud/rindroanton.img", 12, X, Y); + + + //绘制队伍编号 + L_sq_DrawImg("interface/newstyle/windows/party/party_icon.img", InfoObj.TeamId * 3, X, Y + 1); + + sq_DrawBox(X + 42, Y + 1, 22, 18, HandBoxColor[InfoObj.TeamId]); + //绘制队长头像 + foreach(AvatarObj in InfoObj.EquVos) { + local AXpos = AvatarObj.F[0][2] + X + OffsetArr[InfoObj.Job][0]; + local AYpos = AvatarObj.F[0][3] + Y + OffsetArr[InfoObj.Job][1]; + setClip(AXpos + OffsetArr[InfoObj.Job][2], AYpos + OffsetArr[InfoObj.Job][3], AXpos + OffsetArr[InfoObj.Job][2] + 22, AYpos + OffsetArr[InfoObj.Job][3] + 18); //开始裁切 + L_sq_DrawImg("character/" + AvatarObj.B + ".img", AvatarObj.F[0][0], AXpos, AYpos); + releaseClip(); //裁切结束 + } + + if (InfoObj.Captain) L_sq_DrawImg("hud/rindroanton.img", 18, X + 42, Y + 1); + + + //绘制等级 + L_sq_DrawCode(InfoObj.Level, X + 76 - LenheartTextClass.GetStringLength(InfoObj.Level) / 2, Y + 5, sq_RGBA(134, 120, 79, 255), 0, 1); + //绘制角色名 + L_sq_DrawCode(InfoObj.Name, X + 138 - LenheartTextClass.GetStringLength(InfoObj.Name) / 2, Y + 5, sq_RGBA(134, 120, 79, 255), 0, 1); + //绘制职业名 + L_sq_DrawCode(InfoObj.JobName, X + 234 - LenheartTextClass.GetStringLength(InfoObj.JobName) / 2, Y + 5, sq_RGBA(134, 120, 79, 255), 0, 1); + + + //离线了 + if (InfoObj.ExitTime > 0) { + local DrawTime = InfoObj.ExitTime - (Clock() - ConstructorTime); + local seconds = (DrawTime / 1000) % 60; // 计算秒数 + local minutes = (DrawTime / (1000 * 60)) % 60; // 计算分钟数 + local DrawTimeStr = format("%02d分%02d秒", minutes, seconds); + + L_sq_DrawCode(DrawTimeStr, X + 306 - LenheartTextClass.GetStringLength(DrawTimeStr) / 2, Y + 5, sq_RGBA(255, 50, 50, 255), 0, 1); + } + //通关次数 + else if (InfoObj.ClearanceCount > 0) { + L_sq_DrawCode((InfoObj.ClearanceCount - 1) + "/" + (InfoObj.ClearanceCountMax), X + 306 - LenheartTextClass.GetStringLength((InfoObj.ClearanceCount - 1) + "/" + (InfoObj.ClearanceCountMax)) / 2, Y + 5, sq_RGBA(250, 250, 181, 255), 0, 1); + } else if (InfoObj.StkHasFlag) { + L_sq_DrawImg("hud/rindroantonstk.img", 0, X + 280, Y + 3); + } else { + L_sq_DrawImg("hud/rindroantonstk.img", 1, X + 280, Y + 3); + } + + if (SelectState) { + L_sq_DrawImg("hud/rindroanton.img", 13, X, Y); + } + + if (isInRect) { + L_sq_DrawImg("hud/rindroanton.img", 13, X, Y); + } + } + + MousePos_X = 0; + MousePos_Y = 0; + //鼠标事件回调 + function OnMouseProc(Flag, gMousePos_X, gMousePos_Y) { + this.MousePos_X = gMousePos_X; + this.MousePos_Y = gMousePos_Y; + LenheartNewUI_CommonUi.OnMouseProc(Flag, gMousePos_X, gMousePos_Y); + } +} \ No newline at end of file diff --git a/Project/Anton/Rindro_Anton_PlayerInteractive.nut b/Project/Anton/Rindro_Anton_PlayerInteractive.nut new file mode 100644 index 0000000..0ed0728 --- /dev/null +++ b/Project/Anton/Rindro_Anton_PlayerInteractive.nut @@ -0,0 +1,227 @@ +/* +文件名:Rindro_Anton_PlayerInteractive.nut +路径:Plugins/New_Anton/Rindro_Anton_PlayerInteractive.nut +创建日期:2024-07-16 11:02 +文件用途:安图恩攻坚队玩家交互按钮 +*/ +//角色交互按钮需要传递参数所以重写 +class Rindro_AntonInteractive_BaseButton extends LenheartNewUI_BaseButton { + + OnShow = null; + + constructor(X, Y, W, H, Path, Idx) { + + LenheartNewUI_BaseButton.constructor(X, Y, W, H, Path, Idx); + } + + //鼠标左键弹起回调 + function OnMouseLbUp(MousePos_X, MousePos_Y) { + Y--; + if (isLBDown && OnClick) { + OnClick(); + } + isLBDown = false; + local Each = LenheartNewUI_CreateWindow(Rindro_AntonPlayerInteractiveC, "安图恩玩家交互", X, Y, 100, 21, 0); + Each.Visible = false; + } + + function Show(obj) { + //不可用 + if (State == 8) { + L_sq_DrawImg(Path, Idx + 3, X, Y + 1); + } else { + //按下 + if (isLBDown) { + Y++; + L_sq_DrawImg(Path, (Idx * 2) + 2, X, Y); + } + //悬停 + else if (isInRect) { + L_sq_DrawImg(Path, (Idx * 2) + 1, X, Y); + } + //普通 + else { + L_sq_DrawImg(Path, 0, X, Y); + } + } + if (OnShow) OnShow(X, Y); + } +} + +//角色交互类 +class Rindro_AntonPlayerInteractiveC extends LenheartNewUI_Windows { + // DeBugMode = true; + + //信息对象 + InfoObj = null; + + //初始化Flag 初始化以后才显示 + InitInfoFlag = false; + + //有多少个标签 + InitIndexFlag = 1; + + //头像框颜色 + HandBoxColor = [ + 0xff717272, + 0xff7b2a29, + 0xff874e0d, + 0xff8b8108, + 0xff658e2d, + 0xff0f5c8a, + 0xff27238f, + 0xff4e2491, + 0xff932586, + ] + + //X Y 裁切开始X Y 裁切结束X Y + OffsetArr = [ + //男鬼剑士 + [56, 112, 220, 222], + //女格斗家 + [54, 103, 240, 278], + //男神枪手 + [55, 130, 236, 246], + //女魔法师 + [57, 88, 234, 291], + //男圣职者 + [57, 124, 208, 190], + //女神枪手 + [56, 119, 226, 209], + //暗夜使者 + [56, 117, 225, 212], + //男格斗家 + [56, 118, 233, 212], + //男魔法师 + [54, 103, 236, 276], + //黑暗武士 + [56, 112, 220, 222], + //缔造者 + [57, 88, 234, 291], + ] + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + } + + //初始化信息 + function InitInfo() { + Childrens = []; + //还原标签数量 + InitIndexFlag = 1; + //还原高度 + Height = 21; + //还原可见性 + Visible = true; + //置顶窗口 + ResetFocus(); + RegisterWidget(); + InitInfoFlag = true; + } + + function RegisterWidget() { + + + //是团长才能委任 并且不是我自己 并且我们在同一个攻坚队 + if (RinDro_Anton_Obj.IsCaptain && !("IsMyself" in InfoObj) && RinDro_Anton_Obj.MyRaidTeamId == InfoObj.PartyId) { + //委任团长按钮 + local GiveMasterButton = Rindro_AntonInteractive_BaseButton(0, 0 + (InitIndexFlag * 21), 100, 21, "interface2/popup_menu/popup_back.img", 0); + GiveMasterButton.OnShow = function(X, Y) { + L_sq_DrawImg("interface2/popup_menu/popup_icon_character.img", 11, X, Y + 2); + L_sq_DrawCode("委任团长", X + 36, Y + 5, sq_RGBA(104, 213, 237, 255), 0, 1); + } + GiveMasterButton.OnClick = function() { + + }.bindenv(this); + AddChild(GiveMasterButton); + InitIndexFlag++; + Height += 21; + } + + //查看信息按钮 + local CheckInfoButton = Rindro_AntonInteractive_BaseButton(0, 0 + (InitIndexFlag * 21), 100, 21, "interface2/popup_menu/popup_back.img", 0); + CheckInfoButton.OnShow = function(X, Y) { + L_sq_DrawImg("interface2/popup_menu/popup_icon_character.img", 10, X, Y + 2); + L_sq_DrawCode("查看信息", X + 36, Y + 5, sq_RGBA(104, 213, 237, 255), 0, 1); + } + CheckInfoButton.OnClick = function() { + local obj = sq_GetMyMasterCharacter(); + //obj.sq_PlaySound("CLICK_BUTTON1"); + L_sq_SendPackType(8); + L_sq_SendPackWord(InfoObj.PlayerSession); + L_sq_SendPackByte(3); + L_sq_SendPack(); + getroottable().WindowsShowABFlag <- false; //让原生窗口置顶 + }.bindenv(this); + AddChild(CheckInfoButton); + InitIndexFlag++; + Height += 21; + + if (!("IsMyself" in InfoObj)) { + //交易按钮 + local TransactionButton = Rindro_AntonInteractive_BaseButton(0, 0 + (InitIndexFlag * 21), 100, 21, "interface2/popup_menu/popup_back.img", 0); + TransactionButton.OnShow = function(X, Y) { + L_sq_DrawImg("interface2/popup_menu/popup_icon_character.img", 0, X, Y + 2); + L_sq_DrawCode("交易", X + 46, Y + 5, sq_RGBA(104, 213, 237, 255), 0, 1); + } + TransactionButton.OnClick = function() { + local obj = sq_GetMyMasterCharacter(); + //obj.sq_PlaySound("CLICK_BUTTON1"); + L_sq_SendPackType(10); + L_sq_SendPackWord(InfoObj.PlayerSession); + L_sq_SendPackByte(1); + L_sq_SendPackDWord(22053); + L_sq_SendPack(); + getroottable().WindowsShowABFlag <- false; //让原生窗口置顶 + }.bindenv(this); + AddChild(TransactionButton); + InitIndexFlag++; + Height += 21; + + + if (RinDro_Anton_Obj.IsCaptain && RinDro_Anton_Obj.MyRaidTeamId == InfoObj.PartyId) { + //攻坚队员强退按钮 + local KickMemberButton = Rindro_AntonInteractive_BaseButton(0, 0 + (InitIndexFlag * 21), 100, 21, "interface2/popup_menu/popup_back.img", 4); + KickMemberButton.OnShow = function(X, Y) { + L_sq_DrawImg("interface2/popup_menu/popup_icon_warning.img", 3, X, Y + 2); + L_sq_DrawCode("攻坚队员强退", X + 24, Y + 5, sq_RGBA(255, 50, 50, 255), 0, 1); + } + KickMemberButton.OnClick = function() { + local obj = sq_GetMyMasterCharacter(); + //obj.sq_PlaySound("CLICK_BUTTON1"); + local T = { + op = 20064021, + teamsId = InfoObj.PartyId, + charCid = InfoObj.Cid + } + SendPackEx(T); + }.bindenv(this); + AddChild(KickMemberButton); + InitIndexFlag++; + Height += 21; + } + } + } + + function Show(obj) { + if (!InitInfoFlag) return; + L_sq_DrawImg("interface2/popup_menu/popup_back.img", 0, X, Y); + //绘制角色名 + L_sq_DrawCode(InfoObj.Name, X + 61 - LenheartTextClass.GetStringLength(InfoObj.Name) / 2, Y + 4, sq_RGBA(169, 255, 171, 255), 0, 1); + //绘制头像 + foreach(AvatarObj in InfoObj.EquVos) { + local AXpos = AvatarObj.F[0][2] + X + OffsetArr[InfoObj.Job][0] - 40; + local AYpos = AvatarObj.F[0][3] + Y + OffsetArr[InfoObj.Job][1]; + setClip(AXpos + OffsetArr[InfoObj.Job][2], AYpos + OffsetArr[InfoObj.Job][3], AXpos + OffsetArr[InfoObj.Job][2] + 22, AYpos + OffsetArr[InfoObj.Job][3] + 18); //开始裁切 + L_sq_DrawImg("character/" + AvatarObj.B + ".img", AvatarObj.F[0][0], AXpos, AYpos); + releaseClip(); //裁切结束 + } + + LenheartNewUI_Windows.Show(obj); + } + + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + } +} \ No newline at end of file diff --git a/Project/Anton/Rindro_Anton_Reward.nut b/Project/Anton/Rindro_Anton_Reward.nut new file mode 100644 index 0000000..78c26aa --- /dev/null +++ b/Project/Anton/Rindro_Anton_Reward.nut @@ -0,0 +1,533 @@ +/* +文件名:Rindro_Anton_Reward.nut +路径:Plugins/New_Anton/Rindro_Anton_Reward.nut +创建日期:2024-07-29 10:04 +文件用途:安图恩翻牌奖励 +*/ +class Rindro_Anton_RewardC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + NoWindow = true; + //奖励阶段 + Stage = 1; + + //小队奖励包 + PartyReward = null; + //团队奖励包 + TeamReward = null; + //死亡次数 + Deaths = 0; + //通关时间 + Time = 0; + //奖励动画开始时间 + AniStartFlag = null; + + //紫色闪光 + PurpleLight = null; + //粉色闪光 + PinkLight = null; + //金色闪光 + GoldenLight = null; + //彩色闪光 + RarityLight = null; + + ItemNameColor = [ + 0xffffffff, //白装 + 0xffedd568, //蓝装 + 0xffff6bb3, //紫装 + 0xfff000ff, //粉装 + 0xff0082ff, //传说 + 0xff00b1ff //史诗 + ] + + //X Y 裁切开始X Y 裁切结束X Y + OffsetArr = [ + //男鬼剑士 + [56, 112, 220, 222], + //女格斗家 + [54, 103, 240, 278], + //男神枪手 + [55, 130, 236, 246], + //女魔法师 + [57, 88, 234, 291], + //男圣职者 + [57, 124, 208, 190], + //女神枪手 + [56, 119, 226, 209], + //暗夜使者 + [56, 117, 225, 212], + //男格斗家 + [56, 118, 233, 212], + //男魔法师 + [54, 103, 236, 276], + //黑暗武士 + [56, 112, 220, 222], + //缔造者 + [57, 88, 234, 291], + ] + + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + PurpleLight = []; + PinkLight = []; + GoldenLight = []; + RarityLight = []; + + Childrens = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + local PurpleFrameArr = []; + for (local i = 0; i< 11; i++) { + local T = { + ImgIndex = i, + Delay = 60, + Pos = [0, 0] + } + PurpleFrameArr.append(T); + } + for (local i = 0; i< 24; i++) { + local PurpleLightBuf = Lenheart_Ani("", PurpleFrameArr, [0, 0]); + PurpleLightBuf.ImgPath = "common/commoneffect/itemdropeffect/rare_beam.img"; + PurpleLightBuf.LoopFlag = false; + PurpleLight.append(PurpleLightBuf); + } + + local PinkFrameArr = []; + for (local i = 0; i< 11; i++) { + local T = { + ImgIndex = i, + Delay = 60, + Pos = [0, 0] + } + PinkFrameArr.append(T); + } + for (local i = 0; i< 24; i++) { + local PinkLightBuf = Lenheart_Ani("", PinkFrameArr, [0, 0]); + PinkLightBuf.ImgPath = "common/commoneffect/itemdropeffect/unique_beam.img"; + PinkLightBuf.LoopFlag = false; + PinkLight.append(PinkLightBuf); + } + + local FrameArr = []; + for (local i = 0; i< 11; i++) { + local T = { + ImgIndex = i, + Delay = 60, + Pos = [0, 0] + } + FrameArr.append(T); + } + for (local i = 0; i< 24; i++) { + local GoldenLightBuf = Lenheart_Ani("anton/lightbar.img", FrameArr, [0, 0]); + GoldenLightBuf.ImgPath = "anton/lightbar.img"; + GoldenLightBuf.LoopFlag = false; + GoldenLight.append(GoldenLightBuf); + } + + local FrameArr2 = []; + for (local i = 0; i< 11; i++) { + local T = { + ImgIndex = i, + Delay = 60, + Pos = [0, 0] + } + FrameArr2.append(T); + } + for (local i = 0; i< 24; i++) { + local RarityLightBuf = Lenheart_Ani("anton/lightbar.img", FrameArr2, [0, 0]); + RarityLightBuf.ImgPath = "anton/ralightbar.img"; + RarityLightBuf.LoopFlag = false; + RarityLight.append(RarityLightBuf); + } + } + + function Init(Info) { + Stage = Info.state; + + //小队奖励信息 + PartyReward = []; + for (local i = 0; i< 4; i++) { + if (Info.rewards.len() > i && Info.rewards[i].item != -1) { + Info.rewards[i].Flag <- true; + PartyReward.append(Info.rewards[i]); + } else { + PartyReward.append({ + Flag = false + }); + } + } + + TeamReward = []; + for (local i = 0; i< 20; i++) { + if (Info.rewards2.len() > i && Info.rewards2[i][0].item != -1) { + Info.rewards2[i][0].Flag <- true; + TeamReward.append(Info.rewards2[i][0]); + } else { + TeamReward.append({ + Flag = false + }); + } + } + + Deaths = Info.deathsNum; + Time = Info.time; + + AniName_Flag = Clock(); + AniStartFlag = Clock(); + + //重置演出Flag + ActFlag = 0; + //重置紫色闪光 + foreach(obj in PurpleLight) { + obj.Reset(); + } + //重置粉色闪光 + foreach(obj in PinkLight) { + obj.Reset(); + } + //重置金色闪光 + foreach(obj in GoldenLight) { + obj.Reset(); + } + //重置彩色闪光 + foreach(obj in RarityLight) { + obj.Reset(); + } + + Visible = true; + ResetFocus(); + } + + function RegisterWidget() { + + } + + + AniName_Flag = 0; + //演出Flag + ActFlag = 0; + + + //绘制主界面 + function DrawMain(obj) { + + //如果初始化完成 + if (AniStartFlag) { + local ExiTime = Clock() - AniStartFlag; + //已经过时间 + local FlagTime = 0; + + //绘制背景 + L_sq_DrawImg("hud/newantondungeonreward.img", 0, X + 0, Y + 0, 1, sq_RGBA(255, 255, 255, 150), 1.0, 1.0); + + + //绘制标题 + local TitleImgIdx = 1; + if (Stage == 2) TitleImgIdx = 24; + local TileMoveTime = 350; + local TitleXposOffset = sq_GetAccel(0, 230, ExiTime, TileMoveTime, true); + local TitleAlphaOffset = sq_GetAccel(0, 100, ExiTime, TileMoveTime, true); + L_sq_DrawImg("hud/newantondungeonreward.img", TitleImgIdx, X + TitleXposOffset, Y + 40, 1, sq_RGBA(255, 255, 255, 150 + TitleAlphaOffset), 1.0, 1.0); + if (TitleXposOffset >= 230 && ActFlag == 0) { + ActFlag = 1; + } + FlagTime += TileMoveTime; + + //绘制成功标志 + if (ActFlag >= 1) { + //绘制成功 + local SuccessMoveTime = 350; + local SuccessXposOffset = sq_GetAccel(150, 440, ExiTime - FlagTime, SuccessMoveTime, true); + local SuccessAlphaOffset = sq_GetAccel(0, 100, ExiTime - FlagTime, SuccessMoveTime, true); + L_sq_DrawImg("hud/newantondungeonreward.img", 2, X + SuccessXposOffset, Y + 30, 1, sq_RGBA(255, 255, 255, 150 + SuccessAlphaOffset), 1.0, 1.0); + if (SuccessXposOffset >= 440 && ActFlag == 1) { + ActFlag = 2; + } + + FlagTime += SuccessMoveTime; + } + + + //绘制时间底槽 + if (ActFlag >= 2) { + local TimeSlotMoveTime = 350; + local TimeSlotXposOffset = sq_GetAccel(280, 120, ExiTime - FlagTime, TimeSlotMoveTime, true); + local TimeSlotAlphaOffset = sq_GetAccel(0, 100, ExiTime - FlagTime, TimeSlotMoveTime, true); + L_sq_DrawImg("hud/newantondungeonreward.img", 3, X + TimeSlotXposOffset, Y + 100, 1, sq_RGBA(255, 255, 255, 150 + TimeSlotAlphaOffset), 1.0, 1.0); + if (TimeSlotXposOffset <= 120 && ActFlag == 2) { + ActFlag = 3; + FlagTime += TimeSlotMoveTime; + } + } + + //绘制通关时间 + if (ActFlag >= 3) { + local Yoffset = 114; + local al = sq_GetUniformVelocity(0, 100, ExiTime - FlagTime, 800); + local AlphaValue = al.tofloat() / 100.0; + + local DrawTime = Time; + if (al< 100) { + DrawTime = (Time - 500) + ((500 * AlphaValue).tointeger()); + } + local seconds = DrawTime / 10; + local hours = seconds / 3600; + local minutes = seconds / 60; + + seconds %= 60; + hours = format("%02d", hours); + seconds = format("%02d", seconds).slice(-2); + minutes = format("%02d", minutes).slice(-2); + + local Offset = -6; + L_sq_DrawImg("hud/newantonrewardtime.img", hours.slice(0, 1).tointeger(), X + 240 + Offset, Y + Yoffset, 1, sq_RGBA(255, 255, 255, (250.0 * AlphaValue).tointeger()), 1.0, 1.0); + L_sq_DrawImg("hud/newantonrewardtime.img", hours.slice(1).tointeger(), X + 260 + Offset, Y + Yoffset, 1, sq_RGBA(255, 255, 255, (250.0 * AlphaValue).tointeger()), 1.0, 1.0); + L_sq_DrawImg("hud/newantonrewardtime.img", 10, X + 286 + Offset, Y + Yoffset, 1, sq_RGBA(255, 255, 255, (250.0 * AlphaValue).tointeger()), 1.0, 1.0); + Offset += 60; + L_sq_DrawImg("hud/newantonrewardtime.img", minutes.slice(0, 1).tointeger(), X + 240 + Offset, Y + Yoffset, 1, sq_RGBA(255, 255, 255, (250.0 * AlphaValue).tointeger()), 1.0, 1.0); + L_sq_DrawImg("hud/newantonrewardtime.img", minutes.slice(1).tointeger(), X + 260 + Offset, Y + Yoffset, 1, sq_RGBA(255, 255, 255, (250.0 * AlphaValue).tointeger()), 1.0, 1.0); + L_sq_DrawImg("hud/newantonrewardtime.img", 10, X + 286 + Offset, Y + Yoffset, 1, sq_RGBA(255, 255, 255, (250.0 * AlphaValue).tointeger()), 1.0, 1.0); + Offset += 60; + L_sq_DrawImg("hud/newantonrewardtime.img", seconds.slice(0, 1).tointeger(), X + 240 + Offset, Y + Yoffset, 1, sq_RGBA(255, 255, 255, (250.0 * AlphaValue).tointeger()), 1.0, 1.0); + L_sq_DrawImg("hud/newantonrewardtime.img", seconds.slice(1).tointeger(), X + 260 + Offset, Y + Yoffset, 1, sq_RGBA(255, 255, 255, (250.0 * AlphaValue).tointeger()), 1.0, 1.0); + + Offset += 160; + local DrawDieStr = format("%02d", Deaths); + L_sq_DrawImg("hud/newantonrewardtime.img", DrawDieStr.slice(0, 1).tointeger(), X + 240 + Offset, Y + Yoffset, 1, sq_RGBA(255, 255, 255, (250.0 * AlphaValue).tointeger()), 1.0, 1.0); + L_sq_DrawImg("hud/newantonrewardtime.img", DrawDieStr.slice(1).tointeger(), X + 260 + Offset, Y + Yoffset, 1, sq_RGBA(255, 255, 255, (250.0 * AlphaValue).tointeger()), 1.0, 1.0); + + if (al >= 100) { + if (ActFlag == 3) { + ActFlag = 4; + FlagTime += 800; + } + } + } + + + //绘制评分 + if (ActFlag >= 4) { + local Ani = T_DrawDynamicAni(obj, "common/anton/reward/reward_rank_00.ani", X + 570, Y + 76, "安图恩评分" + AniName_Flag); + if (sq_IsEnd(Ani)) { + if (ActFlag == 4) { + ActFlag = 5; + FlagTime += 1900; + } + } + } + + //绘制卡牌 + if (ActFlag >= 5 && ActFlag< 7) { + local CardOpenFlag = false; + + local CradMoveTime = 1500; + local CradAlphaOffset = sq_GetAccel(0, 250, ExiTime - FlagTime, CradMoveTime, true); + FlagTime += 1500; + + local CradReduceTime = 300; + local CradXrate = sq_GetAccel(100, 2, ExiTime - FlagTime, CradReduceTime, true); + local RealXrate = CradXrate.tofloat() / 100.0; + FlagTime += 300; + + local OpenCradReduceTime = 300; + local OpenCradXrate = sq_GetAccel(2, 100, ExiTime - FlagTime, CradReduceTime, true); + local OpenRealXrate = OpenCradXrate.tofloat() / 100.0; + FlagTime += 300; + //如果时间来到了打开就转换 + if (OpenCradXrate > 2) CardOpenFlag = true; + //安图恩标题 + // L_sq_DrawImg("interface2/raid/anton/reward/anton_reward.img", 28, X + 124, Y + 180, 1, sq_RGBA(255, 255, 255, CradAlphaOffset), 1.0, 1.0); + + for (local i = 0; i< 4; i++) { + local CardInfo = PartyReward[i]; + local BackGroundAniIndex = 11; + + + //卡牌背面 + if (!CardOpenFlag) { + L_sq_DrawImg("interface2/raid/anton/reward/anton_reward.img", 26, X + 94 + (160 * i), Y + 340, 1, sq_RGBA(255, 255, 255, CradAlphaOffset), RealXrate, 1.0); + + } else { + //无奖励 + if (CardInfo.Flag == false) { + L_sq_DrawImg("interface2/raid/anton/reward/anton_reward.img", 34, X + 94 + (160 * i), Y + 340, 1, sq_RGBA(255, 255, 255, CradAlphaOffset), OpenRealXrate, 1.0); + } else { + if (CardInfo.grade) { + L_sq_DrawImg("interface2/raid/anton/reward/anton_reward.img", 32, X + 94 + (160 * i), Y + 340, 1, sq_RGBA(255, 255, 255, CradAlphaOffset), OpenRealXrate, 1.0); + } else { + L_sq_DrawImg("interface2/raid/anton/reward/anton_reward.img", 31, X + 94 + (160 * i), Y + 340, 1, sq_RGBA(255, 255, 255, CradAlphaOffset), OpenRealXrate, 1.0); + } + //绘制物品边框 + if (OpenRealXrate >= 0.6) { + local Rarity = AllItemInfoObject[CardInfo.item].Rarity; + local Name = AllItemInfoObject[CardInfo.item].Name; + L_sq_DrawImg("interface2/raid/anton/reward/anton_reward.img", 5 + Rarity, X + 156 + (160 * i), Y + 378, 1, sq_RGBA(255, 255, 255, CradAlphaOffset), OpenRealXrate, 1.0); + + //绘制物品 + if (OpenRealXrate >= 1.0 && i == 3) { + DrawItemBase(X + 159 + (160 * i), Y + 380, CardInfo.item, CardInfo.num); + L_sq_DrawCode(Name, X + 174 + (160 * i) - LenheartTextClass.GetStringLength(Name) / 2, Y + 416, ItemNameColor[Rarity], 0, 1); + // if (ActFlag == 5) { + // ActFlag = 6; + // } + } + + + //物品出现光 + if (!CardInfo.grade) { + if (Rarity <= 2) { //低于紫色闪紫光 + PurpleLight[20 + i].X = X + 90 + (160 * i) - 218 + 54; + PurpleLight[20 + i].Y = Y + 320 - 152 - 24 - 7; + L_sq_SetDrawImgModel(2, 0); + PurpleLight[20 + i].Show(Duration); + L_sq_ReleaseDrawImgModel(); + } else if (Rarity == 3) { //粉光 + PinkLight[20 + i].X = X + 90 + (160 * i) - 218 + 54; + PinkLight[20 + i].Y = Y + 320 - 152 - 24 - 7; + L_sq_SetDrawImgModel(2, 0); + PinkLight[20 + i].Show(Duration); + L_sq_ReleaseDrawImgModel(); + } else if (Rarity == 4) { //金光 + GoldenLight[20 + i].X = X + 90 + (160 * i) - 218; + GoldenLight[20 + i].Y = Y + 320 - 152 - 7; + GoldenLight[20 + i].Show(Duration); + } + } else { //彩光 + RarityLight[20 + i].X = X + 90 + (160 * i) - 218; + RarityLight[20 + i].Y = Y + 320 - 152 - 7; + RarityLight[20 + i].Show(Duration); + } + } + } + if (OpenRealXrate >= 1.0 && i == 3) { + if (ActFlag == 5) { + ActFlag = 6; + } + } + } + + //绘制头像与名字 + if (ActFlag >= 6) { + if (CardInfo.Flag) { + DrawProfile(CardInfo.cid, X + 174 + (160 * i), Y + 356, 0); + } + + if (ExiTime - FlagTime >= 2000) { + if (ActFlag == 6) { + FlagTime += 2000; + ActFlag = 7; + } + } + } + } + } else { + FlagTime += 4100; + } + + + //渐渐淡出2阶段 + if (ActFlag >= 7) { + local CradMoveTime = 1500; + local CradAlphaOffset = sq_GetAccel(0, 250, ExiTime - FlagTime, CradMoveTime, true); + FlagTime += 1500; + + for (local i = 0; i< 20; i++) { + //奖励对象 + local CardInfo = TeamReward[i]; + if (CardInfo.Flag == false) { + L_sq_DrawImg("interface2/raid/anton/reward/anton_reward.img", 19, X + 89 + (128 * (i % 5)), Y + 220 + (80 * (i / 5)), 1, sq_RGBA(255, 255, 255, CradAlphaOffset), 1.0, 1.0); + } else { + //领取过奖励了 + if (CardInfo.item == -1) { + L_sq_DrawImg("interface2/raid/anton/reward/anton_reward.img", 24, X + 89 + (128 * (i % 5)), Y + 220 + (80 * (i / 5)), 1, sq_RGBA(255, 255, 255, CradAlphaOffset), 1.0, 1.0); + + } else { + L_sq_DrawImg("hud/newantondungeonreward.img", 22, X + 89 + (128 * (i % 5)), Y + 220 + (80 * (i / 5)), 1, sq_RGBA(255, 255, 255, CradAlphaOffset), 1.0, 1.0); + if (CradAlphaOffset >= 200) DrawItemEx(X + 133 + (128 * (i % 5)), Y + 252 + (80 * (i / 5)), CardInfo.item, CardInfo.num); + } + if (CradAlphaOffset >= 200) + DrawProfile(CardInfo.cid, X + 160 + (128 * (i % 5)), Y + 229 + (80 * (i / 5)), -6); + } + } + + if (CradAlphaOffset >= 200) { + for (local i = 0; i< 20; i++) { + //奖励对象 + local CardInfo = TeamReward[i]; + if (CardInfo.Flag && CardInfo.item != -1) { + local Rarity = AllItemInfoObject[CardInfo.item].Rarity; + //物品出现光 + if (!CardInfo.grade) { + if (Rarity <= 2) { //低于紫色闪紫光 + PurpleLight[i].X = X + 133 + (128 * (i % 5)) - 230; + PurpleLight[i].Y = Y + 252 + (80 * (i / 5)) - 246; + L_sq_SetDrawImgModel(2, 0); + PurpleLight[i].Show(Duration); + L_sq_ReleaseDrawImgModel(); + } else if (Rarity == 3) { //粉光 + PinkLight[i].X = X + 133 + (128 * (i % 5)) - 230; + PinkLight[i].Y = Y + 252 + (80 * (i / 5)) - 246; + L_sq_SetDrawImgModel(2, 0); + PinkLight[i].Show(Duration); + L_sq_ReleaseDrawImgModel(); + } else if (Rarity == 4) { //金光 + GoldenLight[i].X = X + 133 + (128 * (i % 5)) - 284; + GoldenLight[i].Y = Y + 252 + (80 * (i / 5)) - 220; + GoldenLight[i].Show(Duration); + } + } else { //彩光 + RarityLight[i].X = X + 133 + (128 * (i % 5)) - 284; + RarityLight[i].Y = Y + 252 + (80 * (i / 5)) - 220; + RarityLight[i].Show(Duration); + } + } + } + } + + if (CradAlphaOffset >= 250 && (ExiTime - FlagTime >= 3000)) { + if (ActFlag == 7) { + FlagTime += 3000; + ActFlag = 8; + CloseWindow(); + } + } + + } + } + } + + function DrawProfile(Cid, gx, gy, CodeXOffset) { + if (RinDro_Anton_Obj.Portrait.rawin(Cid)) { + local InfoObj = RinDro_Anton_Obj.Portrait[Cid]; + //绘制队长头像 + foreach(AvatarObj in InfoObj.EquVos) { + local AXpos = AvatarObj.F[0][2] + X + OffsetArr[InfoObj.Job][0] + gx - 110; + local AYpos = AvatarObj.F[0][3] + Y + OffsetArr[InfoObj.Job][1] + gy - 5; + setClip(AXpos + OffsetArr[InfoObj.Job][2], AYpos + OffsetArr[InfoObj.Job][3], AXpos + OffsetArr[InfoObj.Job][2] + 22, AYpos + OffsetArr[InfoObj.Job][3] + 18); //开始裁切 + L_sq_DrawImg("character/" + AvatarObj.B + ".img", AvatarObj.F[0][0], AXpos, AYpos); + releaseClip(); //裁切结束 + } + + L_sq_DrawCode(InfoObj.Name, gx + CodeXOffset - LenheartTextClass.GetStringLength(InfoObj.Name) / 2, gy, 0xff00b1ff, 0, 1); + } else { + L_sq_DrawImg("interface/lenheartwindowcommon.img", 606, gx - 65, gy - 2); + L_sq_DrawCode("未知姓名玩家", gx - LenheartTextClass.GetStringLength("未知姓名玩家") / 2, gy, 0xff00b1ff, 0, 1); + } + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + } + +} \ No newline at end of file diff --git a/Project/AradPass/AradPass.nut b/Project/AradPass/AradPass.nut new file mode 100644 index 0000000..142bdda --- /dev/null +++ b/Project/AradPass/AradPass.nut @@ -0,0 +1,361 @@ +/* +文件名:AradPass.nut +路径:Project/AradPass/AradPass.nut +创建日期:2024-08-13 09:39 +文件用途:阿拉德战令 +*/ +dofile("sqr/Project/AradPass/AradPass_Reward.nut"); +dofile("sqr/Project/AradPass/AradPass_Quest.nut"); +dofile("sqr/Project/AradPass/AradPass_Help.nut"); +class AradPassC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + Visible = false; + + //基础信息 + BaseInfo = null; + + //标题栏 + Title = null; + //当前页面 + Page = 0; + + QuestTitle = null; + QuestPage = 0; + + //标签提示 + TabSuccessTips = null; + + + //标签提示 + TabSuccessTips = null; + + //等级按钮 + LevelButton = null; + LevelPage = 0; + + //战令等级 + MyPassLevel = 2; + + //ItemInfo + ItemInfoObject = null; + ItemInfoDrawS = null; + + RewardInfoObject = null; + RewardInfoEffTimer = null; + //奖励完成提示 + RewardSuccessTips = null; + + //页面选择器 + PageSelectM = 0; + //奖励页面 + RewardPage = null; + //任务页面 + QuestPage = null; + //助力页面 + HelpPage = null; + + + + function GetBaseInfoCallBack2(Chunk) { + local Jso = Json.Decode(Chunk); + BaseInfo = {}; + BaseInfo = clone(Jso); + + LevelPage = ((BaseInfo.Exp / 1000) + 1) / 10; + } + + + function GetPlayerRewardCallBack(Chunk) { + //还原奖励领取提示数组 + RewardSuccessTips = [0, 0, 0, 0, 0]; + TabSuccessTips[0] = 0; + + RewardInfoObject = {}; + local Jso = Json.Decode(Chunk); + foreach(Pos, Value in Jso.reward) { + RewardInfoObject.rawset(Pos, Value); + if ((Pos)<(BaseInfo.Exp / 1000 + 1)) { + //判断是否有未领取的道具绘制感叹号要用 + local Page = (Pos / 10); + if (RewardSuccessTips[Page] == 0) { + if (Value.isOrdinary == 0) { + RewardSuccessTips[Page] = 1; + TabSuccessTips[0] = 1; + } + if (BaseInfo.isVip) { + if (Value.isadditional == 0) { + RewardSuccessTips[Page] = 1; + TabSuccessTips[0] = 1; + } + } + } + } + } + } + + + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + Title = []; + RewardSuccessTips = [0, 0, 0, 0, 0]; + //标签完成提示 + TabSuccessTips = [0, 0, 0]; + //奖励动画时间 + RewardInfoEffTimer = Clock(); + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + RewardPage = AradPass_RewardC("阿拉德战令_奖励窗口", X, Y + 210, 558, 274, 0); + QuestPage = AradPass_QuestC("阿拉德战令_任务窗口", X, Y + 210, 558, 274, 0); + HelpPage = AradPass_HelpC("阿拉德战令_助力窗口", X, Y + 210, 558, 274, 0); + + Pack_Control.rawset(20059006, GetBaseInfoCallBack2.bindenv(this)); + Pack_Control.rawset(20059004, GetPlayerRewardCallBack.bindenv(this)); + + GetBaseInfo(); + GetPlayerReward(); + + //默认构造时切换到0页 + ChangePage(0); + } + + function ChangePage(ToPage) { + + foreach(ButtonObj in Title) { + ButtonObj.State = 0; + } + Page = ToPage; + Title[ToPage].State = 1; + + RemoveChild("阿拉德战令_奖励窗口"); + RemoveChild("阿拉德战令_任务窗口"); + RemoveChild("阿拉德战令_助力窗口"); + + PageSelectM = ToPage; + switch (ToPage) { + case 0: { + AddChild(RewardPage); + break; + } + case 1: { + AddChild(QuestPage); + QuestPage.OpenCallBack(); + break; + } + case 2: + AddChild(HelpPage); + break; + } + } + + function RegisterWidget() { + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(540, 0, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + this.Visible = false; + }.bindenv(this); + Childrens.append(CloseButton); + + + local Tabbars1 = LenheartNewUI_TabbarsText(12, 27, "奖励"); + Tabbars1.State = 1; + AddChild(Tabbars1); + Tabbars1.OnClick = function() { + ChangePage(0); + }.bindenv(this); + Title.append(Tabbars1); + + local Tabbars2 = LenheartNewUI_TabbarsText(74, 27, "任务"); + AddChild(Tabbars2); + Tabbars2.OnClick = function() { + ChangePage(1); + }.bindenv(this); + Title.append(Tabbars2); + + local Tabbars3 = LenheartNewUI_TabbarsText(136, 27, "社交"); + AddChild(Tabbars3); + Tabbars3.OnClick = function() { + ChangePage(2); + }.bindenv(this); + Title.append(Tabbars3); + + //激活按钮 + local ActiveButton = LenheartNewUI_ButtonText(102, 121, 15, "激 活"); + ActiveButton.SetFrame(null, 323); + ActiveButton.SetTextOffset(-3, 1); + ActiveButton.OnClick = function() { + local T = { + op = 20059013 + } + SendPackEx(T); + }.bindenv(this); + ActiveButton.SetCallBackFunc(function(Win) { + if (!BaseInfo.isVip) + Win.Visible = true; + else + Win.Visible = false; + }.bindenv(this)) + AddChild(ActiveButton); + + } + + + + //绘制等级数字 + function DrawNumber(num, ...) { + num = num.tostring(); + local x = X + 38; + local y = Y + 110; + if (num.len() == 2) x = X + 28; + for (local i = 0; i< num.len(); i++) { + local n = num.slice(i, i + 1); + n = n.tointeger(); + local Img = "interface2/ui/aradpass/chn/aradpassnum.img"; + if (BaseInfo.isVip) Img = "interface2/ui/aradpass/chn/aradpassnumy.img"; + L_sq_DrawImg(Img, n, x + (i * 18), y); + } + + } + + //绘制等级数字 + function DrawSmallNumber(num, bx) { + num = num.tostring(); + local x = X + 38 + bx; + local y = Y + 250; + if (num.len() == 2) x = X + 33 + bx; + for (local i = 0; i< num.len(); i++) { + local n = num.slice(i, i + 1); + n = n.tointeger(); + local Img = "interface2/ui/aradpass/chn/aradpassnum.img"; + if (BaseInfo.isVip) Img = "interface2/ui/aradpass/chn/aradpassnumy.img"; + L_sq_DrawImg(Img, n, x + (i * 9), y, 0, sq_RGBA(255, 255, 255, 255), 0.5, 0.5); + } + } + + //绘制主界面 + function DrawMain(obj) { + //Item信息框一般为211的宽度 + L_sq_DrawWindow(X, Y + 10, 540, 420, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); + L_sq_DrawWindow(X + 6, Y + 45, 528, 384, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); + //绘制背景框标题栏 + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpassmain.img", 0, X + 1, Y); + + + + //绘制主题栏 + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 0, X + 11, Y + 50); + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass_banner.img", 0, X + 11, Y + 50); + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 3, X + 547 - 252, Y + 207 - 47); + + //绘制等级与经验值 + MyPassLevel = BaseInfo.Exp / 1000 + 1; + DrawNumber(MyPassLevel); + local jystr = (BaseInfo.Exp % 1000) + " / " + 1000; + L_sq_DrawCode(jystr, X + 50 - LenheartTextClass.GetStringLength(jystr) / 2, Y + 50 + 20 + 80, sq_RGBA(179, 169, 135, 255), 0, 1); + if (BaseInfo.isVip) { + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 6, X + 11 + 22, Y + 50 + 24); + } + + //绘制战令名 + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpassl.img", 0, X + 11 + 91, Y + 50 + 20); + + //绘制时装套装名 + local szstr = BaseInfo.Apn; + // local szstr = "使用时,选择的装备无论目前强化 /增幅数值多寡"; + L_sq_DrawCode(szstr, X + 500 - LenheartTextClass.GetStringLength(szstr) / 2, Y + 192, sq_RGBA(179, 169, 135, 255), 0, 1); + + //绘制结束时间 + L_sq_DrawCode("距离结束还有" + BaseInfo.EndTime + "天", X + 11 + 91, Y + 50 + 20 + 31, sq_RGBA(134, 120, 79, 255), 0, 1); + + //绘制主要奖励框 + for (local i = 0; i< 5; i++) { + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 4, X + 11 + 91 + (36 * i), Y + 31 + 124); + DrawItemEx(X + 11 + 95 + (36 * i), Y + 33 + 124, BaseInfo.showItemIds[i], 1); + } + + } + + + + //上层绘制 + function DrawTop(obj) { + //绘制标签栏的感叹号 + foreach(Pos, Value in Title) { + //绘制完成事件的感叹号 + if (TabSuccessTips[Pos] == 1) { + L_sq_DrawImg("interface/Lenheartwindowcommon.img", 301, X + 58 + (Pos * 62), Y + 31, 0, sq_RGBA(255, 255, 255, 210), 0.8, 0.8); + } + } + } + + function Show(obj) { + if (!BaseInfo) return; + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + + DrawTop(obj); + } + + + + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + + //主动调用子对象窗口的Proc + foreach(Object in Childrens) { + if (Object instanceof LenheartNewUI_Windows) + Object.Proc(obj); + } + } + + + function GetBaseInfo() { + local T = { + op = 20059001 + } + SendPackEx(T); + local T2 = { + op = 20059005 + } + SendPackEx(T2); + } + + function GetPlayerReward() { + local T = { + op = 20059003 + } + SendPackEx(T); + } + + //开启界面回调 + function OpenCallBack() { + GetBaseInfo(); + GetPlayerReward(); + + Visible = true; + ResetFocus(); + } +} +getroottable().rawdelete("AradPass_Obj"); + +function Lenheart_AradPass_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("AradPass_Obj")) { + RootTab.rawset("AradPass_Obj", true); + local Win = LenheartNewUI_CreateWindow(AradPassC, "阿拉德战令窗口", ((getroottable().Rindro_Scr_Width - 558) / 2).tointeger(), 46, 558, 484, 15); + EventList_Obj.AddEvent("阿拉德战令", 928, Win,"interface2/hud/information_button/information_button_cn.img"); + } +} + +getroottable()["LenheartFuncTab"].rawset("AradPassFuncN", Lenheart_AradPass_Fun); \ No newline at end of file diff --git a/Project/AradPass/AradPass_Help.nut b/Project/AradPass/AradPass_Help.nut new file mode 100644 index 0000000..4d1ed4b --- /dev/null +++ b/Project/AradPass/AradPass_Help.nut @@ -0,0 +1,174 @@ +/* +文件名:AradPass_Help.nut +路径:Project/AradPass/AradPass_Help.nut +创建日期:2024-08-19 21:25 +文件用途:战令助力页面 +*/ +class AradPass_HelpC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + // Visible = false; + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + } + + //因为要重载LenheartNewUI_Windows的构造函数 + function ResetFocus() { + + } + + function RegisterWidget() { + // //关闭按钮 + // local CloseButton = LenheartNewUI_BaseButton(278, 0, 11, 12, "interface/lenheartwindowcommon.img", 276); + // CloseButton.OnClick = function() { + // this.Visible = false; + // }.bindenv(this); + // Childrens.append(CloseButton); + + //助力按钮 + local UpButton = LenheartNewUI_ButtonText(160, 266, 15, "发起助力"); + UpButton.SetTextOffset(-7, 1); + UpButton.OnClick = function() { + local T = { + op = 20059011, + Type = 0 + } + SendPackEx(T); + }.bindenv(this); + UpButton.SetCallBackFunc(function(Win) { + if (Parent && Parent.BaseInfo && Parent.BaseInfo.help == 1) { + Win.State = 8; + } else { + Win.State = 0; + } + }.bindenv(this)); + AddChild(UpButton); + + //完成按钮 + local SuccessButton = LenheartNewUI_ButtonText(42, 420, 15, "完成"); + SuccessButton.DWidth = -5; + SuccessButton.Width = 50; + SuccessButton.SetTextOffset(-4, 1); + SuccessButton.OnClick = function() { + local T = { + op = 20059011, + Type = 5 + } + SendPackEx(T); + }.bindenv(this); + SuccessButton.SetCallBackFunc(function(Win) { + if (Parent && Parent.BaseInfo && Parent.BaseInfo.helpNum< 5) { + Win.State = 8; + } else { + Win.State = 0; + } + }.bindenv(this)); + AddChild(SuccessButton); + + //完成按钮 + local SuccessButton1 = LenheartNewUI_ButtonText(42 + 85, 420, 15, "完成"); + SuccessButton1.DWidth = -5; + SuccessButton1.Width = 50; + SuccessButton1.SetTextOffset(-4, 1); + SuccessButton1.OnClick = function() { + local T = { + op = 20059011, + Type = 10 + } + SendPackEx(T); + }.bindenv(this); + SuccessButton1.SetCallBackFunc(function(Win) { + if (Parent && Parent.BaseInfo && Parent.BaseInfo.helpNum< 10) { + Win.State = 8; + } else { + Win.State = 0; + } + }.bindenv(this)); + AddChild(SuccessButton1); + + //完成按钮 + local SuccessButton2 = LenheartNewUI_ButtonText(42 + 85 + 85, 420, 15, "完成"); + SuccessButton2.DWidth = -5; + SuccessButton2.Width = 50; + SuccessButton2.SetTextOffset(-4, 1); + SuccessButton2.OnClick = function() { + local T = { + op = 20059011, + Type = 20 + } + SendPackEx(T); + }.bindenv(this); + SuccessButton2.SetCallBackFunc(function(Win) { + if (Parent && Parent.BaseInfo && Parent.BaseInfo.helpNum< 20) { + Win.State = 8; + } else { + Win.State = 0; + } + }.bindenv(this)); + AddChild(SuccessButton2); + + } + + //绘制主界面 + function DrawMain(obj) { + if (!Parent || !Parent.BaseInfo) return; + + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 42, X + 11, Y - 210 + 50 + 162); + + L_sq_DrawCode("助力奖励", X + 11 + 115, Y - 210 + 50 + 162 + 7, sq_RGBA(124, 110, 82, 255), 1, 0); + L_sq_DrawCode("[发起助力]说明", X + 11 + 372, Y - 210 + 50 + 162 + 7, sq_RGBA(124, 110, 82, 255), 1, 0); + L_sq_DrawCode("获得助力 : " + Parent.BaseInfo.helpNum + " 次", X + 11 + 96, Y - 210 + 50 + 162 + 111, sq_RGBA(124, 110, 82, 255), 1, 0); + + + { + L_sq_DrawCode("社交功能将于每日凌晨6点重置。", X + 11 + 322, Y - 210 + 50 + 162 + 77, sq_RGBA(124, 110, 82, 255), 1, 0); + L_sq_DrawCode("点击[发起助力]按钮时,立即获得通行", X + 11 + 308, Y - 210 + 50 + 162 + 77 + 20, sq_RGBA(124, 110, 82, 255), 1, 0); + L_sq_DrawCode("券经验值。", X + 11 + 380, Y - 210 + 50 + 162 + 77 + 40, sq_RGBA(124, 110, 82, 255), 1, 0); + L_sq_DrawCode("获得助力次数将根据服务器玩家的发起", X + 11 + 300, Y - 210 + 50 + 162 + 77 + 60, sq_RGBA(124, 110, 82, 255), 1, 0); + L_sq_DrawCode("助力次数而更新。", X + 11 + 364, Y - 210 + 50 + 162 + 77 + 80, sq_RGBA(124, 110, 82, 255), 1, 0); + L_sq_DrawCode("每10秒可以点击刷新按钮更新信息。", X + 11 + 310, Y - 210 + 50 + 162 + 77 + 100, sq_RGBA(124, 110, 82, 255), 1, 0); + } + + L_sq_DrawCode("5次", X + 11 + 48, Y - 210 + 50 + 162 + 148, sq_RGBA(124, 110, 82, 255), 1, 0); + L_sq_DrawCode("10次", X + 11 + 132, Y - 210 + 50 + 162 + 148, sq_RGBA(124, 110, 82, 255), 1, 0); + L_sq_DrawCode("20次", X + 11 + 216, Y - 210 + 50 + 162 + 148, sq_RGBA(124, 110, 82, 255), 1, 0); + + + //绘制道具 + L_Sq_DrawItem(X + 103, Y - 210 + 262, 1232, Parent.BaseInfo.helpExp, 0, 0, 0); + + L_Sq_DrawItem(X + 11 + 43, Y - 210 + 50 + 162 + 167, 1232, Parent.BaseInfo.helpExp5, 0, 0, 0); + L_Sq_DrawItem(X + 11 + 128, Y - 210 + 50 + 162 + 167, 1232, Parent.BaseInfo.helpExp10, 0, 0, 0); + L_Sq_DrawItem(X + 11 + 213, Y - 210 + 50 + 162 + 167, 1232, Parent.BaseInfo.helpExp20, 0, 0, 0); + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y - 210); + + if (Parent && Parent.Visible && Parent.PageSelectM == 2) { + Visible = true; + X = Parent.X; + Y = Parent.Y + 210; + } else { + Visible = false; + } + } + +} + +// getroottable().rawdelete("AradPass_Obj"); \ No newline at end of file diff --git a/Project/AradPass/AradPass_Quest.nut b/Project/AradPass/AradPass_Quest.nut new file mode 100644 index 0000000..334847a --- /dev/null +++ b/Project/AradPass/AradPass_Quest.nut @@ -0,0 +1,420 @@ +/* +文件名:AradPass_Quest.nut +路径:Project/AradPass/AradPass_Quest.nut +创建日期:2024-08-18 22:57 +文件用途:战令任务页 +*/ + +class AradPass_Quest_ItemC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + Visible = false; + + //信息 + Info = null; + + //任务奖励 + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + //注册控件 + RegisterWidget(); + + } + + function ResetFocus() { + + } + + function RegisterWidget() { + //完成按钮 + local ActiveButton = LenheartNewUI_ButtonText(458, 3, 15, "完成"); + ActiveButton.OnClick = function() { + Info.op <- 20059033; + SendPackEx(Info); + }.bindenv(this); + ActiveButton.SetCallBackFunc(function(Button) { + //判断是否完成 + if (Info.SuccessState) { + Button.TextStr = "已完成"; + Button.State = 8; + Button.SetTextOffset(0, 1); + Button.SetTextColor(sq_RGBA(185, 148, 96, 150)); + } else { + if (Info.NowSuccessCount >= Info.MaxSuccessCount) { + Button.State = 0; + } else Button.State = 8; + Button.TextStr = "完 成"; + Button.SetTextOffset(3, 1); + Button.SetTextColor(sq_RGBA(185, 148, 96, 255)); + } + }.bindenv(this)) + AddChild(ActiveButton); + } + + //绘制主界面 + function DrawMain(obj) { + if (!Info) return; + local Ala = 250; + if (Info.SuccessState) Ala = 150; + //绘制任务名字 + L_sq_DrawCode(Info.QuestExplain, X + 20, Y + 8, sq_RGBA(179, 169, 135, Ala), 1, 1); + //绘制完成次数 + local SuccessStr = Info.NowSuccessCount + " / " + Info.MaxSuccessCount; + L_sq_DrawCode(SuccessStr, X + 296 - LenheartTextClass.GetStringLength(SuccessStr) / 2, Y + 8, sq_RGBA(179, 169, 135, Ala), 1, 1); + //绘制经验值 + L_sq_DrawCode(Info.Experience.tostring(), X + 394 - LenheartTextClass.GetStringLength(Info.Experience.tostring()) / 2, Y + 8, sq_RGBA(179, 169, 135, Ala), 1, 1); + } + + function Show(obj) { + DrawMain(obj); + //动态设置这里要先刷新一下坐标 + LenheartNewUI_Windows.SyncPos(X, Y) + LenheartNewUI_Windows.Show(obj); + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + } +} + + +class AradPass_QuestC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + Visible = false; + + QuestTitle = null; + + //页面 + Page = 0; + + //任务集合 + QuestItemList = null; + + //每日任务数组 + DailyTasks = null; + //重复任务数组 + RepeatingTasks = null; + //赛季任务数组 + SeasonTasks = null; + //任务完成提示 + QuestSuccessTips = null; + + QuestTips = false; + QuestWheelNow = 0; + QuestWheelMax = 0; + + ExpLimitMax = 0; + ExpLimit = 0; + + function GetPlayerQuest() { + local T = { + op = 20059031 + } + SendPackEx(T); + } + + function GetPlayerQuestCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + DailyTasks = Jso.task[0]; + RepeatingTasks = Jso.task[1]; + SeasonTasks = Jso.task[2]; + ExpLimitMax = Jso.ExpLimitMax; + ExpLimit = Jso.ExpLimit; + + QuestSuccessTips = [0, 0, 0]; + if (Parent) Parent.TabSuccessTips[1] = 0; + + foreach(Pos, Value in Jso.task) { + foreach(QuestObject in Value) { + if (QuestObject.SuccessState == 0) { + if (QuestObject.NowSuccessCount >= QuestObject.MaxSuccessCount) { + QuestSuccessTips[Pos] = 1; + Parent.TabSuccessTips[1] = 1; + break; + } + } + } + } + + InitQuestItem(); + } + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + QuestTitle = []; + QuestItemList = [ + [], + [], + [] + ]; + //注册控件 + RegisterWidget(); + + Pack_Control.rawset(20059032, GetPlayerQuestCallBack.bindenv(this)); + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + } + //因为要重载LenheartNewUI_Windows的构造函数 + function ResetFocus() { + + } + + function ChangePage(ToPage) { + //如果就是当前页面直接返回 + // if (ToPage == Page) return; + foreach(ButtonObj in QuestTitle) { + ButtonObj.State = 0; + } + Page = ToPage; + QuestTitle[ToPage].State = 1; + + //先移除所有 + for (local i = 0; i< 3; i++) { + foreach(winobj in QuestItemList[i]) { + winobj.Visible = false; + RemoveChild(winobj.ObjectId); + } + } + //添加该页应该显示的 + for (local i = 0; i< 3; i++) { + if (i == ToPage) { + foreach(winobj in QuestItemList[ToPage]) { + winobj.Visible = true; + AddChild(winobj); + } + } + } + + //设定页面滚轮阈值 + { + local QuestTasks = null; + //每日 + if (Page == 0) { + //每日任务数组 + QuestTasks = DailyTasks; + } + //重复 + else if (Page == 1) { + //重复任务数组 + QuestTasks = RepeatingTasks; + } + //赛季 + else { + //赛季任务数组 + QuestTasks = SeasonTasks; + } + QuestWheelMax = QuestTasks.len(); + } + } + + function RegisterWidget() { + // //关闭按钮 + // local CloseButton = LenheartNewUI_BaseButton(278, 0, 11, 12, "interface/lenheartwindowcommon.img", 276); + // CloseButton.OnClick = function() { + // this.Visible = false; + // }.bindenv(this); + // Childrens.append(CloseButton); + + local Tabbars1 = LenheartNewUI_TabbarsText(12, 213, "每日任务"); + Tabbars1.State = 1; + Tabbars1.SetTextOffset(9, 3); + AddChild(Tabbars1); + Tabbars1.OnClick = function() { + ChangePage(0); + }.bindenv(this); + QuestTitle.append(Tabbars1); + + local Tabbars2 = LenheartNewUI_TabbarsText(74, 213, "重复任务"); + AddChild(Tabbars2); + Tabbars2.SetTextOffset(9, 3); + Tabbars2.OnClick = function() { + ChangePage(1); + }.bindenv(this); + QuestTitle.append(Tabbars2); + + local Tabbars3 = LenheartNewUI_TabbarsText(136, 213, "赛季任务"); + AddChild(Tabbars3); + Tabbars3.SetTextOffset(9, 3); + Tabbars3.OnClick = function() { + ChangePage(2); + }.bindenv(this); + QuestTitle.append(Tabbars3); + + + //全部领取按钮 + local ClaimAllButton = LenheartNewUI_ButtonText(472, 452, 15, "全部领取"); + ClaimAllButton.SetFrame(null, 323); + ClaimAllButton.SetTextOffset(-7, 1); + ClaimAllButton.OnClick = function() { + local T = { + op = 20059035 + } + SendPackEx(T); + }.bindenv(this); + AddChild(ClaimAllButton); + } + + function OpenCallBack() { + GetPlayerQuest(); + } + + //创建任务Item + function InitQuestItem() { + //清除原有项目 + foreach(ItemList in QuestItemList) { + foreach(Window in ItemList) { + RemoveChild(Window.ObjectId); + Window.DestroyWindow(); + } + } + + //先移除所有 + for (local i = 0; i< 3; i++) { + foreach(winobj in QuestItemList[i]) { + winobj.Visible = false; + RemoveChild(winobj.ObjectId); + } + } + //清空缓存 + QuestItemList = [ + [], + [], + [] + ]; + + for (local i = 0; i< 3; i++) { + local QuestTasks = null; + //每日 + if (i == 0) { + //每日任务数组 + QuestTasks = DailyTasks; + } + //重复 + else if (i == 1) { + //重复任务数组 + QuestTasks = RepeatingTasks; + } + //赛季 + else { + //赛季任务数组 + QuestTasks = SeasonTasks; + } + + foreach(Pos, Value in QuestTasks) { + local QuestItem = AradPass_Quest_ItemC("AradPassQuestItem_" + i + "_" + Pos, X - 5000, Y, 536, 31, 0); + QuestItem.Info = Value; + QuestItemList[i].append(QuestItem); + } + } + + ChangePage(Page); + } + + //绘制主界面 + function DrawMain(obj) { + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 43, X + 11, Y - 210 + 50 + 162); + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 38, X + 13, Y - 210 + 50 + 184); + + L_sq_DrawCode("任务内容", X + 120, Y + 7 + 21, sq_RGBA(179, 169, 135, 255), 1, 1); + L_sq_DrawCode("完成次数", X + 288, Y + 7 + 21, sq_RGBA(179, 169, 135, 255), 1, 1); + L_sq_DrawCode("经验值", X + 388, Y + 7 + 21, sq_RGBA(179, 169, 135, 255), 1, 1); + L_sq_DrawCode("状态", X + 492, Y + 7 + 21, sq_RGBA(179, 169, 135, 255), 1, 1); + + //绘制悬停提示 + if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X + 25, Y - 210 + 456, 16, 16)) { + L_sq_DrawImg("interface/lenheartwindowcommon.img", 240, X + 25, Y - 210 + 456); + QuestTips = true; + } else { + L_sq_DrawImg("interface/lenheartwindowcommon.img", 239, X + 25, Y - 210 + 456); + QuestTips = false; + } + + // 周获取的经验 + L_sq_DrawCode("每周重复任务经验获取上限 " + ExpLimit + "/" + ExpLimitMax, X + 40 + 7, Y - 210 + 7 + 451, sq_RGBA(179, 169, 135, 255), 1, 1); + } + + + + //上层绘制 + function DrawTop(obj) { + //绘制标签栏的感叹号 + foreach(Pos, Value in QuestTitle) { + if (QuestSuccessTips && QuestSuccessTips.len() == 3) { + if (QuestSuccessTips[Pos] == 1) { + L_sq_DrawImg("interface/Lenheartwindowcommon.img", 301, X + 64 + (Pos * 62), Y + 6, 0, sq_RGBA(255, 255, 255, 210), 0.8, 0.8); + } + } + } + + + //任务提示 + if (QuestTips) { + L_sq_DrawWindow(X + 40, Y - 210 + 350, 224, 100, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); + local QuestTipsStr = "每周可以通过完成重复任务获得的最大经验值。\n达到每周经验获取上限后,无法进行重复任务。\n通过每日任务以及赛季任务获得的经验值,不受每周经验获取上限的限制。\n每周星期四将初始化每周经验获取量。\n每周四凌晨6点初始化重复任务的进度,并删除未领取的重复任务经验值。"; + local QuestTipsArray = L_sq_GetStringDrawArray(QuestTipsStr, 251); + foreach(Pos, va in QuestTipsArray) { + // Sout("文本内容嗯: %L", va); + L_sq_DrawCode(va, X + 40 + 7, Y - 210 + 7 + 350 + (Pos * 16), 0xFFFFFFFF, 1, 1); + } + } + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + + + DrawTop(obj); + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y - 210); + + if (Parent && Parent.Visible && Parent.PageSelectM == 1) { + Visible = true; + X = Parent.X; + Y = Parent.Y + 210; + } else { + Visible = false; + } + + if (IMouse.IsWheelUp()) { + if (QuestWheelNow > 0) QuestWheelNow--; + } + if (IMouse.IsWheelDown()) { + if (QuestWheelNow< QuestWheelMax - 6) QuestWheelNow++; + } + + foreach(Pos, winobj in QuestItemList[Page]) { + if (Pos >= QuestWheelNow && Pos <= QuestWheelNow + 5) { + local OffsetPos = Pos - QuestWheelNow; + winobj.X = X + 12; + winobj.Y = Y - 210 + 50 + 184 + 25 + (OffsetPos * 31); + } else { + winobj.X = X + 12 - 5000; + } + } + + //主动调用子对象窗口的Proc + foreach(Object in Childrens) { + if (Object instanceof LenheartNewUI_Windows) + Object.Proc(obj); + } + } + +} +// getroottable().rawdelete("AradPass_Obj"); \ No newline at end of file diff --git a/Project/AradPass/AradPass_Reward.nut b/Project/AradPass/AradPass_Reward.nut new file mode 100644 index 0000000..afea09c --- /dev/null +++ b/Project/AradPass/AradPass_Reward.nut @@ -0,0 +1,428 @@ +/* +文件名:AradPass_Reward.nut +路径:Project/AradPass/AradPass_Reward.nut +创建日期:2024-08-13 22:17 +文件用途:奖励 +*/ +class AradPass_RewardC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + Visible = false; + + //等级按钮数组 + LevelButton = null; + + //当前页面 + Page = 0; + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + LevelButton = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + } + + //因为要重载LenheartNewUI_Windows的构造函数 + function ResetFocus() { + + } + + function ChangePage(ToPage) { + foreach(ButtonObj in LevelButton) { + ButtonObj.State = 0; + } + LevelButton[ToPage].State = 1; + Page = ToPage; + } + + function RegisterWidget() { + //注册等级按钮 + local LevelButton_1 = LenheartNewUI_TabbarsText(61, 215, "1 - 10", 88, 25); + LevelButton_1.SetFrame("interface2/ui/aradpass/chn/aradpass.img", 15); + LevelButton_1.SetTextOffset(42 - LenheartTextClass.GetStringLength("1 - 10") / 2, 6); + LevelButton_1.State = 1; + LevelButton_1.OnClick = function() { + ChangePage(0); + }.bindenv(this); + AddChild(LevelButton_1); + LevelButton.append(LevelButton_1); + + local LevelButton_2 = LenheartNewUI_TabbarsText(154, 215, "11 - 20", 88, 25); + LevelButton_2.SetFrame("interface2/ui/aradpass/chn/aradpass.img", 15); + LevelButton_2.SetTextOffset(42 - LenheartTextClass.GetStringLength("11 - 20") / 2, 6); + LevelButton_2.OnClick = function() { + ChangePage(1); + }.bindenv(this); + AddChild(LevelButton_2); + LevelButton.append(LevelButton_2); + + local LevelButton_3 = LenheartNewUI_TabbarsText(247, 215, "21 - 30", 88, 25); + LevelButton_3.SetFrame("interface2/ui/aradpass/chn/aradpass.img", 15); + LevelButton_3.SetTextOffset(42 - LenheartTextClass.GetStringLength("11 - 20") / 2, 6); + LevelButton_3.OnClick = function() { + ChangePage(2); + }.bindenv(this); + AddChild(LevelButton_3); + LevelButton.append(LevelButton_3); + + local LevelButton_4 = LenheartNewUI_TabbarsText(340, 215, "31 - 40", 88, 25); + LevelButton_4.SetFrame("interface2/ui/aradpass/chn/aradpass.img", 15); + LevelButton_4.SetTextOffset(42 - LenheartTextClass.GetStringLength("11 - 20") / 2, 6); + LevelButton_4.OnClick = function() { + ChangePage(3); + }.bindenv(this); + AddChild(LevelButton_4); + LevelButton.append(LevelButton_4); + + local LevelButton_5 = LenheartNewUI_TabbarsText(433, 215, "41 - 50", 88, 25); + LevelButton_5.SetFrame("interface2/ui/aradpass/chn/aradpass.img", 15); + LevelButton_5.SetTextOffset(42 - LenheartTextClass.GetStringLength("11 - 20") / 2, 6); + LevelButton_5.OnClick = function() { + ChangePage(4); + }.bindenv(this); + AddChild(LevelButton_5); + LevelButton.append(LevelButton_5); + + //全部领取按钮 + local ClaimAllButton = LenheartNewUI_ButtonText(460, 440, 15, "全部领取"); + ClaimAllButton.SetFrame(null, 323); + ClaimAllButton.SetTextOffset(-7, 1); + ClaimAllButton.OnClick = function() { + local T = { + op = 20059009 + } + SendPackEx(T); + }.bindenv(this); + AddChild(ClaimAllButton); + } + + //绘制主界面 + function DrawMain(obj) { + if (!Parent.BaseInfo) return; + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 1, X + 11, Y - 210 + 50 + 162); + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 2, X + 11, Y - 210 + 50 + 162 + 214); + + L_sq_DrawCode("区", X + 11 + 14, Y - 210 + 50 + 162 + 14, sq_RGBA(179, 169, 135, 255), 1, 1); + L_sq_DrawCode("间", X + 11 + 14, Y - 210 + 50 + 162 + 14 + 19, sq_RGBA(179, 169, 135, 255), 1, 1); + + L_sq_DrawCode("免", X + 11 + 14, Y - 210 + 50 + 162 + 14 + 19 + 47, sq_RGBA(179, 169, 135, 255), 1, 1); + L_sq_DrawCode("费", X + 11 + 14, Y - 210 + 50 + 162 + 14 + 19 + 47 + 19, sq_RGBA(179, 169, 135, 255), 1, 1); + + L_sq_DrawCode("追", X + 11 + 14, Y - 210 + 50 + 162 + 14 + 19 + 47 + 19 + 54, sq_RGBA(179, 169, 135, 255), 1, 1); + L_sq_DrawCode("加", X + 11 + 14, Y - 210 + 50 + 162 + 14 + 19 + 47 + 19 + 54 + 19, sq_RGBA(179, 169, 135, 255), 1, 1); + + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 19, X + 11, Y - 210 + 240); + + if (LevelButton.len() > 0) { + foreach(Pos, Value in LevelButton) { + if (Value.State == 1) { + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 18, X + 11 + 50 + (Pos * 93), Y - 210 + 215); + } + //绘制是否可领取奖励的感叹号 + if (Parent.RewardSuccessTips[Pos] == 1) { + L_sq_DrawImg("interface/Lenheartwindowcommon.img", 301, X + 125 + (Pos * 93), Y - 210 + 224, 0, sq_RGBA(255, 255, 255, 210), 0.8, 0.8); + } + } + } + + for (local i = 0; i< 10; i++) { + DrawSmallNumber(i + 1 + (Page * 10), 124 - 91 + (i * 47)); + } + + DrawRewardItem(obj); + + L_sq_DrawImg("interface/Lenheartwindowcommon.img", 504, X + 24, Y - 210 + 438, 0, sq_RGBA(255, 255, 255, 250), 0.8, 0.8); + L_sq_DrawImg("interface/Lenheartwindowcommon.img", 504, X + 24, Y - 210 + 460, 0, sq_RGBA(255, 255, 255, 250), 0.8, 0.8); + L_sq_DrawCode("获得的物品将发放至物品栏。", X + 44, Y - 210 + 438, sq_RGBA(179, 169, 135, 150), 1, 1); + L_sq_DrawCode("未使用的奖励道具将在本季通行券结束时删除。", X + 44, Y - 210 + 460, sq_RGBA(179, 169, 135, 150), 1, 1); + + + } + + //绘制奖励 + function DrawRewardItem(obj) { + local Idx = Page * 10; + for (local i = 0; i< 10; i++) { + //奖励下标 + local RealPos = Idx + i; + + if (RealPos in Parent.RewardInfoObject) { + + local RewardObject = Parent.RewardInfoObject[RealPos]; + + //普通道具 + if ("itemid" in RewardObject) { + //普通底 + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 21, X + 11 + 45 + (i * 47), Y - 210 + 50 + 162 + 61); + + DrawItemBase(X + 64 + (i * 47), Y - 210 + 296, RewardObject.itemid, RewardObject.num); + + //已领取 + if (RewardObject.isOrdinary) { + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 23, X + 11 + 45 + (i * 47), Y - 210 + 50 + 162 + 61); + } + //未领取 + else if (!RewardObject.isOrdinary) { + //快达到等级 + if ((RealPos + 1) == Parent.MyPassLevel + 1) { + + } + //已达到等级 + else if ((RealPos + 1) <= Parent.MyPassLevel) { + local A = 60; + if (Parent.RewardInfoEffTimer) { + if (Clock() - Parent.RewardInfoEffTimer <= 1000) { + A = sq_GetUniformVelocity(60, 255, Clock() - Parent.RewardInfoEffTimer, 1000); + } + if (Clock() - Parent.RewardInfoEffTimer <= 2000 && Clock() - Parent.RewardInfoEffTimer > 1000) { + A = sq_GetUniformVelocity(255, 60, Clock() - Parent.RewardInfoEffTimer - 1000, 1000); + } + if (Clock() - Parent.RewardInfoEffTimer > 2000) { + Parent.RewardInfoEffTimer = Clock(); + } + } + L_sq_SetDrawImgModel(2, 0); + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 29, X + 7 + 45 + (i * 47), Y - 210 + 50 + 162 + 58, 0, sq_RGBA(255, 255, 255, A), 1.0, 1.0); + L_sq_ReleaseDrawImgModel(); + + + if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X + 7 + 45 + (i * 47), Y - 210 + 50 + 162 + 58, 44, 74)) { + if (MouseClickFlag) { + local T = { + op = 20059007, + Type = 0, + lv = RealPos + 1, + } + SendPackEx(T); + } + } + } + //未达到等级 + else { + //普通底Eff 未领取 + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 33, X + 11 + 45 + (i * 47), Y - 210 + 50 + 162 + 61); + } + + } + } + + //是不是VIP + local IsVip = Parent.BaseInfo.isVip; + + //进阶道具 + if ("additionalItemId" in RewardObject && "additionalItemId2" in RewardObject) { + //普通底 + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 26, X + 11 + 45 + (i * 47), Y - 210 + 50 + 162 + 138); + + DrawItemBase(X + 64 + (i * 47), Y - 210 + 356, RewardObject.additionalItemId, RewardObject.additionalNum); + DrawItemBase(X + 64 + (i * 47), Y - 210 + 390, RewardObject.additionalItemId2, RewardObject.additionalNum2); + + if (RewardObject.isadditional) { + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 28, X + 11 + 45 + (i * 47), Y - 210 + 50 + 162 + 138); + } else { + if (!IsVip) { + //普通底 + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 32, X + 11 + 45 + (i * 47), Y - 210 + 50 + 162 + 138); + } else { + //快达到等级 + if ((RealPos + 1) == Parent.MyPassLevel + 1) { + + } + //已达到等级 + else if ((RealPos + 1) <= Parent.MyPassLevel) { + local A = 60; + if (Parent.RewardInfoEffTimer) { + if (Clock() - Parent.RewardInfoEffTimer <= 1000) { + A = sq_GetUniformVelocity(60, 255, Clock() - Parent.RewardInfoEffTimer, 1000); + } + if (Clock() - Parent.RewardInfoEffTimer <= 2000 && Clock() - Parent.RewardInfoEffTimer > 1000) { + A = sq_GetUniformVelocity(255, 60, Clock() - Parent.RewardInfoEffTimer - 1000, 1000); + } + if (Clock() - Parent.RewardInfoEffTimer > 2000) { + Parent.RewardInfoEffTimer = Clock(); + } + } + L_sq_SetDrawImgModel(2, 0); + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 30, X + 7 + 45 + (i * 47), Y - 210 + 45 + 162 + 138, 0, sq_RGBA(255, 255, 255, A), 1.0, 1.0); + L_sq_ReleaseDrawImgModel(); + + if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X + 7 + 45 + (i * 47), Y - 210 + 45 + 162 + 138, 44, 74)) { + if (MouseClickFlag) { + local T = { + op = 20059007, + Type = 1, + lv = RealPos + 1, + } + SendPackEx(T); + } + } + } + //未达到等级 + else { + //普通底Eff 未领取 + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 33, X + 11 + 45 + (i * 47), Y - 210 + 50 + 162 + 138); + } + } + } + + } else { + //普通底 + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 25, X + 11 + 45 + (i * 47), Y - 210 + 50 + 162 + 138); + + DrawItemBase(X + 64 + (i * 47), Y - 210 + 373, RewardObject.additionalItemId, RewardObject.additionalNum); + + + if (RewardObject.isadditional) { + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 27, X + 11 + 45 + (i * 47), Y - 210 + 50 + 162 + 138); + } else { + if (!IsVip) { + //普通底 + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 31, X + 11 + 45 + (i * 47), Y - 210 + 50 + 162 + 138); + } else { + //快达到等级 + if ((RealPos + 1) == Parent.MyPassLevel + 1) { + + } + //已达到等级 + else if ((RealPos + 1) <= Parent.MyPassLevel) { + local A = 60; + if (Parent.RewardInfoEffTimer) { + if (Clock() - Parent.RewardInfoEffTimer <= 1000) { + A = sq_GetUniformVelocity(60, 255, Clock() - Parent.RewardInfoEffTimer, 1000); + } + if (Clock() - Parent.RewardInfoEffTimer <= 2000 && Clock() - Parent.RewardInfoEffTimer > 1000) { + A = sq_GetUniformVelocity(255, 60, Clock() - Parent.RewardInfoEffTimer - 1000, 1000); + } + if (Clock() - Parent.RewardInfoEffTimer > 2000) { + Parent.RewardInfoEffTimer = Clock(); + } + } + L_sq_SetDrawImgModel(2, 0); + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 30, X + 7 + 45 + (i * 47), Y - 210 + 45 + 162 + 138, 0, sq_RGBA(255, 255, 255, A), 1.0, 1.0); + L_sq_ReleaseDrawImgModel(); + + if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X + 7 + 45 + (i * 47), Y - 210 + 45 + 162 + 138, 44, 74)) { + if (MouseClickFlag) { + local T = { + op = 20059007, + Type = 1, + lv = RealPos + 1, + } + SendPackEx(T); + } + } + } + //未达到等级 + else { + //普通底Eff 未领取 + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", 33, X + 11 + 45 + (i * 47), Y - 210 + 50 + 162 + 138); + } + } + } + + } + } + } + + if (Parent.MyPassLevel >= Page * 10) { + + //是不是VIP + local IsVip = false; + if ("isVip" in Parent.BaseInfo && Parent.BaseInfo.isVip) IsVip = true; + + local MyExp; + local Rate; + if (Parent.MyPassLevel == Page * 10) { + MyExp = (Parent.BaseInfo.Exp + 1000.0) % 10000.0; + Rate = MyExp.tofloat() / 10000.0; + } else if (Parent.MyPassLevel<(Page + 1) * 10) { + MyExp = Parent.BaseInfo.Exp % 10000.0 + 1000.0; + Rate = MyExp.tofloat() / 10000.0; + } else { + Rate = 100.0; + } + local ImgIndex = 34; + if (IsVip) ImgIndex = 35; + + if (Rate <= 0) Rate = 0.01; + setClip(X + 11 + 45, Y - 210, X + 11 + 45 + (470 * Rate).tointeger(), Y - 210 + 264 + 4); //开始裁切 + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", ImgIndex, X + 11 + 45, Y - 210 + 264); + releaseClip(); //裁切结束 + + L_sq_SetDrawImgModel(2, 0); + L_sq_DrawImg("interface2/ui/aradpass/chn/aradpass.img", ImgIndex + 2, X + 11 + 34 + (470 * Rate).tointeger(), Y - 210 + 255); + L_sq_ReleaseDrawImgModel(); + + } + } + + //绘制等级数字 + function DrawSmallNumber(num, bx) { + num = num.tostring(); + local x = X + 38 + bx; + local y = Y + 40; + if (num.len() == 2) x = X + 33 + bx; + for (local i = 0; i< num.len(); i++) { + local n = num.slice(i, i + 1); + n = n.tointeger(); + local Img = "interface2/ui/aradpass/chn/aradpassnum.img"; + if ("isVip" in Parent.BaseInfo && Parent.BaseInfo.isVip) Img = "interface2/ui/aradpass/chn/aradpassnumy.img"; + L_sq_DrawImg(Img, n, x + (i * 9), y, 0, sq_RGBA(255, 255, 255, 255), 0.5, 0.5); + } + } + + MouseClickFlag = false; + //鼠标左键弹起回调 + function OnMouseLbUp(MousePos_X, MousePos_Y) { + MouseClickFlag = true; + LenheartNewUI_Windows.OnMouseLbUp(MousePos_X, MousePos_Y); + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + + MouseClickFlag = false; + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y - 210); + + if (Parent && Parent.Visible && Parent.PageSelectM == 0) { + Visible = true; + X = Parent.X; + Y = Parent.Y + 210; + } else { + Visible = false; + } + + if (IMouse.IsWheelUp()) { + if (Page > 0) { + ChangePage(Page - 1); + }; + } + if (IMouse.IsWheelDown()) { + if (Page< 4) { + ChangePage(Page + 1); + }; + } + + } + +} + +// getroottable().rawdelete("AradPass_Obj"); + + +// local T = { +// op = 20059015, +// } +// Rindro_BaseToolClass.SendPackEx(T); \ No newline at end of file diff --git a/Project/CollectionBox/CollectionBox.nut b/Project/CollectionBox/CollectionBox.nut new file mode 100644 index 0000000..7f3d5c8 --- /dev/null +++ b/Project/CollectionBox/CollectionBox.nut @@ -0,0 +1,208 @@ +/* +文件名:CollectionBox.nut +路径:Project/CollectionBox/CollectionBox.nut +创建日期:2024-09-14 15:08 +文件用途:收集箱 +*/ +class LenheartNewUI_CollectionBox_BaseButton extends LenheartNewUI_CommonUi { + State = 0; + BaseIdx = 29; + DWidth = null; + Path = null; + Idx = null; + SetFlag = null; + + + constructor(X, Y, W, H, Path, Idx) { + this.DWidth = W; + this.Path = Path; + this.Idx = Idx; + LenheartNewUI_CommonUi.constructor(X, Y, W, H); + + } + + function SetFrame(gPath, gIdx) { + if (gPath) Path = gPath; + Idx = gIdx; + } + + function Show(obj) { + //不可用 + if (State == 8) { + L_sq_DrawImg(Path, Idx + 3, X, Y + 1); + } else { + //按下 + if (isLBDown) { + L_sq_DrawImg(Path, Idx + 2, X, Y + 1); + } + //悬停 + else if (isInRect) { + L_sq_DrawImg(Path, Idx + 1, X, Y); + } + //普通 + else { + L_sq_DrawImg(Path, Idx, X, Y); + } + } + } + + //鼠标左键弹起回调 + function OnMouseLbUp(MousePos_X, MousePos_Y) { + if (isLBDown && OnClick) { + local obj = sq_getMyCharacter(); + obj.sq_PlaySound("CLICK_BUTTON1"); + OnClick(this); + } + isLBDown = false; + } +} + +class CollectionBoxC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + // Visible = false; + + //盒子按钮集合 + BoxButton = null; + + //信息 + Info = null; + + //当前页面 + Page = null; + + // + + //基础配置包 + function GetInfoCallBack(Chunk) { + Info = Json.Decode(Chunk).info; + foreach(Key, Aobj in Info) { + if (!Page) Page = Key; + local StrBuf1 = L_sq_GetStringDrawArray(Aobj.attribute.Atts, 300); + Aobj.attribute.AttsS <- StrBuf1[0] + "..."; + Aobj.attribute.Atts <- StrBuf1; + } + + InitBoxButton(); + } + + //获取收集信息 + function GetCollectInfo() { + local T = { + op = 20077003 + }; + SendPackEx(T); + } + //收集箱收集信息 + function GetCollectInfoCallBack(Chunk) { + + // Info = Json.Decode(Chunk).info; + } + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + BoxButton = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + Pack_Control.rawset(20077028, GetInfoCallBack.bindenv(this)); + + Pack_Control.rawset(20077004, GetCollectInfoCallBack.bindenv(this)); + GetCollectInfo(); + } + + //初始化按钮 + function InitBoxButton() { + if (BoxButton.len() > 0) { + for (local i = 0; i< Childrens.len(); i++) { + local Cobj = Childrens[i]; + if (Cobj instanceof LenheartNewUI_CollectionBox_BaseButton) { + Childrens.remove(i); + i--; + } + } + } + + local RealPos = 0; + foreach(Pos, InfoObj in Info) { + //关闭按钮 + local ButtonBuf = LenheartNewUI_CollectionBox_BaseButton(8, 95 + (RealPos * 72), 102, 70, InfoObj.img, 1); + ButtonBuf.SetFlag = Pos; + ButtonBuf.OnClick = function(ButtonObj) { + Page = ButtonObj.SetFlag; + }.bindenv(this); + ButtonBuf.SetCallBackFunc(function(ButtonObj) { + + }); + Childrens.append(ButtonBuf); + RealPos++; + } + } + + function RegisterWidget() { + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(356, 2, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + this.Visible = false; + }.bindenv(this); + Childrens.append(CloseButton); + + + } + + //绘制主界面 + function DrawMain(obj) { + if (!Info) return; + //窗口 + L_sq_DrawImg("interface2/collectbox/collectboxbtn.img", 0, X, Y); + //背景 + L_sq_DrawImg(Info[Page].img, 0, X + 7, Y + 26); + //绘制收集箱名称 + L_sq_DrawCode(Info[Page].name, X + 208 - LenheartTextClass.GetStringLength(Info[Page].name) / 2, Y + 40, sq_RGBA(255, 177, 0, 250), 0, 1); + //绘制收集箱信息缩略 + L_sq_DrawCode(Info[Page].attribute.AttsS, X + 228 - LenheartTextClass.GetStringLength(Info[Page].attribute.AttsS) / 2, Y + 40 + 20, sq_RGBA(255, 242, 0, 250), 0, 1); + } + + + function TopShow(obj) { + if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X + 86, Y + 53, 272, 15)) { + local StrArr = Info[Page].attribute.Atts; + local Str = Info[Page].attribute.AttsS; + L_sq_DrawWindow(IMouse.GetXPos() - 140 + LenheartTextClass.GetStringLength(Str) / 2, IMouse.GetYPos() - 36, 0 + LenheartTextClass.GetStringLength(Str), 0 + (14 * StrArr.len()), "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); + + local Xpos = LenheartTextClass.GetStringLength(Str) / 2; + foreach(Pos, realStr in StrArr) { + L_sq_DrawCode(realStr, IMouse.GetXPos() - 126 + Xpos, IMouse.GetYPos() - 24 + (Pos * 14), 0xFFFFFFFF, 1, 1); + } + } + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + } + +} +getroottable().rawdelete("CollectionBox_Obj"); + +function Lenheart_CollectionBox_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("CollectionBox_Obj")) { + RootTab.rawset("CollectionBox_Obj", true); + LenheartNewUI_CreateWindow(CollectionBoxC, "收集箱", ((getroottable().Rindro_Scr_Width - 376) / 2).tointeger(), 64, 376, 384, 28); + } +} + +getroottable()["LenheartFuncTab"].rawset("CollectionBoxFuncN", Lenheart_CollectionBox_Fun); \ No newline at end of file diff --git a/Project/CombatRank/CombatRank.nut b/Project/CombatRank/CombatRank.nut new file mode 100644 index 0000000..7b53f9f --- /dev/null +++ b/Project/CombatRank/CombatRank.nut @@ -0,0 +1,507 @@ +/* +文件名:CombatRank.nut +路径:Project/CombatRank/CombatRank.nut +创建日期:2024-08-12 20:07 +文件用途:战斗力系统 +*/ + +class CombatRankC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //默认显示状态需要是关闭 因为要通过收包打开 + Visible = false; + + //排行榜显示的第几页 + Page = 1; + MaxPage = 1; + //当前显示页面的数据对象 + PageInfo = null; + //我的数据 + MyInfo = null; + + + //殿堂模特数组 + ShowCharacter = null; + + function GetRankInfo() { + local T = { + op = 20072003, + page = Page + } + SendPackEx(T); + } + + function GetRankInfoCallBack(Chunk) { + PageInfo = null; + local Jso = Json.Decode(Chunk); + PageInfo = Jso.ranking; + MyInfo = PageInfo.pop(); + MyInfo.rank <- Jso.on; + MaxPage = Jso.size; + + //如果是在第一页 才会有123名 + if (Page == 1) { + ShowCharacter = array(3); + + for (local i = 0; i< 3; i++) { + local T = { + op = 20069001, + items = PageInfo[i].avaS, + job = PageInfo[i].job.tointeger(), + flag = i + } + SendPackEx(T); + } + } + } + + + //时装 帽子 头部 脸 上衣 下装 鞋子 胸部 腰部 皮肤 光环 + AvatarInfoIdx = [0x3038, 0x3010, 0x3014, 0x3018, 0x301c, 0x3020, 0x3024, 0x3028, 0x302c, 0x3030, 0x3034]; + creInfoIdx = [0x3068, 0x306C, 0x3070, 0x3074]; + //更换装备事件回调 + function PlayerChanageEquCallBack(Chunk) { + local obj = sq_GetMyMasterCharacter(); + if (!obj) return; + local C_Object = L_sq_RA(0x1ab7cdc); + //记录时装 + local avataritemsbuf = []; + foreach(offset in AvatarInfoIdx) { + local AvatarEquiAddress = L_sq_RA(C_Object + offset); + if (AvatarEquiAddress >= 0x400000) { + local Ab = []; + local NormalIndex = L_sq_RA(AvatarEquiAddress + 0x1c); + local ExIndex = L_sq_RA(AvatarEquiAddress + 0x13E0); + Ab.append(NormalIndex); + Ab.append(ExIndex); + avataritemsbuf.append(Ab); + } else { + local Ab = []; + Ab.append(0); + Ab.append(0); + avataritemsbuf.append(Ab); + } + } + //记录装备 + local equiitemsbuf = []; + local equiupbuf = []; + for (local i = 1; i< 13; ++i) { + //编号 + local Index = L_sq_GetCharacterAttribute(0x1c, i); + //强化 + local Upvalue = L_sq_GetCharacterAttribute(0x1054, i) + //是否有增幅属性 + local IsZf = L_sq_GetCharacterAttribute(0x10A8, i) + //锻造 + local DsUpvalue = L_sq_GetCharacterAttribute(0x10E8, i); + //附魔卡片 + local Enchanting = L_sq_GetCharacterAttribute(0x1084, i); + + equiitemsbuf.append(Index); + + local Info = []; + if (IsZf) { + Info.append(0); + Info.append(Upvalue); + } else { + Info.append(Upvalue); + Info.append(0); + } + Info.append(DsUpvalue); + Info.append(Enchanting); + equiupbuf.append(Info); + + // print(i); + // print(equiupbuf.len()); + } + //记录宠物 + local creitemsbuf = []; + foreach(offset in creInfoIdx) { + local creEquiAddress = L_sq_RA(C_Object + offset); + if (creEquiAddress >= 0x400000) { + local NormalIndex = L_sq_RA(creEquiAddress + 0x1c); + creitemsbuf.append(NormalIndex); + } else { + creitemsbuf.append(0); + } + } + + //记录四维三攻属强i + local Attributes = 0; + Attributes += L_sq_GetCharacterAttribute(0x2364); + Attributes += L_sq_GetCharacterAttribute(0x2394); + Attributes += L_sq_GetCharacterAttribute(0x237c); + Attributes += L_sq_GetCharacterAttribute(0x23ac); + + + local AttackValue = 0; + AttackValue += L_sq_GetCharacterAttribute(0x1E54); + AttackValue += L_sq_GetCharacterAttribute(0x1E84); + AttackValue += L_sq_GetCharacterAttribute(0x22C8); + + + local Enhancement = 0; //火冰光暗 大概 + Enhancement += L_sq_GetCharacterAttribute(0x1b54); + Enhancement += L_sq_GetCharacterAttribute(0x1b60); + Enhancement += L_sq_GetCharacterAttribute(0x1b78); + Enhancement += L_sq_GetCharacterAttribute(0x1b6c); + + local T = { + op = 20072001, + ava = avataritemsbuf, + equ = equiitemsbuf, + sw = Attributes, + atk = AttackValue, + ele = Enhancement, + cre = creitemsbuf, + job = sq_getJob(obj), + exjob = sq_getGrowType(obj), + name = L_Sq_GetObjectName(obj), + equUp = equiupbuf + } + SendPackEx(T); + } + + + ChanageCombat = null; + MyCombat = null; + DrawAniTimeFlag = null; + + function PlayerCombatChanageCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + //战斗力变动 绘制动画 + if (Jso.Combat != 0) { + ChanageCombat = Jso.Combat; + MyCombat = Jso.zdlS; + DrawAniTimeFlag = Clock(); + } + } + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + Pack_Control.rawset(20069002, GetAvatarDrawInfoCallBack.bindenv(this)); + + Pack_Control.rawset(20072004, GetRankInfoCallBack.bindenv(this)); + + + Pack_Control.rawset(20072002, PlayerCombatChanageCallBack.bindenv(this)); + + Pack_Control.rawset(20072102, PlayerChanageEquCallBack.bindenv(this)); + + + //上传自身信息 + PlayerChanageEquCallBack(1); + //获取排行榜信息 + GetRankInfo(); + } + + + function GetAvatarDrawInfoCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + local ZlibStr = Jso.ZipS; + Jso.ZipS = Json.Decode(L_sq_Dezlib(Jso.ZipS)); + + local DrawAniArr = []; + foreach(DrawObj in Jso.ZipS.MoniPack) { + local FrameArr = []; + foreach(Buf in DrawObj.F) { + local T = { + ImgIndex = Buf[0], + Delay = Buf[1], + Pos = [Buf[2], Buf[3]] + } + FrameArr.append(T); + } + local Ani = Lenheart_Ani(DrawObj.B, FrameArr, [400, 400]); + DrawAniArr.append(Ani); + } + ShowCharacter[Jso.ZipS.flag] = DrawAniArr; + } + + chrobj = null; + + function GetAvatarDrawInfo(obj) { + local C_Object = L_Sq_GetObjectAddress(obj); + // 武器 帽子 头部 脸 上衣 下装 鞋子 胸部 腰部 皮肤 光环 + local AvatarIdx = [0x3038, 0x3010, 0x3014, 0x3018, 0x301c, 0x3020, 0x3024, 0x3028, 0x302c, 0x3030, 0x3034]; + local itemsbuf = []; + foreach(offset in AvatarIdx) { + local AvatarEquiAddress = L_sq_RA(C_Object + offset); + if (AvatarEquiAddress >= 0x400000) { + local Ab = []; + local NormalIndex = L_sq_RA(AvatarEquiAddress + 0x1c); + local ExIndex = L_sq_RA(AvatarEquiAddress + 0x13E0); + Ab.append(NormalIndex); + Ab.append(ExIndex); + itemsbuf.append(Ab); + } + } + } + + function RegisterWidget() { + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(520, 2, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + this.Visible = false; + }.bindenv(this); + Childrens.append(CloseButton); + + + //左按钮 + local LeftButton = LenheartNewUI_BaseButton(236, 500, 12, 9, "interface/lenheartwindowcommon.img", 511); + LeftButton.OnClick = function() { + if (Page > 1) Page--; + }.bindenv(this); + Childrens.append(LeftButton); + //关闭按钮 + local RightButton = LenheartNewUI_BaseButton(304, 500, 12, 9, "interface/lenheartwindowcommon.img", 521); + RightButton.OnClick = function() { + if (Page< MaxPage) Page++; + }.bindenv(this); + Childrens.append(RightButton); + + } + + //绘制主界面 + function DrawMain(obj) { + if (!PageInfo) return; + + //窗口 + L_sq_DrawImg("interface/rindro/new_rank.img", 0, X, Y); + + //排名图标 + L_sq_DrawImg("interface2/hud/information_button/information_button_cn.img", 136, X + 5, Y + 295); + for (local i = 0; i< PageInfo.len(); i++) { + local StrBuf = (i + 1 + (Page - 1) * 10).tostring(); + L_sq_DrawCode(StrBuf, X + 16 - LenheartTextClass.GetStringLength(StrBuf) / 2, Y + 318 + (i * 16), sq_RGBA(179, 169, 135, 255), 0, 1); + } + //职业 + L_sq_DrawCode("职业", X + 58, Y + 299, sq_RGBA(179, 169, 135, 255), 0, 1); + //角色名 + L_sq_DrawCode("角色名", X + 152, Y + 299, sq_RGBA(179, 169, 135, 255), 0, 1); + //公会名 + L_sq_DrawCode("公会名", X + 280, Y + 299, sq_RGBA(179, 169, 135, 255), 0, 1); + //战斗力 + L_sq_DrawCode("战斗力", X + 438, Y + 299, sq_RGBA(179, 169, 135, 255), 0, 1); + + //绘制页数 + local PageStr = (Page + "/" + MaxPage); + L_sq_DrawCode(PageStr, X + 276 - LenheartTextClass.GetStringLength(PageStr) / 2, Y + 499, sq_RGBA(179, 169, 135, 255), 0, 1); + + + foreach(Index, CharObj in PageInfo) { + //绘制职业 + L_sq_DrawCode(CharObj.jobname, X + 70 - LenheartTextClass.GetStringLength(CharObj.jobname) / 2, Y + 318 + (Index * 16), sq_RGBA(179, 169, 135, 255), 0, 1); + + //绘制角色名 + L_sq_DrawCode(CharObj.name, X + 169 - LenheartTextClass.GetStringLength(CharObj.name) / 2, Y + 318 + (Index * 16), sq_RGBA(179, 169, 135, 255), 0, 1); + + local GuildName = "无公会"; + //绘制公会名 + if ("guildname" in CharObj) { + GuildName = CharObj.guildname; + } + L_sq_DrawCode(GuildName, X + 298 - LenheartTextClass.GetStringLength(GuildName) / 2, Y + 318 + (Index * 16), sq_RGBA(179, 169, 135, 255), 0, 1); + + //绘制战斗力 + L_sq_DrawCode(CharObj.zdlS, X + 456 - LenheartTextClass.GetStringLength(CharObj.zdlS) / 2, Y + 318 + (Index * 16), sq_RGBA(179, 169, 135, 255), 0, 1); + } + + + //绘制我自己 + { + local StrBuf = (MyInfo.rank).tostring(); + L_sq_DrawCode(StrBuf, X + 16 - LenheartTextClass.GetStringLength(StrBuf) / 2, Y + 321 + 160, sq_RGBA(229, 180, 83, 255), 0, 1); + + //绘制职业 + L_sq_DrawCode(MyInfo.jobname, X + 70 - LenheartTextClass.GetStringLength(MyInfo.jobname) / 2, Y + 321 + 160, sq_RGBA(229, 180, 83, 255), 0, 1); + + //绘制角色名 + L_sq_DrawCode(MyInfo.name, X + 169 - LenheartTextClass.GetStringLength(MyInfo.name) / 2, Y + 321 + 160, sq_RGBA(229, 180, 83, 255), 0, 1); + + local GuildName = "无公会"; + //绘制公会名 + if ("guildname" in MyInfo) { + GuildName = MyInfo.guildname; + } + L_sq_DrawCode(GuildName, X + 298 - LenheartTextClass.GetStringLength(GuildName) / 2, Y + 321 + 160, sq_RGBA(229, 180, 83, 255), 0, 1); + + //绘制战斗力 + L_sq_DrawCode(MyInfo.zdlS, X + 456 - LenheartTextClass.GetStringLength(MyInfo.zdlS) / 2, Y + 321 + 160, sq_RGBA(229, 180, 83, 255), 0, 1); + } + + if (ShowCharacter) { + foreach(Index, AniDrawObj in ShowCharacter) { + local OffsetX = 270; + local OffsetY = 268; + if (Index == 1) { + OffsetX = 130; + OffsetY = 268; + } + if (Index == 2) { + OffsetX = 410; + OffsetY = 268; + } + if (AniDrawObj) { + foreach(AniObj in AniDrawObj) { + AniObj.X = X + OffsetX; + AniObj.Y = Y + OffsetY; + AniObj.Show(Duration); + } + } + } + } + + } + + + AlphaValue = 1.0; + + function DrawImg(Path, Index, XPos, YPos, rate) { + L_sq_DrawImg(Path, Index, XPos, YPos, 1, sq_RGBA(255, 255, 255, (250 * AlphaValue).tointeger()), rate, rate); + } + + NormalNumOffset = [22, 11, 22, 21, 21, 21, 22, 19, 22, 21]; + + function DrawCombatNormal(Num) { + local XLength = 0; + foreach(ac in Num) { + local Idx = (ac - 48).tointeger(); + XLength += NormalNumOffset[Idx]; + } + + local NumOffset = { + X = ((getroottable().Rindro_Scr_Width - 55) / 2).tointeger(), + Y = 473 + }; + NumOffset.X -= XLength; + + local Xoffset = 0; + foreach(index, value in Num) { + local Idx = (value - 48).tointeger(); + DrawImg("interface/rindro/new_ranknum.img", 10 + Idx, NumOffset.X + Xoffset, NumOffset.Y, 1.0); + Xoffset += (NormalNumOffset[Idx]); + } + } + + function DrawCombatChanage(Num, type) { + DrawImg("interface/rindro/new_rank.img", type ? 4 : 3, ((getroottable().Rindro_Scr_Width - 55) / 2).tointeger() + 60, 478, 0.5); + + local NumOffset = { + X = ((getroottable().Rindro_Scr_Width - 55) / 2).tointeger() + 80, + Y = 473 + }; + + local Xoffset = 0; + + local ImgType = 30; + if (type) ImgType = 40; + foreach(index, value in Num) { + local Idx = (value - 48).tointeger(); + DrawImg("interface/rindro/new_ranknum.img", ImgType + Idx, NumOffset.X + Xoffset, NumOffset.Y, 1.0); + Xoffset += (NormalNumOffset[Idx]); + } + } + + + function DrawCombat() { + if (DrawAniTimeFlag) { + local NowTime = Clock(); + if ((NowTime - DrawAniTimeFlag) >= 2000) { + ChanageCombat = null; + MyCombat = null; + DrawAniTimeFlag = null; + return; + } + + local PlayT = (NowTime - DrawAniTimeFlag); + AlphaValue = sq_GetUniformVelocity(300, 30, PlayT, 2000).tofloat() / 100.0; + if (AlphaValue > 1.0) AlphaValue = 1.0; + + local IconOffset = { + X = ((getroottable().Rindro_Scr_Width - 55) / 2).tointeger(), + Y = 450 + }; + L_sq_SetDrawImgModel(2, 0); + L_sq_DrawImg("interface/rindro/new_rank.img", 2, IconOffset.X, IconOffset.Y, 1, sq_RGBA(255, 255, 255, (250 * AlphaValue).tointeger()), 0.5, 0.5); + L_sq_ReleaseDrawImgModel(); + L_sq_DrawImg("interface/rindro/new_rank.img", 1, IconOffset.X + 5, IconOffset.Y + 6, 1, sq_RGBA(255, 255, 255, (250 * AlphaValue).tointeger()), 0.5, 0.5); + + if (PlayT <= 300) { + local Str = (MyCombat[0] - 48).tostring(); + for (local i = 0; i< MyCombat.len(); i++) { + if (i != 0) Str += (sq_getRandom(0, 9)); + } + DrawCombatNormal(Str); + } else { + DrawCombatNormal(MyCombat); + } + + DrawCombatChanage(abs(ChanageCombat).tostring(), (ChanageCombat > 0) ? false : true); + } + } + + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + + if (Visible) { + DrawCombat(); + } + } + + + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + + + if (!Visible) { + DrawCombat(); + } + + MainState = Visible; + } + + + MainState = false; + + function OpenCallBack() { + Visible = true; + ResetFocus(); + + //上传自身信息 + PlayerChanageEquCallBack(1); + //获取排行榜信息 + GetRankInfo(); + } +} + + +getroottable().rawdelete("CombatRankC_Obj"); + + +function Lenheart_CombatRank_New(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("CombatRankC_Obj")) { + RootTab.rawset("CombatRankC_Obj", true); + local Winobj = LenheartNewUI_CreateWindow(CombatRankC, "新战力排行榜窗口", ((getroottable().Rindro_Scr_Width - 542) / 2).tointeger(), 28, 542, 515, 28); + EventList_Obj.AddEvent("荣誉殿堂", 136, Winobj, "interface2/hud/information_button/information_button_cn.img"); + } +} + +if (getroottable().rawin("LenheartFuncTab")) { + getroottable()["LenheartFuncTab"].rawset("Lenheart_CombatRank_NewFunc", Lenheart_CombatRank_New); +} else { + local T = {}; + T.rawset("Lenheart_CombatRank_NewFunc", Lenheart_CombatRank_New); + getroottable().rawset("LenheartFuncTab", T); +} \ No newline at end of file diff --git a/Project/DamagePerSecond/DamagePerSecond.nut b/Project/DamagePerSecond/DamagePerSecond.nut new file mode 100644 index 0000000..4355c34 --- /dev/null +++ b/Project/DamagePerSecond/DamagePerSecond.nut @@ -0,0 +1,196 @@ +/* +文件名:DamagePerSecond.nut +路径:Project/DamagePerSecond/DamagePerSecond.nut +创建日期:2024-08-31 10:32 +文件用途:秒伤统计 +*/ +//大数字 +class longlong { + Value = null; + //构造函数 不管是不是string类型都要转成string类型 + constructor(StrValue) { + Value = StrValue.tostring(); + } + + function _add(other) { + return longlong(L_sq_LongLongOperation(this.Value, other.Value, "+")); + } + + function _sub(other) { + return longlong(L_sq_LongLongOperation(this.Value, other.Value, "-")); + } + + function _mul(other) { + return longlong(L_sq_LongLongOperation(this.Value, other.Value, "*")); + } + + function _div(other) { + return L_sq_LongLongOperation(this.Value, other.Value, "/"); + } + + function _unm() { + return longlong(L_sq_LongLongOperation(longlong("0"), this.Value, "-")); + } + + function _modulo(other) { + return longlong(L_sq_LongLongOperation(this.Value, other.Value, "%")); + } + + function GetFormat(FType) { + local Buf = L_sq_LongLongOperation(this.Value, FType, "format"); + local Value = Buf.slice(0, -1); + local Unit = Buf.slice(-1); + local RetStr = format(FType + Unit, Value.tofloat()); + return RetStr; + } + +} +class DamagePerSecondC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + NoWindow = true; + + //是否可见 + // Visible = false; + + //伤害统计集合 + DamagePerSecondList = null; + + //总伤害统计 + TotalDamage = longlong(0); + + function Sq_PushDamageData(ObjAddress, MySelfAddress, Value) { + local Object = null; + //我自己的伤害 + if (ObjAddress == 0 || ObjAddress == MySelfAddress) { + Object = MySelfAddress; + } else { + //先判断是否是角色 + if (L_Sq_GetObjectIsCharacter(ObjAddress)) { + Object = ObjAddress; + } + } + + if (Object) { + if (DamagePerSecondList.rawin(Object)) { + //如果存在就相加 + DamagePerSecondList[Object].Damage = DamagePerSecondList[Object].Damage + longlong(Value); + } else { + //不存在就创建 + DamagePerSecondList.rawset(Object, { + Damage = longlong(Value), + Name = L_Sq_GetObjectNameByAddress(Object) + }); + } + TotalDamage += longlong(Value); + } + } + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + DamagePerSecondList = {}; + + // DamagePerSecondList.rawset(0, { + // Name = "测试1", + // Damage = longlong("3002132000321100000") + // }); + // DamagePerSecondList.rawset(1, { + // Name = "测试2", + // Damage = longlong("2002313000012310000") + // }); + // DamagePerSecondList.rawset(2, { + // Name = "测试3", + // Damage = longlong("10000012121300000") + // }); + // DamagePerSecondList.rawset(3, { + // Name = "测试4", + // Damage = longlong("1500012313000000") + // }); + + // foreach(Oii in DamagePerSecondList) { + // TotalDamage += Oii.Damage; + // } + + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + PushDamageFontFuncTab.rawset("DamagePerSecondCFunc", Sq_PushDamageData.bindenv(this)); + + } + + function RegisterWidget() { + // //关闭按钮 + // local CloseButton = LenheartNewUI_BaseButton(278, 0, 11, 12, "interface/lenheartwindowcommon.img", 276); + // CloseButton.OnClick = function() { + // this.Visible = false; + // }.bindenv(this); + // Childrens.append(CloseButton); + + } + + function DrawDamageBar(Pos, DamageObj) { + local Rate = DamageObj.Damage / TotalDamage; + local DamageStr = DamageObj.Damage.GetFormat("%0.2f"); + local ShowStr = DamageStr + ", " + format("%.2f", Rate.tofloat() * 100) + "%"; + + //绘制底 + L_sq_DrawImg("hud/dps.img", 3, X + 8, Y + 20 + (Pos * 22)); + + setClip(X + 8, Y + 20 + (Pos * 22), X + 8 + (160.0 * Rate.tofloat()).tointeger(), Y + 20 + (Pos * 22) + 18); + L_sq_DrawImg("hud/dps.img", 4 + (Pos % 4), X + 8, Y + 20 + (Pos * 22)); + releaseClip(); //裁切结束 + + L_sq_DrawCode(DamageObj.Name, X + 12, Y + 23 + (Pos * 22), sq_RGBA(230, 200, 155, 255), 0, 1); + L_sq_DrawCode(ShowStr, X + 168 - LenheartTextClass.GetStringLength(ShowStr), Y + 23 + (Pos * 22), sq_RGBA(230, 200, 155, 255), 0, 1); + } + + //绘制主界面 + function DrawMain(obj) { + if (DamagePerSecondList.len() == 0) return; + L_sq_DrawImg("hud/dps.img", 0, X, Y); + for (local i = 0; i<(DamagePerSecondList.len() - 1); i++) { + L_sq_DrawImg("hud/dps.img", 2, X, Y + 41 + (22 * i)); + } + L_sq_DrawImg("hud/dps.img", 1, X, Y + 41 + (22 * (DamagePerSecondList.len() - 1))); + + local i = 0; + foreach(Object, DamageObj in DamagePerSecondList) { + DrawDamageBar(i, DamageObj); + i++; + } + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + + Height = 41 + (22 * (DamagePerSecondList.len() - 1)) + 7; + TitleH = Height; + + if (sq_GetCurrentModuleType() == 1 || sq_GetCurrentModuleType() == 2) { + DamagePerSecondList = {}; + TotalDamage = longlong(0); + } + } + +} +getroottable().rawdelete("DamagePerSecond_Obj"); + +function Lenheart_DamagePerSecond_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("DamagePerSecond_Obj")) { + RootTab.rawset("DamagePerSecond_Obj", true); + LenheartNewUI_CreateWindow(DamagePerSecondC, "秒伤统计窗口", 0, 160, 178, 150, 28); + } +} + +getroottable()["LenheartFuncTab"].rawset("DamagePerSecondFuncN", Lenheart_DamagePerSecond_Fun); \ No newline at end of file diff --git a/Project/FightSign/FightSign.nut b/Project/FightSign/FightSign.nut new file mode 100644 index 0000000..e2f5649 --- /dev/null +++ b/Project/FightSign/FightSign.nut @@ -0,0 +1,144 @@ +/* +文件名:FightSign.nut +路径:Project/FightSign/FightSign.nut +创建日期:2024-08-11 09:46 +文件用途:刷图签到 +*/ +class FightSignC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + Visible = false; + + //普通奖励 + CommonReward = null; + //累计奖励 + ExReward = null; + //信息 + Info = null; + + + //获取信息回调 + function GetConfigCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + CommonReward = Jso.re1; + ExReward = Jso.re2; + } + + //获取配置回调 + function GetMyInfoCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + Info = Jso.info; + } + + //获取信息 + function GetInfo() { + local T = { + op = 20066001 + } + SendPackEx(T); + } + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + Pack_Control.rawset(20066002, GetMyInfoCallBack.bindenv(this)); + Pack_Control.rawset(20066004, GetConfigCallBack.bindenv(this)); + + GetInfo(); + } + + function RegisterWidget() { + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(580, 2, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + this.Visible = false; + }.bindenv(this); + Childrens.append(CloseButton); + + //领取奖励按钮 + local ReceiveButton = LenheartNewUI_BaseButton(426, 422, 140, 40, "interface2/event/chn_daily_attendance/main.img", 5); + ReceiveButton.OnClick = function() { + local T = { + op = 20066003 + } + SendPackEx(T); + }.bindenv(this); + ReceiveButton.SetCallBackFunc(function(Window) { + if (!Info) return; + if (Info.NowClearanceCount >= 2 && Info.TodayState == 0) { + Window.State = 0; + } else { + Window.State = 8; + } + }.bindenv(this)) + Childrens.append(ReceiveButton); + } + + //绘制主界面 + function DrawMain(obj) { + if (!CommonReward || !ExReward) return; + //绘制窗口底 + L_sq_DrawWindow(X + 2, Y + 6, 580, 440, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); + L_sq_DrawWindow(X + 16, Y + 20, 570, 462, "interface/windowcommon.img", 204, 4, 14, 4, 14); + //绘制标题栏 + L_sq_DrawImg("onlineevent/main.img", 0, X - 1, Y); + //绘制地图背景 + L_sq_DrawImg("interface2/event/chn_daily_attendance/main.img", 0, X + 24, Y + 28); + + //绘制通关次数 + L_sq_DrawImg("interface2/event/chn_daily_attendance/main.img", 2 + Info.NowClearanceCount, X + 188, Y + 129); + L_sq_DrawImg("interface2/event/chn_daily_attendance/main.img", 4, X + 220, Y + 129); + + //普通签到 + foreach(Pos, ItemObj in CommonReward) { + // if (OnlineTime <= ItemObj.time) NextRewardTime = ItemObj.time; + //绘制物品 + DrawItemBase(X + 42 + ((Pos % 7) * 55) + 4, Y + 182 + ((Pos / 7) * 65), ItemObj.itemid, ItemObj.itemnum); + if (Pos< Info.RewardDayCount) L_sq_DrawImg("interface2/event/chn_daily_attendance/main.img", 1, X + 33 + ((Pos % 7) * 55) + 4, Y + 175 + ((Pos / 7) * 65)); + } + + //累计签到 + foreach(Pos, ItemObj in ExReward) { + DrawItemBase(X + 481, Y + 194 + (Pos * 72), ItemObj.itemid, ItemObj.itemnum); + //绘制已在线时间 + L_sq_DrawCode(ItemObj.Day.tostring(), X + 512 - LenheartTextClass.GetStringLength(ItemObj.Day.tostring()) / 2, Y + 171 + (Pos * 72), sq_RGBA(255, 177, 0, 250), 1, 1); + } + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + } + + function OpenCallBack() { + Visible = true; + ResetFocus(); + GetInfo(); + } +} +getroottable().rawdelete("FightSign_Obj"); + +function Lenheart_FightSign_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("FightSign_Obj")) { + RootTab.rawset("FightSign_Obj", true); + local Win = LenheartNewUI_CreateWindow(FightSignC, "每日签到窗口", ((getroottable().Rindro_Scr_Width - 600) / 2).tointeger(), 40, 600, 494, 20); + EventList_Obj.AddEvent("每日签到", 91, Win); + } +} + +getroottable()["LenheartFuncTab"].rawset("FightSignFuncN", Lenheart_FightSign_Fun); \ No newline at end of file diff --git a/Project/HellExLogic/HellExLogic.nut b/Project/HellExLogic/HellExLogic.nut new file mode 100644 index 0000000..8d147e2 --- /dev/null +++ b/Project/HellExLogic/HellExLogic.nut @@ -0,0 +1,140 @@ +/* +文件名:HellExLogic.nut +路径:Project/HellExLogic/HellExLogic.nut +创建日期:2024-08-09 11:11 +文件用途: +*/ +class HellExLogicC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + NoWindow = true; + + //是否可见 + Visible = true; + + //被击数 + HitCount = 0; + + //总被击次数 + MaxHitCount = 50; + + //深渊派对难度 + Difficulty = 1; + + //难度文字数组 + DifficultyStr = ["未开启深渊", "非常困难", "困难"]; + + //深渊状态 0进行 1成功 2失败 + HellState = 0; + + + function OpenWindowCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + MaxHitCount = Jso.HitCounts; + Difficulty = Jso.Diff; + HitCount = 0; + HellState = 0; + Visible = true; + ResetFocus(); + } + + function HitSucCallBack(Chunk) { + local obj = sq_getMyCharacter(); + obj = sq_GetCNRDObjectToActiveObject(obj); + sq_SendCreatePassiveObjectPacket(obj, 85905, 100, 0, 0, 0, obj.getDirection()); + try { + onHellDungeonHitCountMax(obj, Difficulty); + } catch (exception) { + + } + } + + function HellFail(Chunk) { + HellState = 2; + } + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + //开启界面回包 + Pack_Control.rawset(20069006, OpenWindowCallBack.bindenv(this)); + //击打次数到了 + Pack_Control.rawset(20069004, HitSucCallBack.bindenv(this)); + //深渊派对失败 + Pack_Control.rawset(20069008, HellFail.bindenv(this)); + + getroottable().sq_SendHitConfirmPacket <- HitLogic.bindenv(this); + } + + function RegisterWidget() { + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(278, 8, 11, 12, "interface/windowcommon.img", 276); + CloseButton.OnClick = function() { + this.Visible = false; + }.bindenv(this); + Childrens.append(CloseButton); + } + + //HitLogic + function HitLogic() { + if (HellState == 2) return; + local T = { + op = 20069003 + } + SendPackEx(T); + HitCount++; + } + + //绘制主界面 + function DrawMain(obj) { + //Item信息框一般为211的宽度 + L_sq_DrawWindow(X, Y, 260, 80, "interface/windowcommon.img", 204, 4, 14, 4, 14); + + L_sq_DrawCode("封印之门的进展情况", X + 82, Y + 12, sq_RGBA(230, 200, 155, 250), 1, 1); + L_sq_DrawCode("- 被击数", X + 6, Y + 40, sq_RGBA(230, 200, 155, 250), 1, 1); + L_sq_DrawCode("- 深渊派对难度:", X + 6, Y + 58, sq_RGBA(230, 200, 155, 250), 1, 1); + + local Color = sq_RGBA(230, 200, 155, 250); + if (HitCount >= MaxHitCount) Color = sq_RGBA(255, 50, 50, 250); + local HitStr = HitCount + "/" + MaxHitCount; + L_sq_DrawCode(HitStr, X + 254 - LenheartTextClass.GetStringLength(HitStr), Y + 40, Color, 1, 1); + L_sq_DrawCode(DifficultyStr[Difficulty], X + 254 - LenheartTextClass.GetStringLength(DifficultyStr[Difficulty]), Y + 58, sq_RGBA(255, 50, 50, 250), 1, 1); + + if (HellState == 2) { + + } + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + + } + + //逻辑入口 + function Proc(obj) { + //如果不在副本中 + if (sq_GetCurrentModuleType() == 1) { + if (Visible) CloseWindow(); + } + LenheartNewUI_Windows.SyncPos(X, Y); + } + +} +getroottable().rawdelete("HellExLogic_Obj"); + +function Lenheart_HellExLogic_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("HellExLogic_Obj")) { + RootTab.rawset("HellExLogic_Obj", true); + LenheartNewUI_CreateWindow(HellExLogicC, "深渊派对特殊逻辑窗口", ((getroottable().Rindro_Scr_Width - 261)).tointeger(), 64, 260, 80, 80); + } +} + +getroottable()["LenheartFuncTab"].rawset("HellExLogicFuncN", Lenheart_HellExLogic_Fun); \ No newline at end of file diff --git a/Project/HudUi/HudUi.nut b/Project/HudUi/HudUi.nut new file mode 100644 index 0000000..5ac4a20 --- /dev/null +++ b/Project/HudUi/HudUi.nut @@ -0,0 +1,632 @@ +/* +文件名:HudUi.nut +路径:Project/HudUi/HudUi.nut +创建日期:2024-08-27 22:12 +文件用途:界面UI +*/ +class HudUiC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + NoWindow = true; + + //是否可见 + // Visible = false; + + //球Ani + Hp_BallAni = null; + Mp_BallAni = null; + + //活动图标是否展开Flag + EventListShowFlag = true; + + //最高等级 + MaxLevel = 86; + + //我的骑乘对象 + MyRidingObject = null; + + //生命损失数组 + Lenheart_100UI_HpDamageArr = null; + //生命损失标志 + Lenheart_100UI_HpDamageRateFlag = null; + //生命损失特效 + Lenheart_100UI_HpDamageEff = null; + //魔法损失数组 + Lenheart_100UI_MpDamageArr = null; + //魔法损失标志 + Lenheart_100UI_MpDamageRateFlag = null; + //魔法损失特效 + Lenheart_100UI_MpDamageEff = null; + + //修补内存 + function FixMemory() { + // 干掉nut初始化基础技能栏坐标 + L_sq_WAB(0x4B3239, 0xEB); + + //右上角绿色小圆球 + L_sq_WA(0x00E6D873, 1000); + //广播黑条 + L_sq_WA(0x01AF4968, 0); + //格兰背景 + L_sq_WA(0x004CA0B3, 850); + L_sq_WA(0x004BB768, 850); + //副本名称 + L_sq_WA(0x004BB872, 850); + L_sq_WA(0x004BB850, 850); + //城镇名称 + L_sq_WA(0x004CA27C, 850); + + + //物品栏 + for (local i = 0; i< 6; i++) { + L_sq_WA(L_sq_RA(L_sq_RA(0x01ADE0CC) + 0x18 + (i * 0x4)) + 0x14, 136 + (i * 31)); + L_sq_WA(L_sq_RA(L_sq_RA(0x01ADE0CC) + 0x18 + (i * 0x4)) + 0x18, 569); + } + + //技能栏 + for (local i = 0; i< 6; i++) { + L_sq_WA(L_sq_RA(L_sq_RA(0x01ADE0CC) + 0x30 + (i * 0x4)) + 0x14, 433 + (i * 31)); + L_sq_WA(L_sq_RA(L_sq_RA(0x01ADE0CC) + 0x30 + (i * 0x4)) + 0x18, 565); + L_sq_WA(L_sq_RA(L_sq_RA(0x01ADE0CC) + 0x60 + (i * 0x4)) + 0x14, 433 + (i * 31)); + L_sq_WA(L_sq_RA(L_sq_RA(0x01ADE0CC) + 0x60 + (i * 0x4)) + 0x18, 534); + } + + //功能按键(我的信息, 背包,任务,技能) + for (local i = 0; i< 4; i++) { + L_sq_WA(L_sq_RA(L_sq_RA(0x01ADE0CC) + 0x84 + (i * 0x4)) + 0x14, 844 + (i * 17)); + L_sq_WA(L_sq_RA(L_sq_RA(0x01ADE0CC) + 0x84 + (i * 0x4)) + 0x18, 561); + } + + //拍卖行(删除) + L_sq_WA(L_sq_RA(L_sq_RA(0x01ADE0CC) + 0x84 + (4 * 0x4)) + 0x14, -5000); + + //Lv小三角(关闭) + L_sq_WA(L_sq_RA(L_sq_RA(0x01ADE0CC) + 0x7C8) + 0xC, 256); + + //游戏菜单按钮 + local Muen = L_sq_RA(0x01ADE0CC) + 0xc; + Muen = L_sq_RA(Muen) + 0x48; + Muen = L_sq_RA(Muen) + 0x5b4; + Muen = L_sq_RA(Muen) + 0x28; + Muen = L_sq_RA(Muen) + 0x4; + Muen = L_sq_RA(Muen); + L_sq_WA(Muen + 0x14, 818); + L_sq_WA(Muen + 0x18, 561); + + //商城按钮 + local Shop = L_sq_RA(0x01ADE0CC) + 0xc; + Shop = L_sq_RA(Shop) + 0x48; + Shop = L_sq_RA(Shop) + 0xBC; + Shop = L_sq_RA(Shop) + 0x4; + Shop = L_sq_RA(Shop) + 0x28; + Shop = L_sq_RA(Shop) + 0x4; + Shop = L_sq_RA(Shop); + L_sq_WA(Shop + 0x14, 755); + L_sq_WA(Shop + 0x18, 561); + + //血槽背景 + L_sq_WA(0x00400E01, 133); //血槽背景X + L_sq_WA(5021770, 508); //血槽背景Y + //血球蓝球(删除) + L_sq_WA(4436173, -5000); //血Y + L_sq_WA(4436568, -5000); //蓝Y + L_sq_WA(4436134, -5000); //血球篮球遮盖X + L_sq_WA(4436126, -5000); //血球篮球遮盖X + L_sq_WA(4436529, -5000); //血球篮球遮盖Y + L_sq_WA(4436521, -5000); //血球篮球遮盖Y + L_sq_WA(5006757, -5000); //HP文字标识 Y轴 + L_sq_WA(5006965, -5000); //MP文字标识 Y轴 + + //BUFF图标 X在C++Hook中处理 + L_sq_WAB(0x4c8bf5, 534); //Buff图标Y + L_sq_WAB(0x4bf55a, 534); //Buff图标文字标识Y + + //技能变更类型 + local SkillChanageA = L_sq_RA(0x01ADE0CC) + 0x124; + SkillChanageA = L_sq_RA(SkillChanageA); + L_sq_WA(SkillChanageA + 0x14, 416); + L_sq_WA(SkillChanageA + 0x18, 562); + local SkillChanageB = L_sq_RA(0x01ADE0CC) + 0x128; + SkillChanageB = L_sq_RA(SkillChanageB); + L_sq_WA(SkillChanageB + 0x14, 416); + L_sq_WA(SkillChanageB + 0x18, 562); + + //拓展技能(被动技能) + local PassSkillSwitch = L_sq_RA(0x01ADE0CC) + 0x128; + PassSkillSwitch = L_sq_RA(PassSkillSwitch) + 0x2cc; + PassSkillSwitch = L_sq_RA(PassSkillSwitch) + 0x0; + PassSkillSwitch = L_sq_RA(PassSkillSwitch) + 0x190; + PassSkillSwitch = L_sq_RA(PassSkillSwitch); + L_sq_WA(PassSkillSwitch + 0x14, 419); + L_sq_WA(PassSkillSwitch + 0x18, 532); + + //小地图指南针(删除) + local MiniMapButton = L_sq_RA(0x01ADE0CC) + 0x138; + MiniMapButton = L_sq_RA(MiniMapButton); + L_sq_WA(MiniMapButton + 0xC, 256); + local MiniMapButtonAddress = L_sq_RA(0x01ADE0CC) + 0xC; + MiniMapButtonAddress = L_sq_RA(MiniMapButtonAddress) + 0x48; + MiniMapButtonAddress = L_sq_RA(MiniMapButtonAddress) + 0xBC; + MiniMapButtonAddress = L_sq_RA(MiniMapButtonAddress) + 0x4; + MiniMapButtonAddress = L_sq_RA(MiniMapButtonAddress) + 0x28; + MiniMapButtonAddress = L_sq_RA(MiniMapButtonAddress) + 0x4; + MiniMapButtonAddress = L_sq_RA(MiniMapButtonAddress) + 0x1414; + L_sq_WAB(0x4C6F35, 0xEB); + //右上角指南针X + L_sq_WA(MiniMapButtonAddress, -5000); + + //干掉废弃的深渊悬停提示 + MemoryTool.WirteByteArr(0xE6D90C, [0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90]); + } + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + FixMemory(); + + + local BallFrameArr = []; + for (local i = 0; i< 120; i++) { + local T = { + ImgIndex = i, + Delay = 20, + Pos = [0, 0] + } + BallFrameArr.append(T); + } + + Hp_BallAni = Lenheart_Ani("", BallFrameArr, [355, 534]); + Hp_BallAni.ImgPath = "interface2/hud/hpmp_vessel.img"; + Mp_BallAni = Lenheart_Ani("", BallFrameArr, [647, 534]); + Mp_BallAni.ImgPath = "interface2/hud/hpmp_vessel.img"; + //预加载 + for (local i = 0; i< 120; i++) { + L_sq_DrawImg("interface2/hud/hpmp_vessel.img", i, -5000, 508); + } + + + // local Window = sq_GetPopupWindowMainCotrol(74); + // print(Window.IsWindowFocus()); + } + + function RegisterWidget() { + //铃铛按钮 + local EventButton = LenheartNewUI_BaseButton(728, 561, 27, 27, "interface2/hud/hud.img", 204); + EventButton.OnClick = function() { + local BasePos = getroottable()["LenheartEventOffset"]; + local MyPos = EventList_Obj.Y; + if (EventListShowFlag) { + getroottable()["LenheartEventOffset"].y = BasePos.y - 5000; + EventList_Obj.Y = MyPos - 5000; + } else { + getroottable()["LenheartEventOffset"].y = BasePos.y + 5000; + EventList_Obj.Y = MyPos + 5000; + } + //刷新一下活动图标 + L_sq_RefreshEventIcon(); + EventListShowFlag = !EventListShowFlag; + // this.Visible = false; + }.bindenv(this); + EventButton.TopCallBackFunc = function(obj, button) { + local obj = sq_getMyCharacter(); + local Yoffset = 0; + if (button.isLBDown) Yoffset = 1; + T_DrawDynamicAni(obj, "common/hud/hud_ui/event/event.ani", button.X + 14, button.Y + 6 + Yoffset, "Lenheart_HUD铃铛图像"); + }.bindenv(this); + Childrens.append(EventButton); + + + + //拍卖行按钮 + local AuctionButton = LenheartNewUI_BaseButton(912, 561, 21, 23, "interface2/hud/hud.img", 17); + AuctionButton.OnClick = function() { + L_sq_Open_ExWindow(0x1ADE090, 13, 0, 1); + }.bindenv(this); + Childrens.append(AuctionButton); + + + //冒险团 + local PassPartyButton = LenheartNewUI_BaseButton(708, 558, 21, 23, "interface2/hud/advhud.img", 2); + PassPartyButton.OnClick = function() { + L_NewWindows("Lenheart", 33, 0x65535); + }.bindenv(this); + PassPartyButton.TopCallBackFunc = function(obj, button) { + local Yoffset = 0; + if (button.isLBDown) Yoffset = 1; + L_sq_DrawCode(L_sq_GetPassLevel().tostring(), 719 - (LenheartTextClass.GetStringLength(L_sq_GetPassLevel().tostring())) / 2, 564 + Yoffset, sq_RGBA(230, 200, 155, 255), 1, 1); + }.bindenv(this); + Childrens.append(PassPartyButton); + + + //小地图指南针按钮 + local MiniMapButton = LenheartNewUI_BaseButton(1031, 0, 35, 35, "interface2/hud/hud.img", 77); + MiniMapButton.OnClick = function() { + LenheartNextFrameFuncTab.append(function() { + L_sq_UseSkill(DIK_N); + }) + }.bindenv(this); + Childrens.append(MiniMapButton); + } + + function DrawEventBackground(obj) { + //我的 + 原生 + local EventCounts = EventList_Obj.Events.len() + L_sq_RA(L_sq_RA(0x1A39C2C) + 0x6c); + local XCounts = EventCounts > 8 ? 8 : EventCounts; + //如果一个都没有就0 有1个先绘制基本的就要30 后面每一个图标+20 -2是因为够上了就会绘制多一个 + local Width = XCounts == 0 ? 0 : 30 + ((XCounts - 2) * 20); + local YCounts = (EventCounts - 1) / 8; + + L_sq_DrawWindow(getroottable()["LenheartEventOffset"].x + 456 - 5, getroottable()["LenheartEventOffset"].y - 5 - (YCounts * 21), Width, YCounts * 20, "interface2/hud/hudbox.img", 0, 22, 20, 7, 21); + } + + function DrawBall(obj) { + //我的异常 + local HPRGBA = { + R = 255, + G = 0, + B = 0, + A = 250, + }; + local MPRGBA = { + R = 0, + G = 0, + B = 255, + A = 250 + }; + local HPK = 212; + local HPB = 1; + local MPK = 213; + local MPB = 2; + //中毒 + if (sq_IsValidActiveStatus(obj, ACTIVESTATUS_POISON)) { + HPRGBA = { + R = 128, + G = 0, + B = 128, + A = 250 + }; + HPK = 214; + HPB = 20; + } + //骑乘要锁定骑乘对象 + if (sq_IsRidingObject(obj)) { + HPRGBA = { + R = 255, + G = 128, + B = 0, + A = 250 + }; + MPRGBA = { + R = 255, + G = 128, + B = 0, + A = 250 + }; + HPK = 215; + HPB = 64; + MPK = 215; + MPB = 64; + + local objectManager = obj.getObjectManager(); + if (objectManager) { + local CollisionObjectNumber = objectManager.getCollisionObjectNumber(); + for (local i = 0; i< CollisionObjectNumber; i += 1) { + local object = objectManager.getCollisionObject(i); + local Address = L_Sq_GetObjectAddress(object); + if (Address == L_Sq_GetRidingObjectAddress(obj)) { + local activeObj = sq_GetCNRDObjectToActiveObject(object); + MyRidingObject = activeObj; + } + } + } + } else { + MyRidingObject = null; + } + //获取需要绘制血球蓝球的对象 + local Gobj = obj; + if (sq_IsRidingObject(obj) && MyRidingObject) Gobj = MyRidingObject; + + //血球 + { + //生命值比例 + local HpRate = (Gobj.getHp().tofloat() / Gobj.getHpMax().tofloat()); + //生命值损失数组 + if (!Lenheart_100UI_HpDamageArr) Lenheart_100UI_HpDamageArr = []; + //生命值损失标志 + if (!Lenheart_100UI_HpDamageRateFlag) Lenheart_100UI_HpDamageRateFlag = HpRate; + + //push + if (Lenheart_100UI_HpDamageRateFlag != HpRate && (abs((Lenheart_100UI_HpDamageRateFlag * 1000.0 - HpRate * 1000.0)) >= 10)) { + local MaxHpDamgeArrLen = 100; + if (Lenheart_100UI_HpDamageArr.len()< MaxHpDamgeArrLen) { + local T = { + OldHpRate = Lenheart_100UI_HpDamageRateFlag, + NowHpRate = HpRate, + Time = Clock(), + } + Lenheart_100UI_HpDamageArr.append(T); + + if (!Lenheart_100UI_HpDamageEff) { + Lenheart_100UI_HpDamageEff = { + OldHpRate = Lenheart_100UI_HpDamageRateFlag, + Time = Clock(), + }; + } + } + } + Lenheart_100UI_HpDamageRateFlag = HpRate; + + if (Lenheart_100UI_HpDamageEff) { + local ValueHpBack = Lenheart_100UI_HpDamageEff; + local DstTime = Clock() - ValueHpBack.Time; + local HpOffset = 534 + (54 * (1.0 - ValueHpBack.OldHpRate)).tointeger(); + if (DstTime > 500) { + HpOffset = sq_GetUniformVelocity(534 + (54 * (1.0 - ValueHpBack.OldHpRate)).tointeger(), 534 + (54 * (1.0 - HpRate)).tointeger(), DstTime - 500, 500); + } + setClip(355, HpOffset, 355 + 64, 534 + (54 * (1.0 - HpRate)).tointeger()); //开始裁切 + L_sq_SetDrawImgModel(2, 0); + Hp_BallAni.ShowEx(Duration, sq_RGBA(HPRGBA.R, HPRGBA.G, HPRGBA.B, HPRGBA.A), 1.0, 1.0); + L_sq_ReleaseDrawImgModel(); + // HpAni.setRGBA(HPRGBA.R, HPRGBA.G, HPRGBA.B, HPRGBA.A); + releaseClip(); //裁切结束 + + if (DstTime > 1000) { + Lenheart_100UI_HpDamageEff = null; + } + } + + // 血球缓慢掉血绘制逻辑 + foreach(Pos, Value in Lenheart_100UI_HpDamageArr) { + local DstTime = Clock() - Value.Time; + if (DstTime <= 1000) { + if (DstTime <= 500) { + local HP_Eff_Alpha = sq_GetUniformVelocity(250, 0, DstTime, 500); + setClip(355, 534 + (54 * (1.0 - Value.OldHpRate)).tointeger(), 355 + 64, 534 + (54 * (1.0 - Value.NowHpRate)).tointeger()); //开始裁切 + L_sq_SetDrawImgModel(2, 0); + Hp_BallAni.ShowEx(Duration, sq_RGBA(HPRGBA.R, HPRGBA.G, HPRGBA.B, HP_Eff_Alpha), 1.0, 1.0); + L_sq_ReleaseDrawImgModel(); + releaseClip(); //裁切结束 + } + } else { + Lenheart_100UI_HpDamageArr.remove(Pos); + } + } + + //血球绘制逻辑 + setClip(355, 534 + (54 * (1.0 - HpRate)).tointeger(), 355 + 64, 534 + 54); //开始裁切 + L_sq_SetDrawImgModel(2, 0); + Hp_BallAni.ShowEx(Duration, sq_RGBA(HPRGBA.R, HPRGBA.G, HPRGBA.B, HPRGBA.A), 1.0, 1.0); + Hp_BallAni.ShowEx(Duration, sq_RGBA(HPRGBA.R, HPRGBA.G, HPRGBA.B, HPRGBA.A), 1.0, 1.0); + L_sq_ReleaseDrawImgModel(); + releaseClip(); //裁切结束 + + local HpStr = ((Gobj.getHp().tofloat() / Gobj.getHpMax().tofloat()).tofloat() * 100.0) + "%"; + L_sq_DrawCode(HpStr, 391 - LenheartTextClass.GetStringLength(HpStr) / 2, 560, 0xFFFFFFFF, 1, 1); + } + + { + //魔法值比例 + local MpRate = (Gobj.getMp().tofloat() / Gobj.getMpMax().tofloat()); + //生命值损失数组 + if (!Lenheart_100UI_MpDamageArr) Lenheart_100UI_MpDamageArr = []; + //生命值损失标志 + if (!Lenheart_100UI_MpDamageRateFlag) Lenheart_100UI_MpDamageRateFlag = MpRate; + + //Push + if (Lenheart_100UI_MpDamageRateFlag != MpRate && (abs((Lenheart_100UI_MpDamageRateFlag * 1000.0 - MpRate * 1000.0)) >= 10)) { + local MaxMpDamgeArrLen = 100; + if (Lenheart_100UI_MpDamageArr.len()< MaxMpDamgeArrLen) { + local T = { + OldMpRate = Lenheart_100UI_MpDamageRateFlag, + NowMpRate = MpRate, + Time = Clock(), + } + Lenheart_100UI_MpDamageArr.append(T); + + if (!Lenheart_100UI_MpDamageEff) { + Lenheart_100UI_MpDamageEff = { + OldMpRate = Lenheart_100UI_MpDamageRateFlag, + Time = Clock(), + }; + } + } + } + Lenheart_100UI_MpDamageRateFlag = MpRate; + + if (Lenheart_100UI_MpDamageEff) { + + local ValueMpBack = Lenheart_100UI_MpDamageEff; + local DstTime = Clock() - ValueMpBack.Time; + local MpOffset = 534 + (63 * (1.0 - ValueMpBack.OldMpRate)).tointeger(); + if (DstTime > 500) { + MpOffset = sq_GetUniformVelocity(534 + (63 * (1.0 - ValueMpBack.OldMpRate)).tointeger(), 534 + (63 * (1.0 - MpRate)).tointeger(), DstTime - 500, 500); + } + setClip(647, MpOffset, 647 + 64, 534 + (63 * (1.0 - MpRate)).tointeger()); //开始裁切 + L_sq_SetDrawImgModel(2, 0); + Mp_BallAni.ShowEx(Duration, sq_RGBA(MPRGBA.R, MPRGBA.G, MPRGBA.B, MPRGBA.A), 1.0, 1.0); + L_sq_ReleaseDrawImgModel(); + releaseClip(); //裁切结束 + + if (DstTime > 1000) { + Lenheart_100UI_MpDamageEff = null; + } + } + + + foreach(Pos, Value in Lenheart_100UI_MpDamageArr) { + local DstTime = Clock() - Value.Time; + if (DstTime <= 1000) { + if (DstTime <= 500) { + local Mp_Eff_Alpha = sq_GetUniformVelocity(250, 0, DstTime, 500); + setClip(647, 534 + (63 * (1.0 - Value.OldMpRate)).tointeger(), 647 + 64, 534 + (63 * (1.0 - Value.NowMpRate)).tointeger()); //开始裁切 + L_sq_SetDrawImgModel(2, 0); + Mp_BallAni.ShowEx(Duration, sq_RGBA(MPRGBA.R, MPRGBA.G, MPRGBA.B, Mp_Eff_Alpha), 1.0, 1.0); + L_sq_ReleaseDrawImgModel(); + releaseClip(); //裁切结束 + } + } else { + Lenheart_100UI_MpDamageArr.remove(Pos); + } + } + + //蓝球绘制逻辑 + setClip(647, 534 + (63 * (1.0 - MpRate)).tointeger(), 647 + 64, 534 + 63); //开始裁切 + L_sq_SetDrawImgModel(2, 0); + Mp_BallAni.ShowEx(Duration, sq_RGBA(MPRGBA.R, MPRGBA.G, MPRGBA.B, MPRGBA.A), 1.0, 1.0); + Mp_BallAni.ShowEx(Duration, sq_RGBA(MPRGBA.R, MPRGBA.G, MPRGBA.B, MPRGBA.A), 1.0, 1.0); + L_sq_ReleaseDrawImgModel(); + releaseClip(); //裁切结束 + + local MpStr = ((Gobj.getMp().tofloat() / Gobj.getMpMax().tofloat()).tofloat() * 100.0) + "%"; + L_sq_DrawCode(MpStr, 684 - LenheartTextClass.GetStringLength(MpStr) / 2, 560, 0xFFFFFFFF, 1, 1); + } + //血盖子 + L_sq_DrawImg("interface2/hud/hud.img", HPK, 355, 534, 1, sq_RGBA(255, 255, 255, 250), 1.0, 1.0); + //蓝盖子 + L_sq_DrawImg("interface2/hud/hud.img", 213, 647, 534, 1, sq_RGBA(255, 255, 255, 250), 1.0, 1.0); + } + + function BallRectLogic(obj) { + //悬停逻辑 + if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, 355, 534, 64, 63)) { + local Gobj = obj; + if (sq_IsRidingObject(obj) && MyRidingObject) Gobj = MyRidingObject; + local Str = "生命值: " + Gobj.getHp() + "/" + Gobj.getHpMax(); + L_sq_DrawWindow(IMouse.GetXPos() - 140 + LenheartTextClass.GetStringLength(Str) / 2, IMouse.GetYPos() - 36, 0 + LenheartTextClass.GetStringLength(Str), 12, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); + L_sq_DrawCode(Str, IMouse.GetXPos() - 126 + LenheartTextClass.GetStringLength(Str) / 2, IMouse.GetYPos() - 24, 0xFFFFFFFF, 1, 1); + } else if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, 647, 534, 64, 63)) { + local Gobj = obj; + if (sq_IsRidingObject(obj) && MyRidingObject) Gobj = MyRidingObject; + local Str = "魔法值: " + Gobj.getMp() + "/" + Gobj.getMpMax(); + L_sq_DrawWindow(IMouse.GetXPos() - 140 + LenheartTextClass.GetStringLength(Str) / 2, IMouse.GetYPos() - 36, 0 + LenheartTextClass.GetStringLength(Str), 12, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); + L_sq_DrawCode(Str, IMouse.GetXPos() - 126 + LenheartTextClass.GetStringLength(Str) / 2, IMouse.GetYPos() - 24, 0xFFFFFFFF, 1, 1); + } + } + + function DrawExpBar(obj) { + local NowExp = L_sq_GetExp(1); + local MaxExp = L_sq_GetExp(0); + local ExpRate = (NowExp.tofloat() / MaxExp.tofloat()).tofloat(); + + if (L_Sq_GetObjectLevel(obj) == MaxLevel) { + L_sq_DrawImg("interface2/hud/hud.img", 60, 383, 595); + } else { + setClip(383, 595, 248 + (300.0 * ExpRate).tointeger(), 596 + 4); //开始裁切 + L_sq_DrawImg("interface2/hud/hud.img", 4, 383, 595); + releaseClip(); //裁切结束 + } + } + + function ExpRectLogic(obj) { + if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, 383, 595, 300, 4)) { + if (L_Sq_GetObjectLevel(obj) == MaxLevel) { + L_sq_DrawWindow(IMouse.GetXPos() - 150, IMouse.GetYPos() - 36, 144, 12, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); + L_sq_DrawCode("已满级!等待服务器下一等级节点!", IMouse.GetXPos() - 142, IMouse.GetYPos() - 24, 0xFFFFFFFF, 1, 1); + } else { + local Str = "当前经验值: " + L_sq_GetExp(1) + " 总经验值: " + L_sq_GetExp(0); + L_sq_DrawWindow(IMouse.GetXPos() - 150, IMouse.GetYPos() - 36, 144 + LenheartTextClass.GetStringLength(L_sq_GetExp(1).tostring() + L_sq_GetExp(0).tostring()), 12, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); + L_sq_DrawCode(Str, IMouse.GetXPos() - 140, IMouse.GetYPos() - 24, 0xFFFFFFFF, 1, 1); + } + } + } + + function DrawLevelAndSp(obj) { + local ChrLevel = L_Sq_GetObjectLevel(obj); + + local ChrSp = L_sq_GetSp(); + + L_sq_DrawCode("Lv." + ChrLevel.tostring(), 356 - (LenheartTextClass.GetStringLength("Lv." + ChrLevel.tostring()) / 2), 587, sq_RGBA(230, 200, 155, 255), 1, 1); + L_sq_DrawCode(ChrSp.tostring(), 713 - (LenheartTextClass.GetStringLength(ChrSp.tostring()) / 2), 587, sq_RGBA(230, 200, 155, 255), 1, 1); + } + + function DrawFatigue(obj) { + local MaxFatigue = L_sq_GetFatigue(0); + local NowFatigue = MaxFatigue - L_sq_GetFatigue(1); + local FatigueRate = ((NowFatigue * 100) / MaxFatigue).tofloat(); //计算比率 + setClip(773, 591, 773 + (141 * (FatigueRate / 100).tofloat()).tointeger(), 591 + 8); //开始裁切 + L_sq_DrawImg("interface2/hud/hud.img", 3, 773, 591); + releaseClip(); //裁切结束 + local FatigueStr = NowFatigue + "/" + MaxFatigue; + L_sq_DrawCode(FatigueStr, 940 - (LenheartTextClass.GetStringLength(FatigueStr) / 2), 587, sq_RGBA(230, 200, 155, 255), 1, 1); + } + + //绘制主界面 + function DrawMain(obj) { + //绘制背景 + L_sq_DrawImg("interface2/hud/hud.img", 0, 0, 526); + + //绘制血球蓝球 + DrawBall(obj); + + //绘制经验盖槽 + L_sq_DrawImg("interface2/hud/hud.img", 202, 313, 582); + + //绘制经验条 + DrawExpBar(obj); + + //绘制等级和Sp点 + DrawLevelAndSp(obj); + + //绘制疲劳值 + DrawFatigue(obj); + + //绘制活动图标背景槽 + DrawEventBackground(obj); + } + + function Show(obj) { + + + } + + + + function TopShow(obj) { + //血蓝球悬停逻辑 + BallRectLogic(obj); + //经验条悬停逻辑 + ExpRectLogic(obj); + + } + + function BottomShow(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + } + + //动态窗口设置逻辑 + function Active_Windows_SyncPos() { + //任务快捷导航窗口 + { + local WindowAddress = L_sq_GetWindowById(1); + if (WindowAddress) L_sq_WA(WindowAddress + 0x14, 907); + } + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + Active_Windows_SyncPos(); + } + +} + + +function Lenheart_HudUi_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("HudUi_Obj")) { + RootTab.rawset("HudUi_Obj", LenheartNewUI_CreateWindow(HudUiC, "HUD血槽界面窗口", 0, 0, 0, 0, 0)); + } +} + +getroottable()["LenheartFuncTab"].rawset("HudUiFuncN", Lenheart_HudUi_Fun); + +// L_sq_Test(L_sq_RA(0x01AB7CDC), 0x3DB61400); +// local Ret = L_sq_Test(L_sq_RA(0x01AB7CDC), 10); +// local Ret = L_sq_Test(L_sq_RA(0x01A5FA88), 101020037); +// print(format("%02x", Ret)); \ No newline at end of file diff --git a/Project/MidsummerParty/MidsummerParty.nut b/Project/MidsummerParty/MidsummerParty.nut new file mode 100644 index 0000000..251a983 --- /dev/null +++ b/Project/MidsummerParty/MidsummerParty.nut @@ -0,0 +1,326 @@ +/* +文件名:MidsummerParty.nut +路径:Project/MidsummerParty/MidsummerParty.nut +创建日期:2024-08-20 08:02 +文件用途:希曼音乐会 +*/ + +class MidsummerPartyC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + Visible = false; + + InitState = false; + + //最终奖励条件是否达成 + EndRewardFlag = false; + + //奖励对象 + RewardItemObject = null; + //消耗道具 + UseItemInfo = null; + ExRewardSchedule = null; + + //抽奖完成的Ok按钮 + OkButtonFlag = false; + + function GetRewardInfoCallBack(Chunk) { + // Sout("收到包 : \n %L", Chunk); + local Jso = Json.Decode(Chunk); + //常规奖励 + foreach(Value in Jso.items) { + RewardItemObject[Value.index] <- Value; + // if (Value.ifhas == 0) EndRewardFlag = false; + } + //最终奖励 + RewardItemObject["ExReward"] <- Jso.endItem; + //是否已经集齐 + EndRewardFlag = Jso.endani; + //消耗道具 + UseItemInfo.Id <- Jso.useItem; + //消耗道具数量 + UseItemInfo.Count <- Jso.usrItemNum; + if (UseItemInfo.Count > 16) UseItemInfo.Count = 16; + //特殊奖励均衡器 + ExRewardSchedule = Jso.plusNum; + local obj = sq_GetMyMasterCharacter(); + switch (ExRewardSchedule) { + case 0: + break; + case 1: + obj.sq_PlaySound("SUMMERLISTEN_PLAY_01"); + break; + case 2: + obj.sq_PlaySound("SUMMERLISTEN_PLAY_02"); + break; + case 3: + obj.sq_PlaySound("SUMMERLISTEN_PLAY_03"); + break; + case 4: + obj.sq_PlaySound("SUMMERLISTEN_PLAY_04"); + break; + } + + InitState = true; + } + + function GetInfo() { + local T = { + op = 20061001 + } + SendPackEx(T); + } + + function GetRewardInfo() { + local T = { + op = 20061003 + } + SendPackEx(T); + } + + + AnimotionState = 0; + AnimotionEndFlag = 0; + NowReawrdObject = null; + + function LotteryPackCallBack(Chunk) { + // Sout("收到包 : \n %L", Chunk); + local Jso = Json.Decode(Chunk); + NowReawrdObject = Jso.item; + AnimotionState = 1; + AnimotionEndFlag = Jso.endani; + local obj = sq_GetMyMasterCharacter(); + obj.sq_PlaySound("SUMMERLISTEN_START"); + } + + function EndRewardPackCallBack(Chunk) { + GetRewardInfo(); + } + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + RewardItemObject = {}; + UseItemInfo = {}; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + + //获取奖励配置回调包 + Pack_Control.rawset(20061004, GetRewardInfoCallBack.bindenv(this)); + //抽奖回调包 + Pack_Control.rawset(20061008, LotteryPackCallBack.bindenv(this)); + //最终奖励回包 + Pack_Control.rawset(20061010, EndRewardPackCallBack.bindenv(this)); + + //获取基础配置 + GetInfo(); + //获取奖励配置 + GetRewardInfo(); + } + + function RegisterWidget() { + // //关闭按钮 + // local CloseButton = LenheartNewUI_BaseButton(278, 0, 11, 12, "interface/lenheartwindowcommon.img", 276); + // CloseButton.OnClick = function() { + // this.Visible = false; + // }.bindenv(this); + // Childrens.append(CloseButton); + + + //关闭按钮 + local EndRewardGetButton = LenheartNewUI_BaseButton(652 - 21, 239, 68, 35, "interface2/cs_shop/cs_packageevent/2021_summer/hearoursummer.img", 11); + EndRewardGetButton.OnClick = function() { + local obj = sq_GetMyMasterCharacter(); + obj.sq_PlaySound("SUMMERLISTEN_CLICK"); + local T = { + op = 20061009 + } + SendPackEx(T); + }.bindenv(this); + EndRewardGetButton.SetCallBackFunc(function(win) { + if (EndRewardFlag) { + win.State = 0; + } else { + win.State = 8; + } + }.bindenv(this)); + Childrens.append(EndRewardGetButton); + + + //启动按钮 + local PlayButton = LenheartNewUI_BaseButton(317, 410, 121, 86, "interface2/cs_shop/cs_packageevent/2021_summer/hearoursummer.img", 1); + PlayButton.OnClick = function() { + local obj = sq_GetMyMasterCharacter(); + obj.sq_PlaySound("SUMMERLISTEN_TAG"); + local T = { + op = 20061005 + } + SendPackEx(T); + }.bindenv(this); + Childrens.append(PlayButton); + + //购买按钮 + local ShopButton = LenheartNewUI_BaseButton(331, 500, 93, 26, "interface2/cs_shop/cs_packageevent/2021_summer/hearoursummer.img", 40); + ShopButton.OnClick = function() { + local obj = sq_GetMyMasterCharacter(); + obj.sq_PlaySound("SUMMERLISTEN_CLICK"); + L_sq_UseSkill(DIK_F5); + // CloseWindow(); + }.bindenv(this); + Childrens.append(ShopButton); + + //抽奖完成的Ok按钮 + local OkButton = LenheartNewUI_BaseButton(341, 344, 68, 35, "interface2/cs_shop/cs_packageevent/2021_summer/hearoursummer.img", 11); + OkButton.OnClick = function() { + OkButtonFlag = false; + local obj = sq_GetMyMasterCharacter(); + obj.sq_PlaySound("SUMMERLISTEN_CLICK"); + + if (AnimotionEndFlag) { + AnimotionState = 4; + local obj = sq_GetMyMasterCharacter(); + obj.sq_PlaySound("SUMMERLISTEN_RESULT_02"); + } else { + AnimotionState = 0; + } + + local T = { + op = 20061003 + } + SendPackEx(T); + }.bindenv(this); + OkButton.SetCallBackFunc(function(win) { + if (OkButtonFlag) { + win.Localtion_X = 341; + } else { + win.Localtion_X = -50000; + } + }.bindenv(this)); + Childrens.append(OkButton); + } + + //绘制主界面 + function DrawMain(obj) { + if (!InitState) return; + //绘制主界面 + L_sq_DrawImg("interface2/cs_shop/cs_packageevent/2021_summer/hearoursummer.img", 0, X - 21, Y); + L_sq_SetDrawImgModel(2, 0); + L_sq_DrawImg("interface2/cs_shop/cs_packageevent/2021_summer/hearoursummer.img", 44, X + 242 - 21, Y + 22, 0, sq_RGBA(255, 255, 255, 250), 1.0, 1.0); + L_sq_ReleaseDrawImgModel(); + T_DrawDynamicAni(obj, "common/midsummerpartypackage/main_loop.ani", X - 21, Y, "MidsummerPartyCMainEffect"); + + + if (EndRewardFlag) { + L_sq_DrawImg("interface2/cs_shop/cs_packageevent/2021_summer/hearoursummer.img", 39, X + 92, Y + 114); + } else { + //常规奖励 + foreach(Value in RewardItemObject) { + if ("index" in Value) { + if (Value.ifhas) { + L_sq_DrawImg("interface2/cs_shop/cs_packageevent/2021_summer/hearoursummer.img", 23 + Value.index, X - 21 + 81 + ((Value.index % 4) * 132), Y + 102 + ((Value.index / 4) * 70)); + } else { + DrawItemBase(X - 21 + 142 + ((Value.index % 4) * 132), Y + 134 + ((Value.index / 4) * 70), Value.itemid, Value.num); + } + } + } + } + + //特殊奖励 + DrawItemBase(X - 21 + 672, Y + 204, RewardItemObject.ExReward, 1); + + //消耗道具数量绘制 + L_sq_DrawImg("interface2/cs_shop/cs_packageevent/2021_summer/num_blue.img", 10, X - 21 + 258, Y + 465); + DrawSmallNumber(UseItemInfo.Count); + + //特殊奖励均衡器 + L_sq_DrawImg("interface2/cs_shop/cs_packageevent/2021_summer/hearoursummer.img", 5 + ExRewardSchedule, X - 21 + 459, Y + 431); + } + + function DrawRewardAnimotion(obj) { + if (AnimotionState == 1) { + local Ani = T_DrawDynamicAni(obj, "common/midsummerpartypackage/main_play.ani", X - 21, Y, "MidsummerPartyCR1Effect"); + if (sq_IsEnd(Ani)) { + sq_Rewind(Ani); + AnimotionState = 2; + local obj = sq_GetMyMasterCharacter(); + obj.sq_PlaySound("SUMMERLISTEN_RESULT"); + } + } else if (AnimotionState == 2) { + local Ani = T_DrawDynamicAni(obj, "common/midsummerpartypackage/main_slotchange.ani", X - 21 + 81 + ((NowReawrdObject.index % 4) * 132), Y + 102 + ((NowReawrdObject.index / 4) * 70), "MidsummerPartyCR2Effect"); + if (sq_IsEnd(Ani)) { + sq_Rewind(Ani); + AnimotionState = 3; + } + } else if (AnimotionState == 3) { + local path = "normal"; + if (NowReawrdObject.typ == 1) path = "special"; + local Ani = T_DrawDynamicAni(obj, "common/midsummerpartypackage/reward_" + path + "_00.ani", X - 21, Y, "MidsummerPartyCREffect" + NowReawrdObject.typ); + //特殊奖励 + DrawItemEx(X - 21 + 382, Y + 285, NowReawrdObject.itemid, NowReawrdObject.num); + + OkButtonFlag = true; + } else if (AnimotionState == 4) { + local Ani = T_DrawDynamicAni(obj, "common/midsummerpartypackage/main_slotchange_all.ani", X - 21, Y, "MidsummerPartyCR6Effect"); + if (sq_IsEnd(Ani)) { + sq_Rewind(Ani); + AnimotionState = 0; + } + } + } + + + //绘制等级数字 + function DrawSmallNumber(num) { + num = num.tostring(); + local x = X + 284; + local y = Y + 465; + if (num.len() == 2) x = X + 276; + for (local i = 0; i< num.len(); i++) { + local n = num.slice(i, i + 1); + n = n.tointeger(); + local Img = "interface2/cs_shop/cs_packageevent/2021_summer/num_blue.img"; + L_sq_DrawImg(Img, n, x - 21 + (i * 9), y); + } + } + + function Show(obj) { + DrawMain(obj); + DrawRewardAnimotion(obj); + LenheartNewUI_Windows.Show(obj); + + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + } + + function OpenCallBack() { + //获取基础配置 + GetInfo(); + //获取奖励配置 + GetRewardInfo(); + Visible = true; + ResetFocus(); + } + +} +getroottable().rawdelete("MidsummerParty_Obj"); + +function Lenheart_MidsummerParty_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("MidsummerParty_Obj")) { + RootTab.rawset("MidsummerParty_Obj", true); + local Winobj = LenheartNewUI_CreateWindow(MidsummerPartyC, "希曼音乐会窗口", ((getroottable().Rindro_Scr_Width - 760) / 2).tointeger(), 12, 760, 571, 100); + EventList_Obj.AddEvent("希曼音乐会", 733, Winobj, "interface2/hud/information_button/information_button_cn.img"); + } +} + +getroottable()["LenheartFuncTab"].rawset("MidsummerPartyFuncN", Lenheart_MidsummerParty_Fun); \ No newline at end of file diff --git a/Project/OnilneSign/OnilneSign.nut b/Project/OnilneSign/OnilneSign.nut new file mode 100644 index 0000000..8df02a6 --- /dev/null +++ b/Project/OnilneSign/OnilneSign.nut @@ -0,0 +1,300 @@ +/* +文件名:OnilneSign.nut +路径:Project/OnilneSign/OnilneSign.nut +创建日期:2024-08-10 13:27 +文件用途:在线签到 +*/ + + +class OnilneSignC_ButtonText extends LenheartNewUI_Button { + TextStr = null; + TextX = null; + TextY = null; + TextColor = null; + TextRColor = null; + + TextXoffset = null; + TextYoffset = null; + + Id = null; + + + constructor(X, Y, W, Str) { + LenheartNewUI_Button.constructor(X, Y, W); + this.TextStr = Str; + TextColor = sq_RGBA(185, 148, 96, 255); + TextRColor = sq_RGBA(227, 212, 154, 255); + + TextXoffset = 19; + TextYoffset = 3; + } + + function SetTextColor(RGBA) { + TextColor = RGBA; + } + + function SetTextOffset(gX, gY) { + TextXoffset = gX; + TextYoffset = gY; + } + + function Show(obj) { + LenheartNewUI_Button.Show(obj); + local Color = TextColor; + local SY = Y + TextYoffset; + if (State != 8) { + if (isLBDown) { + SY = Y + TextYoffset + 1; + } + if (isInRect || State == 1) { + Color = TextRColor; + } + } + L_sq_DrawCode(TextStr, X + TextXoffset + 19, SY + 5, Color, 0, 1); + } + + //鼠标左键弹起回调 overr + function OnMouseLbUp(MousePos_X, MousePos_Y) { + if (isLBDown && OnClick) { + local obj = sq_getMyCharacter(); + obj.sq_PlaySound("CLICK_BUTTON1"); + OnClick(Id); + } + isLBDown = false; + } +} + + +class OnilneSignC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + Visible = false; + + //在线时间 + OnlineTime = 0; + //在线天数 + OnlineDay = 0; + //是否可领取的数组 + Reward1Flag = null; + //是否可领取的数组 + Reward2Flag = null; + + Config = null; + Info = null; + PackTime = 0; + + function GetConfigCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + Config = Jso; + } + + function GetMyInfoCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + Info = Jso.info; + OnlineDay = Info.RewardDayCountl; + for (local i = 0; i< 10; i++) { + Reward1Flag[i] = Info.reward.slice(0 + i, 1 + i).tointeger(); + Reward2Flag[i] = Info.reward2.slice(0 + i, 1 + i).tointeger(); + } + PackTime = Clock(); + } + + //获取信息 + function GetInfo() { + local T = { + op = 20065001 + } + SendPackEx(T); + } + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + Reward1Flag = array(10, false); + Reward2Flag = array(10, false); + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + Pack_Control.rawset(20065004, GetConfigCallBack.bindenv(this)); + Pack_Control.rawset(20065002, GetMyInfoCallBack.bindenv(this)); + + + GetInfo(); + } + + function RegisterWidget() { + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(580, 2, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + this.Visible = false; + }.bindenv(this); + Childrens.append(CloseButton); + + + for (local i = 0; i< 10; i++) { + local PostButton = OnilneSignC_ButtonText(21 + (i * 56), 114, 5, "领取"); + PostButton.DWidth = -5; + PostButton.Width = 50; + PostButton.SetTextOffset(-4, 1); + PostButton.Id = i; + PostButton.OnClick = function(Id) { + local Jso = { + op = 20065003, + id = Id, + } + SendPackEx(Jso); + }.bindenv(this); + PostButton.SetCallBackFunc(function(Window) { + if (!Config) return; + local MySuccessTime = Config.config[Window.Id].time; + if (OnlineTime >= MySuccessTime && Reward1Flag[Window.Id] == 0) { + Window.State = 0; + Window.TextStr = "领取"; + Window.SetTextOffset(-4, 1); + } else { + Window.State = 8; + Window.TextStr = (MySuccessTime - OnlineTime) + "秒"; + if (Reward1Flag[Window.Id] == 1) { + Window.TextStr = "已领取"; + Window.SetTextOffset(-9, 1); + } + } + }.bindenv(this)) + AddChild(PostButton); + + local PostButton2 = OnilneSignC_ButtonText(21 + (i * 56), 114 + 80, 5, "领取"); + PostButton2.DWidth = -5; + PostButton2.Width = 50; + PostButton2.SetTextOffset(-4, 1); + PostButton2.Id = i + 10; + PostButton2.OnClick = function(Id) { + local Jso = { + op = 20065003, + id = Id, + } + SendPackEx(Jso); + }.bindenv(this); + PostButton2.SetCallBackFunc(function(Window) { + if (!Config) return; + local MyCumulative = Config.config[Window.Id - 10].cumulative; + if (OnlineDay >= MyCumulative && Reward2Flag[Window.Id - 10] == 0) { + Window.State = 0; + Window.TextStr = "领取"; + Window.SetTextOffset(-4, 1); + } else { + Window.State = 8; + Window.TextStr = (MyCumulative - OnlineDay) + "天"; + if (Reward2Flag[Window.Id - 10] == 1) { + Window.TextStr = "已领取"; + Window.SetTextOffset(-9, 1); + } + } + }.bindenv(this)) + AddChild(PostButton2); + } + } + + + function InterpolateColor(rate) { + if (rate > 1.0) rate = 1.0; + // 起始颜色 (50, 255, 50) + local startColor = [50, 255, 50]; + // 目标颜色 (255, 177, 0) + local endColor = [255, 177, 0]; + + // 计算插值 + local red = startColor[0] + ((endColor[0] - startColor[0]).tofloat() * (rate.tofloat() / 100.0)).tointeger(); + local green = startColor[1] + ((endColor[1] - startColor[1]).tofloat() * (rate.tofloat() / 100.0)).tointeger(); + local blue = startColor[2] + ((endColor[2] - startColor[2]).tofloat() * (rate.tofloat() / 100.0)).tointeger(); + local alpha = 180; // 不透明度 + + return sq_RGBA(red, green, blue, alpha); // 返回 RGBA + } + + + + //绘制主界面 + function DrawMain(obj) { + if (!Config || !Info) return; + //绘制窗口底 + L_sq_DrawWindow(X + 2, Y + 6, 580, 226, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); + L_sq_DrawWindow(X + 10, Y + 25, 584, 224, "interface/windowcommon.img", 204, 4, 14, 4, 14); + //绘制标题栏 + L_sq_DrawImg("onlineevent/main.img", 0, X - 1, Y); + + OnlineTime = (Info.time + (Clock() - PackTime)) / 1000; + local hours = OnlineTime / 3600; + local minutes = (OnlineTime % 3600) / 60; + local secs = OnlineTime % 60; + local Str = "已在线时间: "; + + //绘制已在线时间 + L_sq_DrawCode("已在线时间: " + (Info.time + (Clock() - PackTime)) / 1000 + "秒", X + 26, Y + 42, sq_RGBA(255, 177, 0, 250), 1, 1); + + //绘制距离下次奖励 + L_sq_DrawCode("距离下次奖励", X + 150, Y + 42, sq_RGBA(255, 177, 0, 250), 1, 1); + //绘制实际进度 + local rate = (Info.time + (Clock() - PackTime)).tofloat() / (NextRewardTime.tofloat() * 1000.0); + setClip(X + 240, Y + 41, X + 240 + (332.0 * rate).tointeger(), Y + 42 + 14); + local RGBA = InterpolateColor((rate * 100.0).tointeger()); + L_sq_DrawImg("onlineevent/main.img", 2, X + 240, Y + 42, 1, RGBA, 1.0, 1.0); + releaseClip(); //裁切结束 + //绘制进度条底框 + L_sq_DrawImg("onlineevent/main.img", 1, X + 240, Y + 41); + + //绘制道具奖励 + foreach(Pos, ItemObj in Config.config) { + if (OnlineTime <= ItemObj.time) NextRewardTime = ItemObj.time; + //绘制物品 + DrawItemEx(X + 30 + (Pos * 56) + 3, Y + 80, ItemObj.itemId, ItemObj.itemNum); + //绘制物品2 + DrawItemEx(X + 30 + (Pos * 56) + 3, Y + 160, ItemObj.cumulativeId, ItemObj.cumulativeNum); + } + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + } + + //心跳时间 + HeartTime = 0; + + //下次奖励时间 + NextRewardTime = 0; + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + if (Clock() - HeartTime >= 10000) { + HeartTime = Clock(); + local T = { + op = 20065005 + } + SendPackEx(T); + } + } + + function OpenCallBack() { + Visible = true; + ResetFocus(); + GetInfo(); + } +} +getroottable().rawdelete("OnilneSign_Obj"); + +function Lenheart_OnilneSign_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("OnilneSign_Obj")) { + RootTab.rawset("OnilneSign_Obj", true); + local Win = LenheartNewUI_CreateWindow(OnilneSignC, "在线奖励窗口", ((getroottable().Rindro_Scr_Width - 600) / 2).tointeger(), 160, 600, 260, 22); + EventList_Obj.AddEvent("在线奖励", 28, Win); + } +} + +getroottable()["LenheartFuncTab"].rawset("OnilneSignFuncN", Lenheart_OnilneSign_Fun); \ No newline at end of file diff --git a/Project/OnlineAnnouncement/OnlineAnnouncement.nut b/Project/OnlineAnnouncement/OnlineAnnouncement.nut new file mode 100644 index 0000000..4806297 --- /dev/null +++ b/Project/OnlineAnnouncement/OnlineAnnouncement.nut @@ -0,0 +1,139 @@ +/* +文件名:OnlineAnnouncement.nut +路径:Project/OnlineAnnouncement/OnlineAnnouncement.nut +创建日期:2024-08-24 23:15 +文件用途:上线公告 +*/ +class OnlineAnnouncementC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + NoWindow = true; + + //是否可见 + // Visible = false; + + //公告数组 + NotiArr = null; + //包时间 + Timer = null; + + //收到信息包 + function LaunchAnnouncementCallBack(Chunk) { + local Jso = Json.Decode(Chunk).announ; + local T = { + NotiStrR = Jso["NotiStrR"], + NotiStrG = Jso["NotiStrG"], + NotiStrB = Jso["NotiStrB"], + NotiStrA = Jso["NotiStrA"], + NotiStrXpos = Jso["NotiStrXpos"], + NotiStrYpos = Jso["NotiStrYpos"], + //对应的话语 + NotiStr = Jso["NotiStr"], + //对应话语渐入时间 + NotiStrUpTime = Jso["NotiStrUpTime"], + //对应话语显示时间 + NotiStrPrintTime = Jso["NotiStrPrintTime"], + //对应话语渐出时间 + NotiStrDownTime = Jso["NotiStrDownTime"], + //对应出现的Img路径 + ImgPath = Jso["ImgPath"], + //对应出现的Img帧数 + ImgFrame = Jso["ImgFrame"], + ImgXpos = Jso["ImgXpos"], + ImgYpos = Jso["ImgYpos"], + //对应出现的Img渐入时间 + ImgUpTime = Jso["ImgUpTime"], + //对应出现的Img渐出时间 + ImgDownTime = Jso["ImgDownTime"], + } + NotiArr.append(T); + } + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + NotiArr = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + //回包 + Pack_Control.rawset(20075002, LaunchAnnouncementCallBack.bindenv(this)); + } + + function RegisterWidget() { + // //关闭按钮 + // local CloseButton = LenheartNewUI_BaseButton(278, 0, 11, 12, "interface/lenheartwindowcommon.img", 276); + // CloseButton.OnClick = function() { + // this.Visible = false; + // }.bindenv(this); + // Childrens.append(CloseButton); + + } + + //绘制主界面 + function DrawMain(obj) { + if (NotiArr.len() > 0) { + if (Timer == null) Timer = Clock(); + local T = NotiArr[0]; + local RealT = Clock() - Timer; + + local Ani = null; + if (T.ImgFrame == 99999999) { + Ani = T_DrawDynamicAni(obj, T.ImgPath, T.ImgXpos, T.ImgYpos, T.ImgPath); + } + + //播放完成 + if (RealT >= (T.NotiStrPrintTime + T.NotiStrUpTime + T.NotiStrDownTime)) { + NotiArr.remove(0); + Timer = null; + if (Ani) sq_Rewind(Ani); + return; + } + + local AlaphValue; + //如果时间小于 文字渐入时间 + if (RealT <= T.NotiStrUpTime) { + AlaphValue = sq_GetUniformVelocity(0, T.NotiStrA, RealT, T.NotiStrUpTime); + } + if (RealT > T.NotiStrUpTime && RealT <= (T.NotiStrPrintTime + T.NotiStrUpTime)) { + AlaphValue = T.NotiStrA; + } + if (RealT > (T.NotiStrPrintTime + T.NotiStrUpTime) && RealT <= (T.NotiStrPrintTime + T.NotiStrUpTime + T.NotiStrDownTime)) { + AlaphValue = sq_GetUniformVelocity(T.NotiStrA, 0, RealT, (T.NotiStrPrintTime + T.NotiStrUpTime + T.NotiStrDownTime)); + } + + local RgbaValue = sq_RGBA(T.NotiStrR, T.NotiStrG, T.NotiStrB, AlaphValue); + L_sq_DrawCode(T.NotiStr, T.NotiStrXpos, T.NotiStrYpos, RgbaValue, 1, 1); + + } + } + + function Show(obj) { + LenheartNewUI_Windows.Show(obj); + + } + + function TopShow(obj) { + DrawMain(obj); + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + } + +} + + +function Lenheart_OnlineAnnouncement_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("OnlineAnnouncement_Obj")) { + RootTab.rawset("OnlineAnnouncement_Obj", true); + LenheartNewUI_CreateWindow(OnlineAnnouncementC, "上线公告窗口", 0, 0, 0, 0, 0); + } +} + +getroottable()["LenheartFuncTab"].rawset("OnlineAnnouncementFuncN", Lenheart_OnlineAnnouncement_Fun); \ No newline at end of file diff --git a/Project/RepairWorldMap/RepairWorldMap.nut b/Project/RepairWorldMap/RepairWorldMap.nut new file mode 100644 index 0000000..c0d5231 --- /dev/null +++ b/Project/RepairWorldMap/RepairWorldMap.nut @@ -0,0 +1,134 @@ +/* +文件名:RepairWorldMap.nut +路径:Project/RepairWorldMap/RepairWorldMap.nut +创建日期:2024-08-10 08:04 +文件用途:修补世界地图 +*/ +class RepairWorldMapC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //开启状态 + OpenState = false; + + //不是窗口 + NoWindow = true; + + //是否可见 + Visible = false; + + //世界地图信息 + Info = null; + + //当前城镇编号 + AreaId = 0; + + //下拉框打开Flag + TabbarFlag = false; + + //选中Flag + MarkFlag = -1; + + function GetWorldMap_CallBack(Chunk) { + local Jso = Json.Decode(Chunk); + Info = Jso; + } + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + Pack_Control.rawset(20240802, GetWorldMap_CallBack.bindenv(this)); + L_sq_WAB(0x1031B33, 0x90); + L_sq_WAB(0x1031B34, 0x90); + L_sq_WAB(0x1031B35, 0x90); + L_sq_WAB(0x1031B36, 0x90); + L_sq_WAB(0x1031B37, 0x90); + L_sq_WAB(0x1031B38, 0x90); + } + + function RegisterWidget() { + //三角按钮 + local Button = LenheartNewUI_BaseButton(7, 8, 21, 21, "interface/windowcommon.img", 59); + Button.OnClick = function() { + TabbarFlag = !TabbarFlag; + }.bindenv(this); + Childrens.append(Button); + } + + //绘制主界面 + function DrawMain(obj) { + if (!getroottable().rawin("RINDRO_CONFIG")) { + return; + } + //黑框 + L_sq_DrawImg("interface/minimap_minimap_town.img", 8, 131, 7); + //绘制区域名称 + L_sq_DrawCode(getroottable().RINDRO_CONFIG.region[AreaId].Name, 135, 10, 0xFFFFFFFF, 1, 1); + + if (TabbarFlag) { + foreach(Pos, Value in getroottable().RINDRO_CONFIG.region) { + L_sq_DrawImg("interface/minimap_minimap_town.img", 9, 131, 25 + (Pos * 18)); + // L_sq_DrawWindow(128, 24 + (Pos * 18), 108, 10, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); + L_sq_DrawCode(Value.Name, 135, 28 + (Pos * 18), 0xFFFFFFFF, 1, 1); + if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, 131, 25 + (Pos * 18), 108, 18)) { + MarkFlag = Pos; + L_sq_SetDrawImgModel(2, 0); + L_sq_DrawImg("interface/minimap_minimap_town.img", 16, 131, 25 + (Pos * 18)); + L_sq_ReleaseDrawImgModel(); + } + } + } + } + + //鼠标左键弹起回调 overr + function OnMouseLbUp(MousePos_X, MousePos_Y) { + //还原编队的鼠标指针 + if (this.MarkFlag != -1) { + AreaId = MarkFlag; + L_sq_Select_MiniMap_Index(AreaId + 1); + this.MarkFlag = -1; + } + if (TabbarFlag) TabbarFlag = false; + LenheartNewUI_Windows.OnMouseLbUp(MousePos_X, MousePos_Y); + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + if (!OpenState) { + CloseWindow(); + } + OpenState = false; + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + if (OpenState) { + Visible = true; + ResetFocus(); + } + } + +} +//回调函数 +function Sq_DrawMiniMapUI(obj) { + if ("RepairWorldMap_Obj" in getroottable()) { + RepairWorldMap_Obj.OpenState = true; + } +} + +getroottable().rawdelete("RepairWorldMap_Obj"); + +function Lenheart_RepairWorldMap_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("RepairWorldMap_Obj")) { + RootTab.rawset("RepairWorldMap_Obj", LenheartNewUI_CreateWindow(RepairWorldMapC, "世界地图修补", 230, 0, 30, 30, 0)); + } +} + +getroottable()["LenheartFuncTab"].rawset("RepairWorldMapFuncN", Lenheart_RepairWorldMap_Fun); \ No newline at end of file diff --git a/Project/ServerAuction/ServerAuction.nut b/Project/ServerAuction/ServerAuction.nut new file mode 100644 index 0000000..ba1aacc --- /dev/null +++ b/Project/ServerAuction/ServerAuction.nut @@ -0,0 +1,330 @@ +/* +文件名:ServerAuction.nut +路径:Project/ServerAuction/ServerAuction.nut +创建日期:2024-08-20 10:02 +文件用途:全服竞拍 +*/ +class ServerAuctionC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + Visible = false; + + //竞拍是否开启状态 + AuctionState = false; + //竞拍项目列表 + AuctionItemList = null; + //竞拍名字 + AuctionName = "暂无竞拍开启"; + //当前竞拍信息 + AuctionRealInfo = null; + + //刷新包时间 + PackTimer = 0; + + //是否Gm + IsGm = false; + //Gm可开启竞拍列表 + AuctionList = null; + //Gm选择的开启竞拍Item + SelectAuctionItem = null; + + //展示时间 + InitTime = 0; + //竞拍时间 + ContinuityTime = 0; + + function GetConfigCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + AuctionState = true; + AuctionItemList = Jso.lots; + AuctionName = Jso.name; + //展示时间 + InitTime = Jso.initTime; + //竞拍时间 + ContinuityTime = Jso.continuityTime; + } + + function GetConfig() { + local T = { + op = 20067001 + } + SendPackEx(T); + } + + function GmCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + IsGm = true; + AuctionList = Jso.nameS; + } + + function AuctionRealInfoCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + AuctionRealInfo = Jso; + PackTimer = Clock(); + } + + function CloseAuctionCallBack(Chunk) { + //竞拍是否开启状态 + AuctionState = false; + //竞拍项目列表 + AuctionItemList = null; + //竞拍名字 + AuctionName = "暂无竞拍开启"; + //当前竞拍信息 + AuctionRealInfo = null; + + //刷新包时间 + PackTimer = 0; + + //是否Gm + IsGm = false; + //Gm可开启竞拍列表 + AuctionList = null; + //Gm选择的开启竞拍Item + SelectAuctionItem = null; + + //展示时间 + InitTime = 0; + //竞拍时间 + ContinuityTime = 0; + CloseWindow(); + } + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + AuctionList = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + + //获取竞拍配置 + Pack_Control.rawset(20067010, GetConfigCallBack.bindenv(this)); + //Gm回调包 + Pack_Control.rawset(20067020, GmCallBack.bindenv(this)); + //拍卖实时信息包 + Pack_Control.rawset(20067012, AuctionRealInfoCallBack.bindenv(this)); + //竞拍结束包 + Pack_Control.rawset(20067014, CloseAuctionCallBack.bindenv(this)); + GetConfig(); + } + + //输入框 + InputObject = null; + + function RegisterWidget() { + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(308, 4, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + this.Visible = false; + }.bindenv(this); + CloseButton.SetCallBackFunc(function(win) { + if (AuctionState) { + win.Localtion_X = 308; + win.Localtion_Y = 4; + } else { + win.Localtion_X = 252; + win.Localtion_Y = 2; + } + }.bindenv(this)) + Childrens.append(CloseButton); + + + InputObject = LenheartNewUI_BaseInput(26, 340, 130, 20); + InputObject.SetCallBackFunc(function(win) { + if (AuctionState) win.Localtion_X = 26; + else win.Localtion_X = -826; + }.bindenv(this)) + AddChild(InputObject); + + local PostButton = LenheartNewUI_ButtonText(220, 338, 5, "提交竞拍"); + PostButton.DWidth = 30; + PostButton.Width = 86; + PostButton.SetTextOffset(1, 1); + PostButton.OnClick = function() { + if (InputObject.str.len() > 0 && AuctionRealInfo) { + local Jso = { + op = 20067005, + count = InputObject.str.tointeger(), + } + print(Jso.count); + SendPackEx(Jso); + } + }.bindenv(this); + PostButton.SetCallBackFunc(function(win) { + if (AuctionState) win.Localtion_X = 220; + else win.Localtion_X = -826; + //物品展示阶段 + if (AuctionRealInfo && AuctionRealInfo.state == 0) { + win.State = 8; + win.TextStr = "展示阶段"; + } else { + win.State = 0; + win.TextStr = "提交竞拍"; + } + }.bindenv(this)) + AddChild(PostButton); + + local OpenAuctionButton = LenheartNewUI_ButtonText(220, 393, 5, "开启竞拍"); + OpenAuctionButton.DWidth = 30; + OpenAuctionButton.Width = 86; + OpenAuctionButton.SetTextOffset(1, 1); + OpenAuctionButton.OnClick = function() { + if (SelectAuctionItem != null) { + local Jso = { + op = 20067021, + id = AuctionList[SelectAuctionItem][1] + } + SendPackEx(Jso); + CloseWindow(); + } + }.bindenv(this); + OpenAuctionButton.SetCallBackFunc(function(win) { + if (!AuctionState && IsGm) win.Localtion_X = 95; + else win.Localtion_X = -826; + }.bindenv(this)) + AddChild(OpenAuctionButton); + } + + //绘制主界面 + function DrawMain(obj) { + + if (AuctionState && AuctionRealInfo) { + //绘制背景 + L_sq_DrawImg("interface2/yosin/qfjp.img", 4, X, Y); + //绘制标题 + L_sq_DrawCode(AuctionName, X + 196 - LenheartTextClass.GetStringLength(AuctionName), Y + 6, sq_RGBA(227, 212, 154, 250), 0, 1); + // foreach(Pos, Value in AuctionItemList) { + for (local i = 0; i< 5; i++) { + if (i< AuctionItemList.len()) { + local Pos = i; + local Value = AuctionItemList[i]; + //当前拍品 + if (Pos == AuctionRealInfo.idx && AuctionRealInfo.state == 1) { + local CostItemId = Value.cost; + if (Value.cost == -1) CostItemId = 7906; + if (Value.cost == -2) CostItemId = 133; + //绘制扣除道具 + if (Rindro_ItemInfoObject.rawin(CostItemId)) DrawItemEx(X + 40, Y + 284, CostItemId, 1); + else L_Sq_DrawItem(X + 40, Y + 284, CostItemId, 1, 0, 0, 0); + + local CostName = ""; + if (Value.cost == 0) CostName = "金币"; + else if (Value.cost == -1) CostName = "点券"; + else if (Value.cost == -2) CostName = "代币券"; + else CostName = Rindro_ItemInfoObject[CostItemId].Name; + //绘制扣除道具名字 + L_sq_DrawCode(CostName, X + 79, Y + 300, sq_RGBA(227, 212, 154, 250), 0, 1); + //绘制竞品名 + L_sq_DrawCode(Rindro_ItemInfoObject[Value.itemId].Name, X + 120, Y + 207, sq_RGBA(227, 212, 154, 250), 0, 1); + //绘制最高竞价者 + L_sq_DrawCode(AuctionRealInfo.name, X + 120, Y + 230, sq_RGBA(227, 212, 154, 250), 0, 1); + //绘制最高竞拍价 + L_sq_DrawCode(AuctionRealInfo.costcount.tostring(), X + 120, Y + 252, sq_RGBA(227, 212, 154, 250), 0, 1); + + //绘制当前道具显示框 + L_sq_SetDrawImgModel(2, 0); + L_sq_DrawImg("interface2/yosin/qfjp.img", 3, X + 38 + (Pos * 50), Y + 40); + L_sq_ReleaseDrawImgModel(); + L_sq_DrawImg("interface2/yosin/qfjp.img", 7, X + 38 + (Pos * 50), Y + 40); + + //绘制进度条 + local Rate = (Clock() - PackTimer + AuctionRealInfo.remainder).tofloat() / (ContinuityTime * 1000).tofloat(); + setClip(X + 29, Y + 119, X + 29 + 272 - (272.0 * Rate).tointeger(), Y + 119 + 12); + L_sq_DrawImg("interface2/yosin/qfjp.img", 6, X + 29, Y + 119); + releaseClip(); //裁切结束 + } + + + //绘制拍卖物品 + DrawItemBase(X + 51 + (Pos * 50), Y + 54, Value.itemId, Value.count); + + if (Pos< AuctionRealInfo.idx) { + //绘制道具遮罩框 + L_sq_DrawImg("interface2/yosin/qfjp.img", 5, X + 48 + (Pos * 50), Y + 50, 0, sq_RGBA(255, 255, 255, 150), 1.0, 1.0); + } + } else { + // DrawItemBase(X + 51 + (Pos * 50), Y + 54, Value.itemId, Value.count); + L_sq_DrawImg("interface/lenheartwindowcommon.img", 606, X + 57 + (i * 50), Y + 58); + } + } + + //展示时间绘制 + if (AuctionRealInfo.state == 0) { + local Rate = (Clock() - PackTimer + AuctionRealInfo.remainder).tofloat() / (InitTime * 1000).tofloat(); + setClip(X + 29, Y + 119, X + 29 + 272 - (272.0 * Rate).tointeger(), Y + 119 + 12); + L_sq_DrawImg("interface2/yosin/qfjp.img", 8, X + 29, Y + 119); + releaseClip(); //裁切结束 + //绘制物品展示中 + L_sq_DrawCode("物品展示中", X + 135, Y + 96, sq_RGBA(185, 148, 96, 250), 0, 1); + } + } + //Gm设置页面 + else if (IsGm) { + //绘制窗口底 + L_sq_DrawWindow(X, Y, 260, 372, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); + L_sq_DrawWindow(X + 14, Y + 18, 251, 366, "interface/windowcommon.img", 204, 4, 14, 4, 14); + + foreach(Pos, Value in AuctionList) { + local Rx = X + 23; + local Ry = Y + 31 + (Pos * 30); + L_sq_DrawImg("interface/lenheartwindowcommon.img", 53, Rx, Ry); + L_sq_DrawCode(Value[0], Rx + 6, Ry + 5, 0xff00b1ff, 0, 1); + if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, Rx, Ry, 228, 21)) { + L_sq_DrawImg("interface/lenheartwindowcommon.img", 54, Rx, Ry); + if (MouseClickFlag) { + SelectAuctionItem = Pos; + } + } + if (Pos == SelectAuctionItem) { + L_sq_DrawImg("interface/lenheartwindowcommon.img", 54, Rx, Ry); + } + } + } + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + + MouseClickFlag = false; + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + } + + + MouseClickFlag = false; + //鼠标左键弹起回调 + function OnMouseLbUp(MousePos_X, MousePos_Y) { + MouseClickFlag = true; + LenheartNewUI_Windows.OnMouseLbUp(MousePos_X, MousePos_Y); + } + + function OpenCallBack() { + GetConfig(); + this.Visible = true; + ResetFocus(); + } + +} +getroottable().rawdelete("ServerAuction_Obj"); + +function Lenheart_ServerAuction_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("ServerAuction_Obj")) { + RootTab.rawset("ServerAuction_Obj", true); + local Winobj = LenheartNewUI_CreateWindow(ServerAuctionC, "全服竞拍窗口", ((getroottable().Rindro_Scr_Width - 405) / 2).tointeger(), 64, 405, 372, 28); + EventList_Obj.AddEvent("全服竞拍", 157, Winobj, "interface2/yosin/eventsystemlist.img"); + } +} + +getroottable()["LenheartFuncTab"].rawset("ServerAuctionFuncN", Lenheart_ServerAuction_Fun); \ No newline at end of file diff --git a/Project/Shapeshifting/Shapeshifting.nut b/Project/Shapeshifting/Shapeshifting.nut new file mode 100644 index 0000000..8b8ce5c --- /dev/null +++ b/Project/Shapeshifting/Shapeshifting.nut @@ -0,0 +1,137 @@ +/* +文件名:Shapeshifting.nut +路径:Project/Shapeshifting/Shapeshifting.nut +创建日期:2024-08-24 23:53 +文件用途:时装变身 +*/ +class ShapeshiftingC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + NoWindow = true; + + //是否可见 + // Visible = false; + + //信息 + Info = null; + + //服务器装备配置 + SeverEquInfo = null; + + ShapeMonsterId = null; + + //初始化时间 + Timer = 0; + + //收到信息包 + function GetInfoCallBack(Chunk) { + if (!this) return; + local Jso = Json.Decode(Chunk); + SeverEquInfo = Jso.info; + X = Jso.btnX; + Y = Jso.btnY; + } + + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + Timer = Clock(); + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + //信息包 + Pack_Control.rawset(20074002, GetInfoCallBack.bindenv(this)); + } + + function RegisterWidget() { + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(0, 0, 28, 28, "interface2/yosin/bianshen.img", 0); + CloseButton.OnClick = function() { + if (ShapeMonsterId) { + L_sq_SendPackType(214); + L_sq_SendPackByte(2); + L_sq_SendPackWord(ShapeMonsterId); + L_sq_SendPack(); + } + }.bindenv(this); + CloseButton.SetCallBackFunc(function(Button) { + + }) + Childrens.append(CloseButton); + } + + //绘制主界面 + function DrawMain(obj) { + + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + + } + + + function CheckPlayerInfoToSeverShapeInfo() { + if(!SeverEquInfo)return; + local Toubu = L_sq_GetCharacterAttribute(0x1C, 14); + local Maozi = L_sq_GetCharacterAttribute(0x1C, 13); + local Lianbu = L_sq_GetCharacterAttribute(0x1C, 15); + local Guanghuan = L_sq_GetCharacterAttribute(0x1C, 22); + local Xiongbu = L_sq_GetCharacterAttribute(0x1C, 19); + local Shangyi = L_sq_GetCharacterAttribute(0x1C, 16); + local Pifu = L_sq_GetCharacterAttribute(0x1C, 21); + local Yaobu = L_sq_GetCharacterAttribute(0x1C, 20); + local Xiazhuang = L_sq_GetCharacterAttribute(0x1C, 17); + local Xie = L_sq_GetCharacterAttribute(0x1C, 18); + + foreach(v in SeverEquInfo) { + if (v.Toubu != Toubu && v.Toubu != 0) continue; + if (v.Maozi != Maozi && v.Maozi != 0) continue; + if (v.Lianbu != Lianbu && v.Lianbu != 0) continue; + if (v.Guanghuan != Guanghuan && v.Guanghuan != 0) continue; + if (v.Xiongbu != Xiongbu && v.Xiongbu != 0) continue; + if (v.Shangyi != Shangyi && v.Shangyi != 0) continue; + if (v.Pifu != Pifu && v.Pifu != 0) continue; + if (v.Yaobu != Yaobu && v.Yaobu != 0) continue; + if (v.Xiazhuang != Xiazhuang && v.Xiazhuang != 0) continue; + if (v.Xie != Xie && v.Xie != 0) continue; + ShapeMonsterId = v.MonsterId; + return; + } + ShapeMonsterId = null; + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + + //每五秒获取一次本地数据信息 + if (Clock() - Timer >= 5000) { + Timer = Clock(); + CheckPlayerInfoToSeverShapeInfo(); + } + + if (!ShapeMonsterId) { + Visible = false; + } else { + Visible = true; + } + } + +} +getroottable().rawdelete("Shapeshifting_Obj"); + +function Lenheart_Shapeshifting_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("Shapeshifting_Obj")) { + RootTab.rawset("Shapeshifting_Obj", true); + LenheartNewUI_CreateWindow(ShapeshiftingC, "时装变身窗口", 430, 500, 28, 28, 0); + } +} + +getroottable()["LenheartFuncTab"].rawset("ShapeshiftingFuncN", Lenheart_Shapeshifting_Fun); \ No newline at end of file diff --git a/Project/SkinWarehouse/SkinWarehouse.nut b/Project/SkinWarehouse/SkinWarehouse.nut new file mode 100644 index 0000000..48aabe0 --- /dev/null +++ b/Project/SkinWarehouse/SkinWarehouse.nut @@ -0,0 +1,61 @@ +/* +文件名:SkinWarehouse.nut +路径:Project/SkinWarehouse/SkinWarehouse.nut +创建日期:2024-08-25 09:55 +文件用途:皮肤仓库 +*/ +class SkinWarehouseC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + // Visible = false; + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + } + + function RegisterWidget() { + // //关闭按钮 + // local CloseButton = LenheartNewUI_BaseButton(278, 0, 11, 12, "interface/lenheartwindowcommon.img", 276); + // CloseButton.OnClick = function() { + // this.Visible = false; + // }.bindenv(this); + // Childrens.append(CloseButton); + + } + + //绘制主界面 + function DrawMain(obj) { + + } + + function Show(obj) { + DrawMain(obj); + LenheartNewUI_Windows.Show(obj); + + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + } + +} +getroottable().rawdelete("SkinWarehouse_Obj"); + +function Lenheart_SkinWarehouse_Fun(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("SkinWarehouse_Obj")) { + RootTab.rawset("SkinWarehouse_Obj", true); + LenheartNewUI_CreateWindow(SkinWarehouseC, "皮肤仓库窗口", ((getroottable().Rindro_Scr_Width - 405) / 2).tointeger(), 64, 405, 372, 28); + } +} + +getroottable()["LenheartFuncTab"].rawset("SkinWarehouseFuncN", Lenheart_SkinWarehouse_Fun); \ No newline at end of file diff --git a/Project/Tuguan/Tuguan.nut b/Project/Tuguan/Tuguan.nut new file mode 100644 index 0000000..3da63e1 --- /dev/null +++ b/Project/Tuguan/Tuguan.nut @@ -0,0 +1,410 @@ +/* +文件名:Tuguan.nut +路径:Project/Tuguan/Tuguan.nut +创建日期:2024-08-06 21:53 +文件用途:土罐 +*/ +class Tuguan_NewC extends LenheartNewUI_Windows { + //调试模式 + // DeBugMode = true; + //默认显示状态需要是关闭 因为要通过收包打开 + Visible = false; + + + //初始化状态 + InitState = false; + + //抽奖模式 + OpenFlag = 1; + //主界面音效播放开关 + MainSoundsSw = 0; + ASoundSw = 0; + SSoundSw = 0; + + + State = 0; + BoxId = null; + BoxCount = null; + ProbabilityTab = "www.qq.com"; + + BoxWindowName = "土罐的黄金袖珍罐"; + + + //Ani对象 + P1_01 = null; + P2_01 = null; + P3_01 = null; + P4_02 = null; + MainEffAni = null; + + AniType = null; + RewardObj = null; + + //界面回包 + function TuguanConfigCallBack(Chunk) { + local Jso = Json.Decode(Chunk); + if (State == 0) { + BoxId = Jso.BoxId; + BoxCount = Jso.BoxCount; + ProbabilityTab = Jso.ProbabilityTab; + State = 2; + } + + BoxWindowName = Rindro_ItemInfoObject[BoxId].Name; + Visible = true; + //初始化完成 + InitState = true; + } + + + PackTime = 0; + //抽奖回包 + function TuguanRewardCallBack(Chunk) { + + local Jso = Json.Decode(Chunk); + + AniType = Jso.AniType; + BoxCount = Jso.BoxCount; + RewardObj = Jso.itemBuffers; + PackTime = Clock(); + State = 3; + + } + + + //绘制抽奖动画 + function DrawRewardAni(obj) { + + //停止斗篷风声 + obj.stopSound(2022121701); + + P1_01 = T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/" + AniType + "/" + AniType + "1_01.ani", X + 20, Y + 30, "TuguanSystemDrawReward" + AniType + "1_01" + PackTime); + //土罐眼睛闪光 + if (P1_01 && sq_GetAnimationFrameIndex(P1_01) == 13) { + if (AniType == "a" || AniType == "s") obj.sq_PlaySound("DANJIN_START_AS"); + else obj.sq_PlaySound("DANJIN_START_N"); + } + + if (P1_01 && sq_IsEnd(P1_01)) P2_01 = T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/" + AniType + "/" + AniType + "2_01.ani", X + 20, Y + 30, "TuguanSystemDrawReward" + AniType + "2_01" + PackTime); + if (P2_01 && sq_GetAnimationFrameIndex(P2_01) == 0) { + if (AniType == "b") obj.sq_PlaySound("DANJIN_SUMMON_B"); + else if (AniType == "a") obj.sq_PlaySound("DANJIN_SUMMON_A"); + else if (AniType == "s") obj.sq_PlaySound("DANJIN_SUMMON_S"); + } + if (P2_01 && sq_GetAnimationFrameIndex(P2_01) == 8) { + if (AniType == "b") obj.sq_PlaySound("DANJIN_GAMBLE_B"); + else if (AniType == "a") obj.sq_PlaySound("DANJIN_GAMBLE_A"); + else if (AniType == "s") obj.sq_PlaySound("DANJIN_GAMBLE_S"); + } + + if (P2_01 && sq_IsEnd(P2_01)) P3_01 = T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/" + AniType + "/" + AniType + "3_01.ani", X + 20, Y + 30, "TuguanSystemDrawReward" + AniType + "3_01" + PackTime); + if (P3_01 && sq_IsEnd(P3_01)) P4_02 = T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/" + AniType + "/" + AniType + "4_02.ani", X + 20, Y + 30, "TuguanSystemDrawReward" + AniType + "4_02" + PackTime); + + if (P4_02 && sq_IsEnd(P4_02)) { + P1_01 = null; + P2_01 = null; + P3_01 = null; + P4_02 = null; + obj.sq_PlaySound("DANJIN_GAMBLE_FIN"); + State = 4; + } + } + + + //绘制奖励列表 + function DrawRewardItem(obj) { + //单抽 + if (OpenFlag == 1) { + T_DrawStayAni(obj, "common/tuguan/main.ani", X + 20, Y + 30, 5, "TuguanRewardMain"); + L_sq_DrawCode("最后结果", (X - 195) + 377, (Y - 100) + 182, sq_RGBA(255, 177, 0, 250), 1, 1); + T_DrawStayAni(obj, "common/tuguan/main.ani", X + 20 + 141, Y + 30 + 91, 7, "TuguanRewardMainOneX"); + + for (local z = 0; z< 2; z++) { + //绘制槽 + T_DrawStayAni(obj, "common/tuguan/main.ani", X + 20 + 141 + 9 + (z * 34), Y + 30 + 91 + 9, 8, "TuguanRewardMainOneXx"); + } + for (local x = 0; x< 2; x++) { + //品级背景光 + local Rarity = RewardObj[0][x]["typ"]; + switch (Rarity) { + case 2: + T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/light_iconslot.ani", X + 20 + 141 + 9 + (x * 34), Y + 30 + 91 + 9, "TuguanRewardMainoieff" + Rarity + PackTime); + break; + case 3: + T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/light_iconslot_1.ani", X + 20 + 141 + 9 + (x * 34), Y + 30 + 91 + 9, "TuguanRewardMainoieff" + Rarity + PackTime); + break; + } + } + + + for (local i = 0; i< 2; i++) { + local ItemId = RewardObj[0][i]["itemid"]; + local ItemCount = RewardObj[0][i]["num"]; + //绘制物品 + DrawItemEx(X + 20 + 141 + 9 + (i * 34) + 3, Y + 30 + 91 + 9 + 3, ItemId, ItemCount); + //物品刷新光 + local Ani = T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/common_excute_icon_front_a.ani", X + 20 + 141 + 13 + (i * 34), Y + 30 + 91 + 12, "TuguanRewardMainoieff" + i + PackTime); + + + //品级闪烁光 + local Rarity = RewardObj[0][i]["typ"]; + switch (Rarity) { + case 2: + if (ASoundSw == 0) { + obj.sq_PlaySound("DANJIN_GAMBLE_CLASS_A"); + ASoundSw = 1; + } + local RAni = T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/iconslot_00.ani", X + 20 + 141 + 13 + (i * 34), Y + 30 + 91 + 12, "TuguanRewardMainoreff" + 2 + PackTime); + + break; + case 3: + if (SSoundSw == 0) { + obj.sq_PlaySound("DANJIN_GAMBLE_FANFARE"); + SSoundSw = 1; + } + local RAni = T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/iconslot_01.ani", X + 20 + 141 + 13 + (i * 34), Y + 30 + 91 + 12, "TuguanRewardMainoreff" + 3 + PackTime); + + break; + } + } + + L_sq_DrawCode("祝你发大财!", (X - 195) + 371, (Y - 100) + 320, sq_RGBA(255, 177, 0, 250), 1, 1); + } + //10连抽 + else if (OpenFlag == 10) { + T_DrawStayAni(obj, "common/tuguan/main.ani", X + 20, Y + 30, 6, "TuguanRewardMainT"); + L_sq_DrawCode("最后结果", (X - 195) + 377, (Y - 100) + 142, sq_RGBA(255, 177, 0, 250), 1, 1); + for (local i = 0; i< 10; i++) { + local ofs = i; + if (i > 7) ofs += 1; + T_DrawStayAni(obj, "common/tuguan/main.ani", (X - 195) + 198 + 30 + ((ofs % 4) * 86), Y + 62 + ((ofs / 4) * 50), 7, "TuguanRewardMainTenX"); + + for (local y = 0; y< 2; y++) { + //绘制槽 + T_DrawStayAni(obj, "common/tuguan/main.ani", (X - 195) + 198 + 30 + 9 + ((ofs % 4) * 86) + (y * 34), Y + 62 + 9 + ((ofs / 4) * 50), 8, "TuguanRewardMainOneXx"); + } + + for (local x = 0; x< 2; x++) { + //品级背景光 + local Rarity = RewardObj[i][x]["typ"]; + switch (Rarity) { + case 2: + T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/light_iconslot.ani", (X - 195) + 198 + 30 + 10 + ((ofs % 4) * 86) + (x * 34), Y + 62 + 10 + ((ofs / 4) * 50), "TuguanRewardMainoieff" + Rarity + PackTime); + break; + case 3: + T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/light_iconslot_1.ani", (X - 195) + 198 + 30 + 10 + ((ofs % 4) * 86) + (x * 34), Y + 62 + 10 + ((ofs / 4) * 50), "TuguanRewardMainoieff" + Rarity + PackTime); + break; + } + } + + for (local z = 0; z< 2; z++) { + local ItemId = RewardObj[i][z]["itemid"]; + local ItemCount = RewardObj[i][z]["num"]; + //绘制物品 + L_Sq_DrawItem((X - 195) + 198 + 30 + 9 + ((ofs % 4) * 86) + (z * 34) + 3, Y + 62 + 9 + ((ofs / 4) * 50) + 3, ItemId, ItemCount, 0, 0, 0); + if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, (X - 195) + 198 + 30 + 9 + ((ofs % 4) * 86) + (z * 34) + 3, Y + 62 + 9 + ((ofs / 4) * 50) + 3, 24, 24)) { + ItemInfoDrawS = {}; + ItemInfoDrawS.X <- (X - 195) + 198 + 30 + 9 + ((ofs % 4) * 86) + (z * 34) + 3; + ItemInfoDrawS.Y <- Y + 62 + 9 + ((ofs / 4) * 50) + 3; + ItemInfoDrawS.ItemId <- ItemId; + } + + //物品刷新光 + local Ani = T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/common_excute_icon_front_a.ani", (X - 195) + 198 + 30 + 13 + ((ofs % 4) * 86) + (z * 34), Y + 62 + 12 + ((ofs / 4) * 50), "TuguanRewardMainoieff" + z + PackTime); + + + //品级闪烁光 + local Rarity = RewardObj[i][z]["typ"]; + switch (Rarity) { + case 2: + if (ASoundSw == 0) { + obj.sq_PlaySound("DANJIN_GAMBLE_CLASS_A"); + ASoundSw = 1; + } + local RAni = T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/iconslot_00.ani", (X - 195) + 198 + 30 + 13 + ((ofs % 4) * 86) + (z * 34), Y + 62 + 12 + ((ofs / 4) * 50), "TuguanRewardMainoreff" + 2 + PackTime); + + break; + case 3: + if (SSoundSw == 0) { + obj.sq_PlaySound("DANJIN_GAMBLE_FANFARE"); + SSoundSw = 1; + } + local RAni = T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/iconslot_01.ani", (X - 195) + 198 + 30 + 13 + ((ofs % 4) * 86) + (z * 34), Y + 62 + 12 + ((ofs / 4) * 50), "TuguanRewardMainoreff" + 3); + + break; + } + } + } + + L_sq_DrawCode("祝你发大财!", (X - 195) + 371, (Y - 100) + 336, sq_RGBA(255, 177, 0, 250), 1, 1); + } + MainEffAni = T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/background_excute_front_supreme.ani", X + 20, Y + 30, "TuguanSystemDrawRewardMainAniL" + PackTime); + + } + + + //播放主界面音效 + function PlayMainSounds(obj) { + if (State == 2 && MainSoundsSw == 0) { + obj.sq_PlaySound("DANJIN_START_LOOP", 2022121701); + MainSoundsSw = 1; + } + if (State != 2 && State != 3) { + obj.stopSound(2022121701); + MainSoundsSw = 0; + } + if (State != 4) { + SSoundSw = 0; + ASoundSw = 0; + } + } + + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + Childrens = []; + //注册控件 + RegisterWidget(); + + LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + + + //土罐开启界面回包 + Pack_Control.rawset(20071004, TuguanConfigCallBack.bindenv(this)); + //抽奖奖励回包 + Pack_Control.rawset(20071008, TuguanRewardCallBack.bindenv(this)); + } + + function RegisterWidget() { + //关闭按钮 + local CloseButton = LenheartNewUI_BaseButton(386, 2, 11, 12, "interface/lenheartwindowcommon.img", 276); + CloseButton.OnClick = function() { + this.Visible = false; + }.bindenv(this); + Childrens.append(CloseButton); + + //单抽复选框 + local OneOpenBtn = LenheartNewUI_SwitchButtonText(16 + 50, 30 + 253, "开启1个"); + OneOpenBtn.ImgIndex = 358; + OneOpenBtn.SetTextPos(12, 2); + OneOpenBtn.Width = 76; + OneOpenBtn.Height = 16; + OneOpenBtn.OnClick = function() { + switch (OpenFlag) { + case 1: + OpenFlag = 10; + break; + case 10: + OpenFlag = 1; + break; + } + State = 2; + }.bindenv(this); + OneOpenBtn.SetCallBackFunc(function(obj) { + if (OpenFlag == 1) obj.State = 1; + else obj.State = 0; + }.bindenv(this)); + AddChild(OneOpenBtn); + + //单抽复选框 + local TenOpenBtn = LenheartNewUI_SwitchButtonText(16 + 50 + 204, 30 + 253, "开启10个"); + TenOpenBtn.ImgIndex = 358; + TenOpenBtn.SetTextPos(12, 2); + TenOpenBtn.Width = 76; + TenOpenBtn.Height = 16; + TenOpenBtn.OnClick = function() { + switch (OpenFlag) { + case 1: + OpenFlag = 10; + break; + case 10: + OpenFlag = 1; + break; + } + State = 2; + }.bindenv(this); + TenOpenBtn.SetCallBackFunc(function(obj) { + if (OpenFlag == 10) obj.State = 1; + else obj.State = 0; + }.bindenv(this)); + AddChild(TenOpenBtn); + + + //搜索按钮 + local ProbabilityButton = LenheartNewUI_ButtonText(18, 28 + 290, 5, "※查看概率"); + ProbabilityButton.Idx = 74; //很小的图 这样就不会显示按钮了 + ProbabilityButton.SetTextOffset(-14, 1); + ProbabilityButton.OnClick = function() { + L_Cmd("start iexplore.exe " + ProbabilityTab); + }.bindenv(this); + AddChild(ProbabilityButton); + + //抽奖按钮 + local OpenButton = LenheartNewUI_ButtonText(18 + 157, 66 + 280, 5, "开启"); + OpenButton.SetTextOffset(-1, 1); + OpenButton.OnClick = function() { + local T = { + op = 20071005, + Num = OpenFlag + } + SendPackEx(T); + }.bindenv(this); + AddChild(OpenButton); + } + + + //绘制主界面 + function DrawMain(obj) { + if (!InitState) return; + + //窗口 + L_sq_DrawImg("tuguan/main.img", 0, X, Y); + //标题 + L_sq_DrawCode(BoxWindowName, X + 200 - LenheartTextClass.GetStringLength(BoxWindowName) / 2, Y + 6, sq_RGBA(230, 200, 155, 250), 1, 1); + + //动画 + if (State == 2) T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/lobby/lobby_wait_rank_1step_1_step_common_0510_danjin_body.ani", X + 20, Y + 30, "New_TuguanSystemMainbackgroundeff"); + //抽奖动画 + if (State == 3) { + DrawRewardAni(obj); + } + //奖励列表 + if (State == 4) { + DrawRewardItem(obj); + } + //遮罩 + T_DrawStayAni(obj, "common/tuguan/main.ani", X + 17, Y + 26, 1, "TuguanSystemMainbackgroundblack"); + //图标框 + T_DrawStayAni(obj, "common/tuguan/main.ani", X + 187, Y + 26 + 250, 3, "TuguanSystemMainbackgrounditem"); + //盒子数量 + DrawItemEx(X + 187 + 3, Y + 26 + 250 + 3, BoxId, BoxCount); + // if (State == 2) ItemInfoDrawS = null; + } + + function Show(obj) { + DrawMain(obj); + //播放主界面音效 + PlayMainSounds(obj); + LenheartNewUI_Windows.Show(obj); + + } + + //逻辑入口 + function Proc(obj) { + LenheartNewUI_Windows.SyncPos(X, Y); + } + +} + + +getroottable().rawdelete("Tuguan_NewC_Obj"); + +function Lenheart_Tuguan_New(obj) { + local RootTab = getroottable(); + if (!RootTab.rawin("Tuguan_NewC_Obj")) { + RootTab.rawset("Tuguan_NewC_Obj", true); + LenheartNewUI_CreateWindow(Tuguan_NewC, "新土罐窗口", ((getroottable().Rindro_Scr_Width - 405) / 2).tointeger(), 64, 405, 372, 28); + } +} + +getroottable()["LenheartFuncTab"].rawset("Lenheart_Tuguan_NewFunc", Lenheart_Tuguan_New); \ No newline at end of file diff --git a/folder-alias.json b/folder-alias.json new file mode 100644 index 0000000..0023ac2 --- /dev/null +++ b/folder-alias.json @@ -0,0 +1,101 @@ +{ + "Project": { + "description": "项目目录" + }, + "Project/Tuguan": { + "description": "土罐" + }, + "Project/Tuguan/Tuguan.nut": { + "description": "土罐文件" + }, + "Base/PackControl": { + "description": "收包管理" + }, + "Base/_ENUM": { + "description": "枚举" + }, + "Base/_ENUM/_ENUM_KEY.nut": { + "description": "键盘枚举" + }, + "Base/_Table": { + "description": "储存数据" + }, + "Base/_Tool": { + "description": "工具" + }, + "Base/_Tool/BaseTool_Class.nut": { + "description": "基础工具类" + }, + "Base/_Z_Data": { + "description": "数据" + }, + "Base/_Z_Data/ItemData.nut": { + "description": "Item数据" + }, + "Base/CallBack/DrawMain.nut": { + "description": "绘制入口" + }, + "Base/CallBack/Window_Get.nut": { + "description": "原始窗口HOOK" + }, + "Project/HellExLogic": { + "description": "特殊深渊派对逻辑" + }, + "Base/CallBack/GetDamageRate.nut": { + "description": "获取伤害倍率" + }, + "Project/RepairWorldMap": { + "description": "修补世界地图" + }, + "Project/OnilneSign": { + "description": "在线签到" + }, + "Project/FightSign": { + "description": "刷图签到" + }, + "Base/UI/Lenheart_UI_Class.nut": { + "description": "UI类" + }, + "Project/CombatRank": { + "description": "战斗力系统" + }, + "Project/Anton": { + "description": "安图恩" + }, + "Project/AradPass": { + "description": "战令" + }, + "Base/UI/Lenheart_Event_Class.nut": { + "description": "活动图表类" + }, + "Project/MidsummerParty": { + "description": "希曼音乐会" + }, + "Project/ServerAuction": { + "description": "全服竞拍" + }, + "Project/OnlineAnnouncement": { + "description": "上线公告" + }, + "Project/Shapeshifting": { + "description": "时装变身" + }, + "Project/SkinWarehouse": { + "description": "皮肤仓库" + }, + "Base/UI/Lenheart_Character_Info_Class.nut": { + "description": "个人信息属性面板" + }, + "Project/HudUi": { + "description": "界面ui" + }, + "Base/CallBack/PushDamage.nut": { + "description": "push伤害" + }, + "Project/DamagePerSecond": { + "description": "秒伤统计" + }, + "Project/CollectionBox": { + "description": "收集箱" + } +} \ No newline at end of file