2024-03-18 21:37:40 +08:00
|
|
|
/*
|
|
|
|
|
文件名:FiendwarHall.nut
|
|
|
|
|
路径:Plugins/Fiendwar/FiendwarHall.nut
|
|
|
|
|
创建日期:2024-03-11 12:54
|
|
|
|
|
文件用途:超时空之战大厅
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
class FiendwarHallTeamC extends BasicsDrawTool {
|
|
|
|
|
X = 0;
|
|
|
|
|
Y = 0;
|
|
|
|
|
Width = null;
|
|
|
|
|
Height = null;
|
|
|
|
|
TeamObj = null;
|
|
|
|
|
//选中状态
|
|
|
|
|
SelectState = false;
|
|
|
|
|
//攻坚状态
|
|
|
|
|
OffensiveState = 0;
|
|
|
|
|
|
|
|
|
|
Mobj = null; //鼠标对象
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor(gTeamObj) {
|
|
|
|
|
TeamObj = gTeamObj;
|
|
|
|
|
this.Width = 458;
|
|
|
|
|
this.Height = 21;
|
|
|
|
|
if (getroottable().rawin("MouseObject")) Mobj = getroottable()["MouseObject"];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function SyncPos(X, Y) {
|
|
|
|
|
this.X = X;
|
|
|
|
|
this.Y = Y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//悬停状态
|
|
|
|
|
function isInRect() {
|
|
|
|
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X + 10, Y + 82, Width, Height)) 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Show() {
|
|
|
|
|
//绘制底槽
|
|
|
|
|
L_sq_DrawImg("hud/fiendwarl.img", 4, X + 10, Y + 82);
|
|
|
|
|
|
|
|
|
|
//绘制队伍编号
|
|
|
|
|
L_sq_DrawCode(TeamObj.TeamId, X + 32 - LenheartTextClass.GetStringLength(TeamObj.TeamId) / 2, Y + 87, sq_RGBA(134, 120, 79, 255), 0, 1);
|
|
|
|
|
//绘制队长头像
|
|
|
|
|
L_sq_DrawImg("interface/lenheartwindowcommon.img", 55, X + 62, Y + 89);
|
|
|
|
|
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 + 112 - LenheartTextClass.GetStringLength(channel_index) / 2, Y + 87, sq_RGBA(134, 120, 79, 255), 0, 1);
|
|
|
|
|
} catch (exception) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//绘制攻坚队名称
|
|
|
|
|
L_sq_DrawCode(TeamObj.TeamName, X + 140, Y + 87, sq_RGBA(134, 120, 79, 255), 0, 1);
|
|
|
|
|
//绘制攻坚队攻坚状态
|
|
|
|
|
L_sq_DrawImg("hud/fiendwarl.img", 6 + TeamObj.State, X + 324, Y + 84);
|
|
|
|
|
|
|
|
|
|
local PartyPlayerCountStr = TeamObj.TeamPlayerCount + " / " + 8;
|
|
|
|
|
//绘制攻坚队队员数量
|
|
|
|
|
L_sq_DrawCode(PartyPlayerCountStr, X + 444 - LenheartTextClass.GetStringLength(PartyPlayerCountStr) / 2, Y + 87, sq_RGBA(134, 120, 79, 255), 0, 1);
|
|
|
|
|
|
|
|
|
|
if (SelectState) {
|
|
|
|
|
L_sq_DrawImg("hud/fiendwarl.img", 5, X + 10, Y + 82);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isInRect()) {
|
|
|
|
|
L_sq_DrawImg("hud/fiendwarl.img", 5, X + 10, Y + 82);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isLBActive()) {
|
|
|
|
|
//还原其他 选中自己
|
|
|
|
|
foreach(Obj in FiendwarHallC.GetInstance().PartyList) {
|
|
|
|
|
Obj.SelectState = false;
|
|
|
|
|
}
|
|
|
|
|
SelectState = !SelectState;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class FiendwarHallC extends BasicsDrawTool {
|
|
|
|
|
WindowObj = null; //窗口对象
|
2024-03-25 20:51:30 +08:00
|
|
|
MainState = false; //主状态
|
2024-03-18 21:37:40 +08:00
|
|
|
X = 320;
|
|
|
|
|
Y = 40;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PartyList = null;
|
|
|
|
|
|
|
|
|
|
function GetInstance() {
|
|
|
|
|
return getroottable()["FiendwarHallCObj"];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function GetAllTeamCallBack(Chunk) {
|
|
|
|
|
// Sout("收到包 : \n %L", Chunk);
|
|
|
|
|
local Jso = Json.Decode(Chunk);
|
|
|
|
|
PartyList = [];
|
|
|
|
|
foreach(TeamsSimple in Jso.TeamSimList) {
|
|
|
|
|
local T = {
|
|
|
|
|
TeamId = TeamsSimple.TeamId.tostring(),
|
|
|
|
|
TeamName = TeamsSimple.TeamName,
|
|
|
|
|
TeamPlayerCount = TeamsSimple.TeamPlayerCount,
|
|
|
|
|
State = TeamsSimple.State
|
|
|
|
|
}
|
|
|
|
|
local TeamBuf = FiendwarHallTeamC(T);
|
|
|
|
|
PartyList.append(TeamBuf);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function GetAllTeamCall() {
|
|
|
|
|
local Jso = {
|
|
|
|
|
op = 20063011
|
|
|
|
|
}
|
|
|
|
|
SendPack(Jso);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
|
PartyList = [];
|
|
|
|
|
Pack_Control.rawset(20063002, GetAllTeamCallBack.bindenv(this));
|
|
|
|
|
GetAllTeamCall();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MyChannelBtn = null;
|
|
|
|
|
OnlyPreparingBtn = null;
|
|
|
|
|
OnlyPreparingFlag = 1;
|
|
|
|
|
InputObject = null;
|
|
|
|
|
|
|
|
|
|
function DrawMainBackGround(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 + 56, 528 * 0.85, 384 * 0.85, "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/fiendwarl.img", 3, X + 1, Y);
|
|
|
|
|
|
|
|
|
|
L_sq_DrawCode("寻找攻坚队", X + 217, Y + 3, sq_RGBA(179, 169, 135, 255), 0, 1);
|
|
|
|
|
|
|
|
|
|
local CloseButton = LenheartBaseButton(X + 457, Y, 11, 12, "interface/lenheartwindowcommon.img", 276);
|
|
|
|
|
CloseButton.Show();
|
|
|
|
|
if (CloseButton.isLBActive()) {
|
|
|
|
|
MainState = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//我的频道
|
|
|
|
|
if (!MyChannelBtn) {
|
|
|
|
|
MyChannelBtn = LenheartcommonSwitchButtonText(X + 16, Y + 30, "我的频道");
|
|
|
|
|
MyChannelBtn.State = 1;
|
|
|
|
|
MyChannelBtn.ImgIndex = 358;
|
|
|
|
|
MyChannelBtn.SetTextPos(12, 2);
|
|
|
|
|
MyChannelBtn.Width = 76;
|
|
|
|
|
MyChannelBtn.Height = 16;
|
|
|
|
|
}
|
|
|
|
|
MyChannelBtn.SyncPos(X + 16, Y + 30);
|
|
|
|
|
MyChannelBtn.Show();
|
|
|
|
|
|
|
|
|
|
//只查看招募中的攻坚队
|
|
|
|
|
if (!OnlyPreparingBtn) {
|
|
|
|
|
OnlyPreparingBtn = LenheartcommonSwitchButtonText(X + 50, Y + 30, "只查看招募中的攻坚队");
|
|
|
|
|
OnlyPreparingBtn.ImgIndex = 358;
|
|
|
|
|
OnlyPreparingBtn.SetTextPos(12, 2);
|
|
|
|
|
OnlyPreparingBtn.Width = 76;
|
|
|
|
|
OnlyPreparingBtn.Height = 16;
|
|
|
|
|
}
|
|
|
|
|
OnlyPreparingBtn.SyncPos(X + 110, Y + 30);
|
|
|
|
|
OnlyPreparingBtn.Show();
|
|
|
|
|
if (OnlyPreparingBtn.isLBActive()) {
|
|
|
|
|
switch (OnlyPreparingFlag) {
|
|
|
|
|
case 0:
|
|
|
|
|
OnlyPreparingFlag = 1;
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
OnlyPreparingFlag = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
OnlyPreparingBtn.State = OnlyPreparingFlag;
|
|
|
|
|
|
|
|
|
|
if (!InputObject) InputObject = LenheartBaseInput(X + 260, Y + 31, 80, 20);
|
|
|
|
|
else {
|
|
|
|
|
InputObject.SyncPos(X + 260, Y + 31);
|
|
|
|
|
InputObject.Show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local FindButton = LenheartButtonText(X + 348, Y + 28, 5, "搜索");
|
|
|
|
|
FindButton.SetTextOffset(0, 1);
|
|
|
|
|
FindButton.Show();
|
|
|
|
|
if (FindButton.isLBActive()) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
local ResetButton = LenheartButtonText(X + 408, Y + 28, 5, "重置");
|
|
|
|
|
ResetButton.SetTextOffset(0, 1);
|
|
|
|
|
ResetButton.Show();
|
|
|
|
|
if (ResetButton.isLBActive()) {
|
|
|
|
|
InputObject.str = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
local ModelButton = LenheartButtonText(X + 9, Y + 56, -18, "编号");
|
|
|
|
|
ModelButton.Idx = 163;
|
|
|
|
|
ModelButton.DWidth = -8;
|
|
|
|
|
ModelButton.SetTextOffset(-9, 1);
|
|
|
|
|
ModelButton.Show();
|
|
|
|
|
|
|
|
|
|
local StateButton = LenheartButtonText(X + 51, Y + 56, -18, "状态");
|
|
|
|
|
StateButton.Idx = 163;
|
|
|
|
|
StateButton.DWidth = -8;
|
|
|
|
|
StateButton.SetTextOffset(-9, 1);
|
|
|
|
|
StateButton.Show();
|
|
|
|
|
|
|
|
|
|
local ChannelButton = LenheartButtonText(X + 93, Y + 56, -18, "频道");
|
|
|
|
|
ChannelButton.Idx = 163;
|
|
|
|
|
ChannelButton.DWidth = -8;
|
|
|
|
|
ChannelButton.SetTextOffset(-9, 1);
|
|
|
|
|
ChannelButton.Show();
|
|
|
|
|
|
|
|
|
|
local PartyNameButton = LenheartButtonText(X + 135, Y + 56, 100, "攻坚队名称");
|
|
|
|
|
PartyNameButton.Idx = 163;
|
|
|
|
|
PartyNameButton.DWidth = 223;
|
|
|
|
|
PartyNameButton.FillWidth = 1;
|
|
|
|
|
PartyNameButton.FirstWidth = 21;
|
|
|
|
|
PartyNameButton.SetTextOffset(26, 1);
|
|
|
|
|
PartyNameButton.Show();
|
|
|
|
|
|
|
|
|
|
local StageButton = LenheartButtonText(X + 289, Y + 56, 52, "阶段");
|
|
|
|
|
StageButton.Idx = 163;
|
|
|
|
|
StageButton.DWidth = 140;
|
|
|
|
|
StageButton.FillWidth = 1;
|
|
|
|
|
StageButton.FirstWidth = 21;
|
|
|
|
|
StageButton.SetTextOffset(26, 1);
|
|
|
|
|
StageButton.Show();
|
|
|
|
|
|
|
|
|
|
local TeammembersButton = LenheartButtonText(X + 402, Y + 56, 50, "队员数量");
|
|
|
|
|
TeammembersButton.Idx = 163;
|
|
|
|
|
TeammembersButton.FillWidth = 1;
|
|
|
|
|
TeammembersButton.FirstWidth = 21;
|
|
|
|
|
TeammembersButton.DWidth = 47;
|
|
|
|
|
TeammembersButton.SetTextOffset(-8, 1);
|
|
|
|
|
TeammembersButton.Show();
|
|
|
|
|
|
|
|
|
|
DrawPartyList(obj);
|
|
|
|
|
|
|
|
|
|
L_sq_DrawWindow(X + 6, Y + 382, 528 * 0.85, 24, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13);
|
|
|
|
|
|
|
|
|
|
local CreateOrMyPartyStr = "创建攻坚队";
|
|
|
|
|
local MyPartyButton = LenheartButtonText(X + 15, Y + 395, 30, CreateOrMyPartyStr);
|
|
|
|
|
MyPartyButton.SetTextOffset(-6, 1);
|
|
|
|
|
MyPartyButton.Show();
|
|
|
|
|
if (MyPartyButton.isLBActive()) {
|
|
|
|
|
FiendwarHallCreatePartyC.GetInstance().MainState = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//绘制背景框标题栏
|
|
|
|
|
// L_sq_DrawImg("interface/lenheartwindowcommon.img", 33, X + 150, Y + 395);
|
|
|
|
|
|
|
|
|
|
local LeftButton = LenheartBaseButton(X + 160, Y + 400, 15, 15, "interface/lenheartwindowcommon.img", 34);
|
|
|
|
|
LeftButton.Show();
|
|
|
|
|
if (LeftButton.isLBActive()) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
local RightButton = LenheartBaseButton(X + 220, Y + 400, 15, 15, "interface/lenheartwindowcommon.img", 38);
|
|
|
|
|
RightButton.Show();
|
|
|
|
|
if (RightButton.isLBActive()) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
local FQButton = LenheartButtonText(X + 300, Y + 394, 20, "进入待机");
|
|
|
|
|
FQButton.SetTextOffset(-5, 2);
|
|
|
|
|
FQButton.State = 8;
|
|
|
|
|
FQButton.Show();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local RefreshButton = LenheartBaseButton(X + 410, Y + 395, 25, 25, "interface/lenheartwindowcommon.img", 366);
|
|
|
|
|
RefreshButton.Show();
|
|
|
|
|
if (RefreshButton.isLBActive()) {
|
|
|
|
|
GetAllTeamCall();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
local SettingButton = LenheartBaseButton(X + 440, Y + 394, 15, 15, "interface/lenheartwindowcommon.img", 362);
|
|
|
|
|
SettingButton.State = 8;
|
|
|
|
|
SettingButton.Show();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Page = 0;
|
|
|
|
|
PageMaxCount = 13;
|
|
|
|
|
//绘制队伍信息
|
|
|
|
|
function DrawPartyList(obj) {
|
|
|
|
|
if (PartyList.len() <= 0) return;
|
|
|
|
|
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);
|
|
|
|
|
TeamObj.Show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//绘制主界面
|
|
|
|
|
function DrawMain(obj) {
|
|
|
|
|
DrawMainBackGround(obj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//开启界面回调
|
|
|
|
|
function OpenClassCallBack() {
|
|
|
|
|
|
|
|
|
|
L_NewWindows("Lenheart", 170, 0x65535);
|
|
|
|
|
local W = sq_GetPopupWindowMainCotrol(170);
|
|
|
|
|
W.SetVisible(false);
|
|
|
|
|
W.SetEnable(false);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MainButton = null;
|
|
|
|
|
//绘制入口
|
|
|
|
|
function Draw(obj) {
|
|
|
|
|
//在甲板
|
|
|
|
|
if (FiendwarTotal.GetInstance().BaseConfig && FiendwarTotal.GetInstance().BaseConfig.channel_index.find("20") && L_sq_GetTownIndex() == FiendwarTotal.GetInstance().BaseConfig.town_index && L_sq_GetRegionIndex() == 1) {
|
|
|
|
|
if (!MainButton) {
|
|
|
|
|
MainButton = LenheartBaseButton(0, 350, 100, 179, "hud/fiendwarl.img", 0);
|
|
|
|
|
} else {
|
|
|
|
|
MainButton.Show();
|
|
|
|
|
if (MainButton.isLBActive()) {
|
|
|
|
|
MainState = !MainState;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (MainState) {
|
|
|
|
|
if (WindowObj) {
|
|
|
|
|
DrawMain(obj);
|
|
|
|
|
WindowObj.Show(obj);
|
|
|
|
|
X = WindowObj.X;
|
|
|
|
|
Y = WindowObj.Y;
|
|
|
|
|
} else {
|
|
|
|
|
WindowObj = LenheartWindow(X, Y, 476, 432, 10); //坐标 大小 标题栏高度
|
|
|
|
|
// WindowObj.DeBugMode = true;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (WindowObj && WindowObj.YMouseSw == false) {
|
|
|
|
|
IMouse.ReleaseMouseClick();
|
|
|
|
|
WindowObj.YMouseSw = true;
|
|
|
|
|
WindowObj = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//逻辑入口
|
|
|
|
|
function Proc(obj) {
|
|
|
|
|
if (KeyPressNB.isKeyPress(48, "FiendwarHallCloseKey")) {
|
|
|
|
|
MainState = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|