/* 文件名:FiendwarHallMyParty.nut 路径:Plugins/Fiendwar/FiendwarHallMyParty.nut 创建日期:2024-03-27 19:18 文件用途: */ //编队用按钮需要传递参数所以重写 class FiendwarHallMyPartyEdit_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 FiendwarHallMyPartyEditC extends LenheartNewUI_Windows { //调试模式 // DeBugMode = true; PartyMarkFlag = 0; 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); Childrens.append(CloseButton); //搜索按钮 local QdButton = LenheartNewUI_ButtonText(10, 157, 5, "签到"); QdButton.State = 8; QdButton.SetTextOffset(0, 1); QdButton.OnClick = function() { if (InputObject.str.len() > 0) { } }.bindenv(this); Childrens.append(QdButton); //解散队伍按钮 local BreakPartyButton = LenheartNewUI_ButtonText(80, 158, 5, "解散队伍"); BreakPartyButton.SetTextOffset(-12, 1); BreakPartyButton.OnClick = function() { }.bindenv(this); Childrens.append(BreakPartyButton); //关闭按钮 local CloseButton = LenheartNewUI_ButtonText(150, 158, 5, "关闭"); CloseButton.SetTextOffset(0, 1); CloseButton.OnClick = function() { CloseWindow(); }.bindenv(this); Childrens.append(CloseButton); for (local i = 0; i< 8; i++) { //右翻页按钮 local PartyIndexButton = FiendwarHallMyPartyEdit_BaseButton(12 + (i % 2 * 136), 35 + ((i / 2) * 30), 41, 17, "interface/newstyle/windows/party/party_icon.img", 3 + (i * 3), i + 1); //继承类 并重写 调用时传入InfoIndex PartyIndexButton.OnClick = function(MyInfoIndex) { PartyMarkFlag = MyInfoIndex; local T = { op = 20063015, teamsId = 2, cidNew = 15 num = 1 } BasicsDrawTool.SendPackEx(T); }.bindenv(this); Childrens.append(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 != 0) { // L_sq_WA(0x1b46898, 16); // L_sq_WA(0x1b46898, 47); } } function Show(obj) { DrawMain(obj); LenheartNewUI_Windows.Show(obj); } //逻辑入口 function Proc(obj) { LenheartNewUI_Windows.SyncPos(X, Y); } } //角色交互按钮需要传递参数所以重写 class FiendwarHallPlayerInteractive_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(FiendwarHallPlayerInteractiveC, "超时空玩家交互", 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 FiendwarHallPlayerInteractiveC extends LenheartNewUI_Windows { // DeBugMode = true; HandBoxColor = [ 0xff717272, 0xff7b2a29, 0xff874e0d, 0xff8b8108, 0xff658e2d, 0xff0f5c8a, 0xff27238f, 0xff4e2491, 0xff932586, ] //X Y 裁切开始X Y 裁切结束X Y OffsetArr = [ //男鬼剑士 [45, 103, 230, 231], //女格斗家 [56, 102, 235, 279], //男神枪手 [52, 130, 238, 246], //女魔法师 [55, 87, 234, 293], //男圣职者 [42, 115, 223, 200], //女神枪手 [52, 119, 226, 209], //暗夜使者 [56, 102, 225, 226], //男格斗家 [50, 114, 239, 216], //男魔法师 [54, 103, 236, 276], //黑暗武士 [46, 102, 229, 232], //缔造者 [56, 86, 235, 293], ] InfoObj = null; constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { Childrens = []; LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); } //初始化Flag 初始化以后才显示 InitInfoFlag = false; function InitInfo() { Childrens = []; //还原标签数量 InitIndexFlag = 1; //还原高度 Height = 21; //还原可见性 Visible = true; //置顶窗口 ResetFocus(); RegisterWidget(); InitInfoFlag = true; } InitIndexFlag = 1; function RegisterWidget() { //是团长才能委任 if (FiendwarTotal.GetInstance().IsCaptain && !("IsMyself" in InfoObj)) { //委任团长按钮 local GiveMasterButton = FiendwarHallPlayerInteractive_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); Childrens.append(GiveMasterButton); InitIndexFlag++; Height += 21; } //查看信息按钮 local CheckInfoButton = FiendwarHallPlayerInteractive_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); Childrens.append(CheckInfoButton); InitIndexFlag++; Height += 21; if (!("IsMyself" in InfoObj)) { //交易按钮 local TransactionButton = FiendwarHallPlayerInteractive_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); Childrens.append(TransactionButton); InitIndexFlag++; Height += 21; //攻坚队员强退按钮 local KickMemberButton = FiendwarHallPlayerInteractive_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 = 20063021, teamsId = InfoObj.PartyId, charCid = InfoObj.Cid } BasicsDrawTool.SendPackEx(T); }.bindenv(this); Childrens.append(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.D[0] + X + OffsetArr[InfoObj.Job][0] - 40; local AYpos = AvatarObj.D[1] + 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.C, AXpos, AYpos); releaseClip(); //裁切结束 } LenheartNewUI_Windows.Show(obj); } function Proc(obj) { LenheartNewUI_Windows.SyncPos(X, Y); } } //队员显示类 class FiendwarHallMyPartyMemberC extends LenheartNewUI_CommonUi { X = 0; Y = 0; Width = null; Height = null; InfoObj = null; //选中状态 SelectState = false; //攻坚状态 OffensiveState = 0; HandBoxColor = [ 0xff717272, 0xff7b2a29, 0xff874e0d, 0xff8b8108, 0xff658e2d, 0xff0f5c8a, 0xff27238f, 0xff4e2491, 0xff932586, ] //X Y 裁切开始X Y 裁切结束X Y OffsetArr = [ //男鬼剑士 [45, 103, 230, 231], //女格斗家 [56, 102, 235, 279], //男神枪手 [52, 130, 238, 246], //女魔法师 [55, 87, 234, 293], //男圣职者 [42, 115, 223, 200], //女神枪手 [52, 119, 226, 209], //暗夜使者 [56, 102, 225, 226], //男格斗家 [50, 114, 239, 216], //男魔法师 [54, 103, 236, 276], //黑暗武士 [46, 102, 229, 232], //缔造者 [56, 86, 235, 293], ] constructor(gInfoObj) { InfoObj = gInfoObj; this.Width = 458; this.Height = 21; this.OnClick = function() { local Win = LenheartNewUI_CreateWindow(FiendwarHallMyPartyC, "超时空我的队伍窗口", 430, 15, 354, 290, 18); //还原其他 选中自己 foreach(Obj in Win.MembersList) { Obj.SelectState = false; } SelectState = !SelectState; local Each = LenheartNewUI_CreateWindow(FiendwarHallPlayerInteractiveC, "超时空玩家交互", 0, 0, 100, 21, 0); //改变鼠标坐标 Each.X = MousePos_X; Each.Y = MousePos_Y; //赋值对象参数 Each.InfoObj = InfoObj; //对象不是我才能点开交互按钮 if (InfoObj.Cid == FiendwarTotal.GetInstance().MyCid) { Each.InfoObj.IsMyself <- true; } //刷新UI Each.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) { //绘制底槽 L_sq_DrawImg("hud/fiendwarl.img", 12, X, Y); //绘制队伍编号 // L_sq_DrawImg("interface2/raid/raidcommon/partypinslot_medium/partypinslot_medium.img", 0, X, Y); L_sq_DrawImg("interface/newstyle/windows/party/party_icon.img", InfoObj.TeamId * 3, X, Y + 1); // L_sq_DrawCode(TeamObj.TeamId, X + 22 - LenheartTextClass.GetStringLength(TeamObj.TeamId) / 2, Y + 5, sq_RGBA(134, 120, 79, 255), 0, 1); sq_DrawBox(X + 42, Y + 1, 22, 18, HandBoxColor[InfoObj.TeamId]); //绘制队长头像 foreach(AvatarObj in InfoObj.EquVos) { local AXpos = AvatarObj.D[0] + X + OffsetArr[InfoObj.Job][0]; local AYpos = AvatarObj.D[1] + 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.C, AXpos, AYpos); releaseClip(); //裁切结束 // } } //绘制等级 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.StkHasFlag) { L_sq_DrawImg("hud/fiendwarlstk.img", 0, X + 280, Y + 3); } else if (InfoObj.Name != L_Sq_GetObjectName(sq_GetMyMasterCharacter())) { L_sq_DrawImg("hud/fiendwarlstk.img", 1, X + 280, Y + 3); } if (SelectState) { L_sq_DrawImg("hud/fiendwarl.img", 13, X, Y); } if (isInRect) { L_sq_DrawImg("hud/fiendwarl.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); } } class FiendwarHallMyPartyC extends LenheartNewUI_Windows { //调试模式 // DeBugMode = true; //队员列表 MembersList = null; //队伍名称 TeamName = ""; //队伍ID TeamID = 99999999; //是否是我的攻坚队 IsMyTeam = false; //是否是队长 IsCaptain = false; //收到请求加入攻坚队包 function JoinTeamCallBack(Chunk) { // Sout("收到请求加入包 : \n\n\n %L", Chunk); local Jso = Json.Decode(Chunk); local win = LenheartNewUI_CreateWindow(FiendwarHallApplyJoinC, "超时空申请加入队伍窗口", 542, 348, 257, 240, 18); win.Visible = true; 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, } //没人 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(20063006, JoinTeamCallBack.bindenv(this)); } function RegisterWidget() { //清楚老的按钮在刷新 foreach(CIndex, Child in Childrens) { if (!(Child instanceof FiendwarHallMyPartyMemberC)) { Childrens.remove(CIndex); } } //关闭按钮 local CloseButton = LenheartNewUI_BaseButton(336, 0, 11, 12, "interface/lenheartwindowcommon.img", 276); CloseButton.OnClick = function() { CloseWindow(); }.bindenv(this); Childrens.append(CloseButton); if (!IsMyTeam) { local JoinPartyButton = LenheartNewUI_ButtonText(10, 268, 10, "参加攻坚队"); JoinPartyButton.SetTextOffset(-15, 1); JoinPartyButton.OnClick = function() { local T = { op = 20063005, teamsId = TeamID, items = [L_sq_GetCharacterAttribute(0x1c, 21), L_sq_GetCharacterAttribute(0x1c, 15), L_sq_GetCharacterAttribute(0x1c, 14), L_sq_GetCharacterAttribute(0x1c, 13)], } BasicsDrawTool.SendPackEx(T); }.bindenv(this); Childrens.append(JoinPartyButton); return; } //队伍按钮 local ModelButton = LenheartNewUI_ButtonText(9, 60, -18, "队伍"); ModelButton.Idx = 163; ModelButton.DWidth = -8; ModelButton.SetTextOffset(-9, 1); Childrens.append(ModelButton); //等级按钮 local StateButton = LenheartNewUI_ButtonText(51, 60, -18, "等级"); StateButton.Idx = 163; StateButton.DWidth = -8; StateButton.SetTextOffset(-9, 1); Childrens.append(StateButton); //角色名按钮 local ChannelButton = LenheartNewUI_ButtonText(93, 60, 44, "角色名"); ChannelButton.Idx = 163; ChannelButton.DWidth = 120; ChannelButton.FillWidth = 1; ChannelButton.FirstWidth = 21; ChannelButton.SetTextOffset(17, 1); Childrens.append(ChannelButton); //攻坚队名称按钮 local PartyNameButton = LenheartNewUI_ButtonText(196, 60, 36, "职业名"); PartyNameButton.Idx = 163; PartyNameButton.DWidth = 100; PartyNameButton.FillWidth = 1; PartyNameButton.FirstWidth = 21; PartyNameButton.SetTextOffset(11, 1); Childrens.append(PartyNameButton); //入场材料按钮 local StageButton = LenheartNewUI_ButtonText(289, 60, 0, "入场材料"); StageButton.Idx = 163; StageButton.DWidth = 26; StageButton.FillWidth = 1; StageButton.FirstWidth = 21; StageButton.SetTextOffset(-14, 1); Childrens.append(StageButton); if (IsCaptain) { //队伍编制按钮 local PartyEditButton = LenheartNewUI_ButtonText(10, 268, 5, "队伍编制"); PartyEditButton.SetTextOffset(-12, 1); PartyEditButton.OnClick = function() { local win = LenheartNewUI_CreateWindow(FiendwarHallMyPartyEditC, "超时空我的队伍编队窗口", 105, 40, 294, 192, 18); win.Visible = true; }.bindenv(this); Childrens.append(PartyEditButton); //修改信息按钮 local FqButton = LenheartNewUI_ButtonText(100, 267, 5, "修改信息"); FqButton.State = 8; FqButton.SetTextOffset(-12, 1); Childrens.append(FqButton); //队伍招募按钮 local FqButton1 = LenheartNewUI_ButtonText(160, 267, 5, "队伍招募"); FqButton1.State = 8; FqButton1.SetTextOffset(-12, 1); Childrens.append(FqButton1); } //退出按钮 local ExitButton = LenheartNewUI_ButtonText(220, 268, 5, "退出"); ExitButton.SetTextOffset(-1, 1); ExitButton.OnClick = function() { local T = { op = 20063009, teamsId = TeamID } BasicsDrawTool.SendPackEx(T); }.bindenv(this); Childrens.append(ExitButton); } //绘制主界面 function DrawMain(obj) { //标题栏 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, 250, "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/fiendwarl.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(FiendwarHallPlayerInteractiveC, "超时空玩家交互", X, Y, 100, 21, 0); Each.Visible = false; } } }