347 lines
11 KiB
Plaintext
347 lines
11 KiB
Plaintext
|
|
/*
|
||
|
|
文件名:Rindro_Fiendwar_PartyHall.nut
|
||
|
|
路径:Plugins/New_Fiendwar/Rindro_Fiendwar_PartyHall.nut
|
||
|
|
创建日期:2024-07-15 16:50
|
||
|
|
文件用途:超时空组队大厅
|
||
|
|
*/
|
||
|
|
class Rindro_Fiendwar_PartyHallC extends LenheartNewUI_Windows {
|
||
|
|
|
||
|
|
Visible = false;
|
||
|
|
//调试模式
|
||
|
|
// DeBugMode = true;
|
||
|
|
|
||
|
|
|
||
|
|
//页数
|
||
|
|
Page = 0;
|
||
|
|
//一页放多少个队伍
|
||
|
|
PageMaxCount = 13;
|
||
|
|
//攻坚队List
|
||
|
|
PartyList = null;
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
//获取所有队伍
|
||
|
|
function GetAllTeamCall() {
|
||
|
|
local Jso = {
|
||
|
|
op = 20063011
|
||
|
|
}
|
||
|
|
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_FiendwarPartyC(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(20063002, 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_Fiendwar_Obj.MyRaidTeamId) {
|
||
|
|
//发送查看攻坚队具体信息包
|
||
|
|
local T = {
|
||
|
|
op = 20063013,
|
||
|
|
teamsId = RinDro_Fiendwar_Obj.MyRaidTeamId
|
||
|
|
}
|
||
|
|
SendPackEx(T);
|
||
|
|
}
|
||
|
|
//否则创建队伍
|
||
|
|
else {
|
||
|
|
local Win = LenheartNewUI_CreateWindow(Rindro_FiendwarCreatePartyC, "超时空创建队伍窗口", 290, 220, 284, 154, 18);
|
||
|
|
Win.Visible = true;
|
||
|
|
Win.ResetFocus();
|
||
|
|
}
|
||
|
|
}.bindenv(this);
|
||
|
|
//设置动态回调改变按钮名称
|
||
|
|
MyPartyButton.SetCallBackFunc(function(window) {
|
||
|
|
if (RinDro_Fiendwar_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_FiendwarPartyC) {
|
||
|
|
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_FiendwarPartyC) {
|
||
|
|
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_Fiendwar_Obj.BaseConfig && RinDro_Fiendwar_Obj.BaseConfig.channel_index.find("20") && L_sq_GetTownIndex() == RinDro_Fiendwar_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);
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|