/* 文件名:antontownmainpartylist.nut 路径:Plugins/Anton/antontownmainpartylist.nut 创建日期:2022-09-04 09:03 文件用途:城镇中打开安图恩攻坚队面板攻坚队列表部分 */ class AntonTownMainControl_PartyList_C extends BasicsDrawTool { X = 37; Y = 38; ListUiMap = null; //小队成员UI Map ListInfoMap = null; //小队成员Info Map ListCount = null; NowSelectTeam = null; NowSelectTeamFunc = null; //当前选择队伍功能 MyTeamId = -1; //我的队伍Id MyCaptainControl = 0; //我是否为攻坚队长 ReloadingButtonObject = null; //刷新按钮 MyTeamButtonObject = null; //我的队伍按钮 LeftButtonObject = null; //左按钮 RightButtonObject = null; //右按钮 PartyReqButtonObject = null; //申请加入攻坚队伍按钮 PartyExitButtonObject = null; //退出攻坚队伍按钮 PartyStartButtonObject = null; //开始攻坚按钮 Page = 1; //获取汉字偏移 function GetOffserFromLen(char, offset) { return (char.len() * offset) } function RedAntonListInfo(chunk) { //Sout("\n\n收到包数据: %L", chunk); local RootTab = getroottable(); BasicsDrawTool.InitClass("AntonTownListJson"); //自动判断清空 local JsonObj = Json_STL("AntonTownListJsonBuffer"); RootTab.rawset("AntonTownListJson", JsonObj); RootTab["AntonTownListJson"].Parse(chunk, 0, false); //清空自己的信息 RootTab["ANTONTOWNMAINCONTROLLIST"].ListInfoMap = []; //获取自己的攻坚队ID local gMyTeamId = RootTab["AntonTownListJson"].Get("MyTeamId"); if (gMyTeamId) RootTab["ANTONTOWNMAINCONTROLLIST"].MyTeamId = gMyTeamId; //获取自己是否为攻坚队队长 local gMyCaptain = RootTab["AntonTownListJson"].Get("MyCaptain"); if (gMyCaptain) RootTab["ANTONTOWNMAINCONTROLLIST"].MyCaptainControl = gMyCaptain; RootTab["ANTONTOWNMAINCONTROLLIST"].ListCount = RootTab["AntonTownListJson"].Get("ListCount").tointeger(); //写入小队成员信息 for (local i = 0; i < RootTab["ANTONTOWNMAINCONTROLLIST"].ListCount; i++) { local gTeamId = RootTab["AntonTownListJson"].Get("result->" + i + "->TeamId"); //得到攻坚队伍ID if (gTeamId == true || gTeamId == false) break; //如果读不到说明读完了 直接走 local gTeamName = RootTab["AntonTownListJson"].Get("result->" + i + "->TeamName"); //得到攻坚队名称 local gState = RootTab["AntonTownListJson"].Get("result->" + i + "->State"); //得到队伍状态 local gTeamPlayerCount = RootTab["AntonTownListJson"].Get("result->" + i + "->TeamPlayerCount"); //得到队伍人数 local ListTab = { TeamId = gTeamId, TeamName = gTeamName, State = gState, TeamPlayerCount = gTeamPlayerCount, } RootTab["ANTONTOWNMAINCONTROLLIST"].ListInfoMap.append(ListTab); //ListTabInfoTable丢进数组 } } constructor() { ListUiMap = []; ListInfoMap = []; ListUiMap.resize(10); Pack_Control.rawset(1008, RedAntonListInfo); Pack_Control.rawset(1010, RedAntonListInfo); } //功能按钮 function FuncButtonC(obj, YposOffset, AniIndex) { local FuncThis = null; if (FuncThis == null) { FuncThis = AntonButtonPro(obj, "" + MyTeamId + FuncThis + "Func", X + 360, Y - 32 + YposOffset, "common/anton/funcbutton.ani", 100, 21, AniIndex); FuncThis.SetRectEnble(true, "" + MyTeamId + FuncThis + "Func", X + 360, Y - 32 + YposOffset, "common/anton/funcbutton.ani", AniIndex + 1); FuncThis.SetCustomClickEnble(true, "" + MyTeamId + FuncThis + "FuncSwitchButtonc", X + 360, Y - 32 + YposOffset, "common/anton/funcbutton.ani", AniIndex + 2); } FuncThis.Show(); return FuncThis; } //绘制背景框 function DrawMainBackGround(obj) { //绘制主界面 { T_DrawStayAni(obj, "common/anton/new/newbaseui.ani", X, Y, 0, "安图恩队伍列表界面"); } } //绘制攻坚队伍页面控制 function DrawPartyListPageConctrl(obj) { //绘制攻坚队伍数量 local ListMaxPage = (ListCount / 12).tointeger() + 1; L_Code_STL(Page.tostring() + " / " + ListMaxPage.tostring(), X + 41, Y + 293, 0xFFFFFFFF, 1); //如果不止1页 if (ListMaxPage > 1) { //左按钮 { if (LeftButtonObject == null) { LeftButtonObject = AntonButtonPro(obj, "AntonPartyListLeftButton", X + 17, Y + 292, "common/anton/new/newbasebutton.ani", 15, 13, 0); LeftButtonObject.SetRectEnble(true, "AntonPartyListLeftButtonr", X + 17, Y + 292, "common/anton/new/newbasebutton.ani", 1); LeftButtonObject.SetCustomClickEnble(true, "AntonPartyListLeftButtonc", X + 17, Y + 293, "common/anton/new/newbasebutton.ani", 2); } LeftButtonObject.Show(); if (LeftButtonObject.isLBActive()) { obj.sq_PlaySound("CLICK_BUTTON2"); if (Page > 1) --Page; local GetAntonTeamList = Json_STL("GetAntonTeamList"); GetAntonTeamList.Put("op", 1007); GetAntonTeamList.Put("Page", Page); local str = GetAntonTeamList.GetString(); L_sq_SendPackType(130); L_sq_SendPackWChar(str); L_sq_SendPack(); GetAntonTeamList.Delete(); } } //右按钮 { if (RightButtonObject == null) { RightButtonObject = AntonButtonPro(obj, "AntonPartyListRightButton", X + 75, Y + 292, "common/anton/new/newbasebutton.ani", 15, 13, 3); RightButtonObject.SetRectEnble(true, "AntonPartyListRightButtonr", X + 75, Y + 292, "common/anton/new/newbasebutton.ani", 4); RightButtonObject.SetCustomClickEnble(true, "AntonPartyListRightButtonc", X + 75, Y + 293, "common/anton/new/newbasebutton.ani", 5); } RightButtonObject.Show(); if (RightButtonObject.isLBActive()) { obj.sq_PlaySound("CLICK_BUTTON2"); if (Page < ListMaxPage) ++Page; local GetAntonTeamList = Json_STL("GetAntonTeamList"); GetAntonTeamList.Put("op", 1007); GetAntonTeamList.Put("Page", Page); local str = GetAntonTeamList.GetString(); L_sq_SendPackType(130); L_sq_SendPackWChar(str); L_sq_SendPack(); GetAntonTeamList.Delete(); } } } } //绘制攻坚队列表信息 function DrawPartyListInfo(obj) { //已经开始的 0xFF676665 灰色 //可以申请的 0xFFddddea 珍珠白 //可以申请的 0xFF4990aa 定义黄 local Min = 0 + (12 * (Page - 1)); local Max = 12 * Page; for (local i = Min; i < ListCount % Max; ++i) { T_DrawStayAni(obj, "common/anton/new/newbaseui.ani", X + 15, Y + 61 + (19 * i), 1, "安图恩队伍列表底框" + i); //阶段 local stage = 5; if (ListInfoMap[i].State >= 1 && ListInfoMap[i].State <= 3) stage = 6; if (ListInfoMap[i].State >= 4 && ListInfoMap[i].State <= 5) stage = 7; if (ListInfoMap[i].State >= 6) stage = 8; T_DrawStayAni(obj, "common/anton/new/newbaseui.ani", X + 18, Y + 62 + (19 * i), stage, "安图恩队伍列表底框" + stage); local Color = null; if (ListInfoMap[i].State != 3) { Color = 0xFF4990aa; } else { Color = 0xFF676665; } //绘制攻坚队名称 local TeamNameStr = ListInfoMap[i].TeamName; L_Code_STL(TeamNameStr, X + 60, Y + 64 + (19 * i), Color, 1); //绘制攻坚队人数 local PlayerCountStr = ListInfoMap[i].TeamPlayerCount + "/20"; L_Code_STL(PlayerCountStr, X + 205, Y + 64 + (19 * i), Color, 1); ListUiMap[i] = AntonButtonPro(obj, "AntonPartyListSwitchButton" + TeamNameStr, X + 15, Y + 61 + (19 * i), "common/anton/new/newnull.ani", 255, 15, 0); ListUiMap[i].SetRectEnble(true, "AntonPartyListSwitchButtonr" + TeamNameStr, X + 15, Y + 61 + (19 * i), "common/anton/new/newbaseui.ani", 3); ListUiMap[i].Show(); if (ListUiMap[i].isLBActive()) { obj.sq_PlaySound("CLICK_BUTTON1"); NowSelectTeam = i; local GetAntonTeamInfo = Json_STL("GetAntonTeamInfo"); GetAntonTeamInfo.Put("op", 1011); GetAntonTeamInfo.Put("TeamId", ListInfoMap[i].TeamId); local str = GetAntonTeamInfo.GetString(); L_sq_SendPackType(130); L_sq_SendPackWChar(str); L_sq_SendPack(); GetAntonTeamInfo.Delete(); } //当前选择队伍不为空 并且等于当前的i if (NowSelectTeam != null && NowSelectTeam == i) { local Ani = T_DrawStayAni(obj, "common/anton/new/newbaseui.ani", X + 15, Y + 61 + (19 * i), 2, "安图恩队伍列表界面当前选中"); } } } //绘制攻坚队列表功能按钮 function DrawPartyListFuncButton(obj) { //刷新攻坚队 { if (ReloadingButtonObject == null) { ReloadingButtonObject = AntonButtonPro(obj, "AntonPartyListReloadingButton", X + 96, Y + 291, "common/anton/new/newbasebutton.ani", 46, 17, 7); ReloadingButtonObject.SetRectEnble(true, "AntonPartyListReloadingButtonr", X + 96, Y + 291, "common/anton/new/newbasebutton.ani", 8); ReloadingButtonObject.SetCustomClickEnble(true, "AntonPartyListReloadingButtonc", X + 96, Y + 291, "common/anton/new/newbasebutton.ani", 9); } ReloadingButtonObject.Show(); if (ReloadingButtonObject.isLBActive()) { obj.sq_PlaySound("CLICK_BUTTON1"); local GetAntonTeamList = Json_STL("GetAntonTeamList"); GetAntonTeamList.Put("op", 1007); GetAntonTeamList.Put("Page", Page); local str = GetAntonTeamList.GetString(); L_sq_SendPackType(130); L_sq_SendPackWChar(str); L_sq_SendPack(); GetAntonTeamList.Delete(); } } //我的攻坚队 { if (MyTeamId == -1) { T_DrawStayAni(obj, "common/anton/new/newbasebutton.ani", X + 96 + 48 + 3, Y + 291, 10, "安图恩队伍列表我的攻坚队不可用"); } else { if (MyTeamButtonObject == null) { MyTeamButtonObject = AntonButtonPro(obj, "AntonPartyListMyTeamButton", X + 96 + 48 + 3, Y + 291, "common/anton/new/newbasebutton.ani", 97, 23, 11); MyTeamButtonObject.SetRectEnble(true, "AntonPartyListMyTeamButtonr", X + 96 + 48 + 3, Y + 291, "common/anton/new/newbasebutton.ani", 12); MyTeamButtonObject.SetCustomClickEnble(true, "AntonPartyListMyTeamButtonc", X + 96 + 48 + 3, Y + 291, "common/anton/new/newbasebutton.ani", 13); } MyTeamButtonObject.Show(); if (MyTeamButtonObject.isLBActive()) { obj.sq_PlaySound("CLICK_BUTTON1"); local GetAntonTeamList = Json_STL("GetAntonTeamList"); GetAntonTeamList.Put("op", 1011); local str = GetAntonTeamList.GetString(); L_sq_SendPackType(130); L_sq_SendPackWChar(str); L_sq_SendPack(); GetAntonTeamList.Delete(); NowSelectTeam = -1; } } } } //绘制攻坚队请求按钮 function DrawPartyReqButton(obj) { if (MyTeamId == -1) { //申请加入 { if (PartyReqButtonObject == null) { PartyReqButtonObject = AntonButtonPro(obj, "AntonPartyListReloadingButton", X + 636, Y + 500, "common/anton/new/newbasebutton.ani", 70, 17, 14); PartyReqButtonObject.SetRectEnble(true, "AntonPartyListReloadingButtonr", X + 636, Y + 500, "common/anton/new/newbasebutton.ani", 15); PartyReqButtonObject.SetCustomClickEnble(true, "AntonPartyListReloadingButtonc", X + 636, Y + 500, "common/anton/new/newbasebutton.ani", 16); } PartyReqButtonObject.Show(); if (PartyReqButtonObject.isLBActive()) { obj.sq_PlaySound("CLICK_BUTTON4"); local AntonJoinPartyReq = Json_STL("AntonJoinPartyReq"); AntonJoinPartyReq.Put("op", 1003); AntonJoinPartyReq.Put("TeamId", ListInfoMap[NowSelectTeam].TeamId); local str = AntonJoinPartyReq.GetString(); L_sq_SendPackType(130); L_sq_SendPackWChar(str); L_sq_SendPack(); AntonJoinPartyReq.Delete(); } } } else { //退出攻坚队 { if (PartyExitButtonObject == null) { PartyExitButtonObject = AntonButtonPro(obj, "AntonPartyListReloadingButton", X + 636, Y + 500, "common/anton/new/newbasebutton.ani", 70, 17, 17); PartyExitButtonObject.SetRectEnble(true, "AntonPartyListReloadingButtonr", X + 636, Y + 500, "common/anton/new/newbasebutton.ani", 18); PartyExitButtonObject.SetCustomClickEnble(true, "AntonPartyListReloadingButtonc", X + 636, Y + 500, "common/anton/new/newbasebutton.ani", 19); } PartyExitButtonObject.Show(); if (PartyExitButtonObject.isLBActive()) { obj.sq_PlaySound("CLICK_BUTTON4"); local AntonExitPartyReq = Json_STL("AntonExitPartyReq"); AntonExitPartyReq.Put("op", 1005); local str = AntonExitPartyReq.GetString(); L_sq_SendPackType(130); L_sq_SendPackWChar(str); L_sq_SendPack(); AntonExitPartyReq.Delete(); NowSelectTeam = null; //关闭队伍详细信息显示 MyTeamId = -1; //清空自己的队伍信息 //清除正在攻坚的信息 local RootTab = getroottable(); RootTab.rawdelete("ANTONDUNGEONINFOCONTROL"); } } //开始攻坚 { local RootTab = getroottable(); //如果自己是攻坚队队长 并且 攻坚状态为未开启 if (MyCaptainControl == 1 && RootTab.rawin("ANTONDUNGEONINFOCONTROL") && (RootTab["ANTONDUNGEONINFOCONTROL"].State == -1 || RootTab["ANTONDUNGEONINFOCONTROL"].State == 2)) { if (PartyStartButtonObject == null) { PartyStartButtonObject = AntonButtonPro(obj, "AntonPartyListReloadingButton", X + 536, Y + 500, "common/anton/new/newbasebutton.ani", 70, 17, 29); PartyStartButtonObject.SetRectEnble(true, "AntonPartyListReloadingButtonr", X + 536, Y + 500, "common/anton/new/newbasebutton.ani", 30); PartyStartButtonObject.SetCustomClickEnble(true, "AntonPartyListReloadingButtonc", X + 536, Y + 500, "common/anton/new/newbasebutton.ani", 31); } PartyStartButtonObject.Show(); if (PartyStartButtonObject.isLBActive()) { obj.sq_PlaySound("CLICK_BUTTON4"); local AntonPartyStart = Json_STL("AntonPartyStart"); local op = 1041; //默认一阶段 如果是二阶段则发1047包二阶段开始 if (RootTab["ANTONDUNGEONINFOCONTROL"].State == 2) op = 1047; AntonPartyStart.Put("op", op); local str = AntonPartyStart.GetString(); L_sq_SendPackType(130); L_sq_SendPackWChar(str); L_sq_SendPack(); AntonPartyStart.Delete(); } } } } } function Show(obj) { //绘制背景框 DrawMainBackGround(obj); //如果没有攻坚队信息 则返回 if (!ListCount || ListCount <= 0) return; //绘制攻坚队伍页面控制 DrawPartyListPageConctrl(obj); //绘制攻坚队列表信息 DrawPartyListInfo(obj); //绘制攻坚队功能按钮 DrawPartyListFuncButton(obj); //绘制攻坚队请求按钮 DrawPartyReqButton(obj); } function Run(obj) { //绘制类 Show(obj); } } local RootTab = getroottable(); RootTab.rawdelete("ANTONTOWNMAINCONTROLLIST"); function AntonTownMainControl_PartyList(obj) { local RootTab = getroottable(); if (RootTab.rawin("ANTONTOWNMAINCONTROLLIST") == false) { local ANTONTOWNMAINCONTROLLISTOBJ = AntonTownMainControl_PartyList_C(); RootTab.rawset("ANTONTOWNMAINCONTROLLIST", ANTONTOWNMAINCONTROLLISTOBJ); } }