111
This commit is contained in:
parent
af522dcecb
commit
80a89779cd
|
|
@ -67,18 +67,21 @@ function LenheartFiendwar(obj) {
|
|||
|
||||
|
||||
|
||||
//攻坚队列表框
|
||||
if (!RootTab.rawin("FiendwarHallCObj")) {
|
||||
local Cobj = FiendwarHallC();
|
||||
RootTab.rawset("FiendwarHallCObj", Cobj);
|
||||
} else {
|
||||
RootTab["FiendwarHallCObj"].Proc(obj);
|
||||
RootTab["FiendwarHallCObj"].Draw(obj);
|
||||
}
|
||||
// //攻坚队列表框
|
||||
// if (!RootTab.rawin("FiendwarHallCObj")) {
|
||||
// local Cobj = FiendwarHallC();
|
||||
// RootTab.rawset("FiendwarHallCObj", Cobj);
|
||||
// } else {
|
||||
// RootTab["FiendwarHallCObj"].Proc(obj);
|
||||
// RootTab["FiendwarHallCObj"].Draw(obj);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
LenheartNewUI_CreateWindow(FiendwarHallC, "超时空攻坚队伍列表", 320, 40, 478, 434, 18);
|
||||
// LenheartNewUI_CreateWindow(FiendwarHallCreatePartyC, "超时空创建队伍窗口", 290, 220, 284, 154, 18);
|
||||
|
||||
|
||||
//创建队伍框
|
||||
FiendwarHallCreatePartyC("超时空创建队伍窗口",290, 220, 284, 154, 18);
|
||||
// if (!RootTab.rawin("FiendwarHallCreatePartyCObj")) {
|
||||
// FiendwarHallCreatePartyC("超时空创建队伍窗口",290, 220, 200, 200, 20);
|
||||
// // RootTab.rawset("FiendwarHallCreatePartyCObj", Cobj);
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ class FiendwarHallTeamC extends BasicsDrawTool {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
class FiendwarHallC extends BasicsDrawTool {
|
||||
WindowObj = null; //窗口对象
|
||||
MainState = false; //主状态
|
||||
|
|
@ -378,3 +378,277 @@ class FiendwarHallC extends BasicsDrawTool {
|
|||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
class FiendwarHallC extends LenheartNewUI_Windows {
|
||||
|
||||
// DeBugMode = true;
|
||||
WindowObj = null; //窗口对象
|
||||
MainState = false; //主状态
|
||||
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(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
Childrens = [];
|
||||
//注册控件
|
||||
RegisterWidget();
|
||||
|
||||
|
||||
PartyList = [];
|
||||
Pack_Control.rawset(20063002, GetAllTeamCallBack.bindenv(this));
|
||||
GetAllTeamCall();
|
||||
|
||||
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
// Visible = false;
|
||||
}
|
||||
|
||||
MyChannelBtn = null;
|
||||
OnlyPreparingBtn = null;
|
||||
OnlyPreparingFlag = 1;
|
||||
InputObject = null;
|
||||
|
||||
function RegisterWidget() {
|
||||
//关闭按钮
|
||||
local CloseButton = LenheartNewUI_BaseButton(457, 0, 11, 12, "interface/lenheartwindowcommon.img", 276);
|
||||
CloseButton.OnClick = function ()
|
||||
{
|
||||
this.Visible = false;
|
||||
}.bindenv(this);
|
||||
Childrens.append(CloseButton);
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
||||
//我的频道
|
||||
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 Show(obj) {
|
||||
DrawMain(obj);
|
||||
|
||||
LenheartNewUI_Windows.Show(obj);
|
||||
LenheartNewUI_Windows.SyncPos(X, Y);
|
||||
}
|
||||
|
||||
|
||||
MainButton = null;
|
||||
//逻辑入口
|
||||
function Proc(obj) {
|
||||
//界面未打开
|
||||
if (!this.Visible) {
|
||||
//在甲板
|
||||
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()) {
|
||||
this.Visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,125 +4,48 @@
|
|||
创建日期:2024-03-18 13:20
|
||||
文件用途:
|
||||
*/
|
||||
/*
|
||||
class FiendwarHallCreatePartyC extends BasicsDrawTool {
|
||||
WindowObj = null; //窗口对象
|
||||
MainState = true; //主状态
|
||||
X = 290;
|
||||
Y = 220;
|
||||
|
||||
constructor() {}
|
||||
|
||||
function GetInstance() {
|
||||
return getroottable()["FiendwarHallCreatePartyCObj"];
|
||||
}
|
||||
|
||||
|
||||
|
||||
InputObject = null;
|
||||
//绘制主界面
|
||||
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/180621_fiendwar/raid/raid_areaimg_fiend.img", 0, X + 11, Y + 21);
|
||||
|
||||
L_sq_DrawImg("hud/fiendwarl.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/fiendwarl.img", 10, X + 72, Y + 44);
|
||||
|
||||
if (!InputObject) InputObject = LenheartBaseInput(X + 62, Y + 68, 152, 20);
|
||||
else {
|
||||
InputObject.SyncPos(X + 62, Y + 68);
|
||||
InputObject.Show();
|
||||
}
|
||||
|
||||
local OkButton = LenheartButtonText(X + 78, Y + 124, 5, "确定");
|
||||
OkButton.SetTextOffset(0, 1);
|
||||
OkButton.Show();
|
||||
if (OkButton.isLBActive()) {
|
||||
if (InputObject.str.len() > 0) {
|
||||
local T = {
|
||||
op = 20063001,
|
||||
teamsName = InputObject.str,
|
||||
items = [L_sq_GetCharacterAttribute(0x1c, 14), L_sq_GetCharacterAttribute(0x1c, 13)],
|
||||
}
|
||||
BasicsDrawTool.SendPackEx(T);
|
||||
MainState = false;
|
||||
}
|
||||
}
|
||||
|
||||
local CloseButton = LenheartButtonText(X + 144, Y + 124, 5, "取消");
|
||||
CloseButton.SetTextOffset(0, 1);
|
||||
CloseButton.Show();
|
||||
if (CloseButton.isLBActive()) {
|
||||
MainState = false;
|
||||
}
|
||||
}
|
||||
|
||||
//开启界面回调
|
||||
function OpenClassCallBack() {
|
||||
|
||||
L_NewWindows("Lenheart", 170, 0x65535);
|
||||
local W = sq_GetPopupWindowMainCotrol(170);
|
||||
W.SetVisible(false);
|
||||
W.SetEnable(false);
|
||||
|
||||
}
|
||||
|
||||
//绘制入口
|
||||
function Draw(obj) {
|
||||
if (MainState) {
|
||||
if (WindowObj) {
|
||||
DrawMain(obj);
|
||||
// WindowObj.Show(obj);
|
||||
X = WindowObj.X;
|
||||
Y = WindowObj.Y;
|
||||
} else {
|
||||
WindowObj = LenheartNewUI.Windows(X, Y, 800, 600, 28); //坐标 大小 标题栏高度
|
||||
WindowObj.Init(this);
|
||||
WindowObj.DeBugMode = true;
|
||||
}
|
||||
} else {
|
||||
if (WindowObj && WindowObj.YMouseSw == false) {
|
||||
IMouse.ReleaseMouseClick();
|
||||
WindowObj.YMouseSw = true;
|
||||
WindowObj = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//逻辑入口
|
||||
function Proc(obj) {
|
||||
if (KeyPressNB.isKeyPress(48, "FiendwarHallCreatePartyCloseKey")) {
|
||||
MainState = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
class FiendwarHallCreatePartyC extends LenheartNewUI.Windows {
|
||||
class FiendwarHallCreatePartyC extends LenheartNewUI_Windows {
|
||||
//调试模式
|
||||
DeBugMode = true;
|
||||
DeBugMode = false;
|
||||
|
||||
WindowObj = null; //窗口对象
|
||||
MainState = true; //主状态
|
||||
X = 290;
|
||||
Y = 220;
|
||||
//输入框
|
||||
InputObject = null;
|
||||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
return LenheartNewUI.Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
Childrens = [];
|
||||
|
||||
local OkButton = LenheartNewUI_ButtonText(78, 124, 5, "确定");
|
||||
OkButton.SetTextOffset(0, 1);
|
||||
OkButton.OnClick = function() {
|
||||
if (InputObject.str.len() > 0) {
|
||||
local T = {
|
||||
op = 20063001,
|
||||
teamsName = InputObject.str,
|
||||
items = [L_sq_GetCharacterAttribute(0x1c, 14), L_sq_GetCharacterAttribute(0x1c, 13)],
|
||||
}
|
||||
BasicsDrawTool.SendPackEx(T);
|
||||
this.Visible = false;
|
||||
}
|
||||
}.bindenv(this);
|
||||
Childrens.append(OkButton);
|
||||
|
||||
local CloseButton = LenheartNewUI_ButtonText(144, 124, 5, "取消");
|
||||
CloseButton.SetTextOffset(0, 1);
|
||||
CloseButton.OnClick = function() {
|
||||
this.Visible = false;
|
||||
}.bindenv(this);
|
||||
Childrens.append(CloseButton);
|
||||
|
||||
InputObject = LenheartNewUI_BaseInput(62, 68, 152, 20);
|
||||
Childrens.append(InputObject);
|
||||
|
||||
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
}
|
||||
|
||||
function GetInstance() {
|
||||
return getroottable()["FiendwarHallCreatePartyCObj"];
|
||||
}
|
||||
|
||||
|
||||
|
||||
InputObject = null;
|
||||
//绘制主界面
|
||||
function DrawMain(obj) {
|
||||
L_sq_DrawWindow(X, Y + 10, 260, 120, "interface/lenheartwindowcommon.img", 213, 12, 2, 13, 2);
|
||||
|
|
@ -134,54 +57,25 @@ class FiendwarHallCreatePartyC extends LenheartNewUI.Windows {
|
|||
|
||||
L_sq_DrawImg("hud/fiendwarl.img", 10, X + 72, Y + 44);
|
||||
|
||||
if (!InputObject) InputObject = LenheartBaseInput(X + 62, Y + 68, 152, 20);
|
||||
else {
|
||||
InputObject.SyncPos(X + 62, Y + 68);
|
||||
InputObject.Show();
|
||||
}
|
||||
|
||||
local OkButton = LenheartButtonText(X + 78, Y + 124, 5, "确定");
|
||||
OkButton.SetTextOffset(0, 1);
|
||||
OkButton.Show();
|
||||
if (OkButton.isLBActive()) {
|
||||
if (InputObject.str.len() > 0) {
|
||||
local T = {
|
||||
op = 20063001,
|
||||
teamsName = InputObject.str,
|
||||
items = [L_sq_GetCharacterAttribute(0x1c, 14), L_sq_GetCharacterAttribute(0x1c, 13)],
|
||||
}
|
||||
BasicsDrawTool.SendPackEx(T);
|
||||
MainState = false;
|
||||
}
|
||||
}
|
||||
|
||||
local CloseButton = LenheartButtonText(X + 144, Y + 124, 5, "取消");
|
||||
CloseButton.SetTextOffset(0, 1);
|
||||
CloseButton.Show();
|
||||
if (CloseButton.isLBActive()) {
|
||||
MainState = false;
|
||||
}
|
||||
}
|
||||
|
||||
//开启界面回调
|
||||
function OpenClassCallBack() {
|
||||
|
||||
L_NewWindows("Lenheart", 170, 0x65535);
|
||||
local W = sq_GetPopupWindowMainCotrol(170);
|
||||
W.SetVisible(false);
|
||||
W.SetEnable(false);
|
||||
// if (!InputObject) InputObject = LenheartNewUI_BaseInput(X + 62, Y + 68, 152, 20);
|
||||
// else {
|
||||
// InputObject.SyncPos(X + 62, Y + 68);
|
||||
// InputObject.Show();
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
function Show(obj) {
|
||||
DrawMain(obj);
|
||||
LenheartNewUI.Windows.Show(obj);
|
||||
LenheartNewUI_Windows.Show(obj);
|
||||
}
|
||||
|
||||
//逻辑入口
|
||||
function Proc(obj) {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
//绘制入口
|
||||
function Draw(obj) {
|
||||
|
|
@ -192,7 +86,7 @@ class FiendwarHallCreatePartyC extends LenheartNewUI.Windows {
|
|||
X = WindowObj.X;
|
||||
Y = WindowObj.Y;
|
||||
} else {
|
||||
WindowObj = LenheartNewUI.Windows(X, Y, 800, 600, 28); //坐标 大小 标题栏高度
|
||||
WindowObj = LenheartNewUI_Windows(X, Y, 800, 600, 28); //坐标 大小 标题栏高度
|
||||
WindowObj.Init(this);
|
||||
WindowObj.DeBugMode = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,38 +4,68 @@
|
|||
创建日期:2024-03-20 11:27
|
||||
文件用途:UI
|
||||
*/
|
||||
LenheartNewUI <- {}
|
||||
//基础窗口类
|
||||
class LenheartNewUI.BaseWindow extends BasicsDrawTool {
|
||||
class LenheartNewUI_BaseWindow extends BasicsDrawTool {
|
||||
|
||||
//子控件
|
||||
Childrens = null;
|
||||
constructor() {
|
||||
|
||||
//子控件
|
||||
// Childrens = [];
|
||||
}
|
||||
//鼠标事件回调
|
||||
function OnMouseProc(Flag, MousePos_X, MousePos_Y) {}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
class LenheartNewUI.Windows extends LenheartNewUI.BaseWindow {
|
||||
|
||||
function Show(obj) {
|
||||
foreach(Window in Childrens) {
|
||||
Window.Show(obj);
|
||||
}
|
||||
}
|
||||
|
||||
function SyncPos(X, Y) {
|
||||
foreach(Window in Childrens) {
|
||||
Window.SyncPos(X, Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class LenheartNewUI_Windows extends LenheartNewUI_BaseWindow {
|
||||
//MyObjectId
|
||||
ObjectId = null;
|
||||
//可用性
|
||||
|
|
@ -68,9 +98,6 @@ class LenheartNewUI.Windows extends LenheartNewUI.BaseWindow {
|
|||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
ObjectId = gObjectId;
|
||||
foreach(Index, WindowObj in L_Windows_List) {
|
||||
if (WindowObj.ObjectId == this.ObjectId) return;
|
||||
}
|
||||
//宽度
|
||||
Width = gWidth;
|
||||
//高度
|
||||
|
|
@ -84,6 +111,9 @@ class LenheartNewUI.Windows extends LenheartNewUI.BaseWindow {
|
|||
Y = gY;
|
||||
|
||||
Init();
|
||||
|
||||
//调用原生方法
|
||||
LenheartNewUI_BaseWindow.constructor();
|
||||
}
|
||||
|
||||
function ResetFocus() {
|
||||
|
|
@ -120,6 +150,9 @@ class LenheartNewUI.Windows extends LenheartNewUI.BaseWindow {
|
|||
function Show(obj) {
|
||||
if (!Visible) return;
|
||||
// L_sq_DrawImg("interface2/yosin/tbjp.img", 4, X, Y + 1);
|
||||
|
||||
//调用原生方法
|
||||
LenheartNewUI_BaseWindow.Show(obj);
|
||||
if (DeBugMode) DeBug(obj);
|
||||
}
|
||||
|
||||
|
|
@ -140,6 +173,8 @@ class LenheartNewUI.Windows extends LenheartNewUI.BaseWindow {
|
|||
Y = B_Y - (M_Ypos - MousePos_Y);
|
||||
}
|
||||
}
|
||||
//调用原生方法
|
||||
LenheartNewUI_BaseWindow.OnMouseProc(Flag, MousePos_X, MousePos_Y);
|
||||
}
|
||||
|
||||
//override
|
||||
|
|
@ -158,6 +193,9 @@ class LenheartNewUI.Windows extends LenheartNewUI.BaseWindow {
|
|||
B_Y = Y;
|
||||
}
|
||||
}
|
||||
|
||||
//调用原生方法
|
||||
LenheartNewUI_BaseWindow.OnMouseLbDown(MousePos_X, MousePos_Y);
|
||||
}
|
||||
//override
|
||||
//鼠标左键弹起回调
|
||||
|
|
@ -170,27 +208,48 @@ class LenheartNewUI.Windows extends LenheartNewUI.BaseWindow {
|
|||
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(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) {
|
||||
// WindowObj.Visible = true;
|
||||
return WindowObj;
|
||||
}
|
||||
}
|
||||
return ClassName(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
}
|
||||
|
||||
|
||||
//遍历窗口查询是否有悬停在新窗口中
|
||||
|
|
@ -230,7 +289,15 @@ if (!("WindowsShowABFlag" in getroottable())) {
|
|||
function L_MouseCallBack(MouseState, MouseFlag, MousePos_X, MousePos_Y) {
|
||||
//如果渲染层级在下级 即A层 或者是 鼠标没有悬停在任何新窗口上时 执行判断 如果悬停在原生窗口 就解除鼠标锁定 如果点击 就改变渲染层级
|
||||
if (!getroottable().WindowsShowABFlag || !CheackMouseInNewWindows(MousePos_X, MousePos_Y)) {
|
||||
if (L_sq_RA(0x1A32950) != 92 && L_sq_RA(0x1A32950) != 2396) {
|
||||
if (L_sq_RA(0x1A32950) != 92 && L_sq_RA(0x1A32950) != 2396
|
||||
// && L_sq_RA(0x1A32950) != 3877 //小地图
|
||||
// &&
|
||||
// L_sq_RA(0x1A32950) != 3878 //小地图
|
||||
// &&
|
||||
// L_sq_RA(0x1A32950) != 3873 //小地图
|
||||
// &&
|
||||
// L_sq_RA(0x1A32950) != 3874 //小地图
|
||||
) {
|
||||
if ("LockState" in IMouse) {
|
||||
if (IMouse.LockState) {
|
||||
IMouse.ReleaseMouseClick();
|
||||
|
|
@ -246,8 +313,7 @@ function L_MouseCallBack(MouseState, MouseFlag, MousePos_X, MousePos_Y) {
|
|||
//克隆一遍窗口列表
|
||||
local WindowListF = clone(L_Windows_List);
|
||||
WindowListF.reverse();
|
||||
|
||||
//判断滚石是向上还是向下的
|
||||
//判断滚轮是向上还是向下的
|
||||
local Flag = MouseFlag == 0xff880000 ? 0 : 1;
|
||||
foreach(Window in WindowListF) {
|
||||
if (Window.Visible) {
|
||||
|
|
@ -293,16 +359,6 @@ function L_MouseCallBack(MouseState, MouseFlag, MousePos_X, MousePos_Y) {
|
|||
// if (!getroottable().rawin("L_Windows_List"))
|
||||
L_Windows_List <- [];
|
||||
|
||||
// if (!getroottable().rawin("asdasdasd")) {
|
||||
// getroottable().asdasdasd <- 1;
|
||||
// local Win = LenheartNewUI.Windows("测试框",120, 100, 329, 382, 30);
|
||||
// Win.DeBugMode = true;
|
||||
// local Win2 = LenheartNewUI.Windows(250, 100, 329, 382, 30);
|
||||
// Win2.Init();
|
||||
// local Win3 = LenheartNewUI.Windows(360, 100, 329, 382, 30);
|
||||
// Win3.Init();
|
||||
// }
|
||||
|
||||
//窗口逻辑入口
|
||||
function L_WindowsLogic(obj) {
|
||||
// print(Clock());
|
||||
|
|
@ -310,8 +366,8 @@ function L_WindowsLogic(obj) {
|
|||
local WindowExistence = false;
|
||||
//遍历窗口队列 如果可见则调用Show 只要有一个可见就写入Flag
|
||||
foreach(Window in L_Windows_List) {
|
||||
if (Window.Visible) {
|
||||
Window.Proc(obj);
|
||||
if (Window.Visible) {
|
||||
Window.Show(obj);
|
||||
WindowExistence = true;
|
||||
}
|
||||
|
|
@ -334,8 +390,6 @@ function L_WindowsLogic(obj) {
|
|||
L_sq_WA(0x1b46898, 0);
|
||||
IMouse.ReleaseMouseClick();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function L_DrawWindow_A() {
|
||||
|
|
@ -355,3 +409,240 @@ function L_DrawWindow_B() {
|
|||
//因为图层太高会盖掉鼠标 所以重新画一个
|
||||
L_sq_DrawImg("interface/newstyle/windows/cursor.img", 0, IMouse.GetXPos(), IMouse.GetYPos());
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
constructor(x, y, width, height) {
|
||||
this.Localtion_X = x;
|
||||
this.Localtion_Y = y;
|
||||
this.Width = width;
|
||||
this.Height = height;
|
||||
}
|
||||
|
||||
//同步坐标
|
||||
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) {
|
||||
OnClick();
|
||||
}
|
||||
isLBDown = false;
|
||||
}
|
||||
|
||||
//鼠标右键按下回调
|
||||
function OnMouseRbDown(MousePos_X, MousePos_Y) {
|
||||
|
||||
}
|
||||
//鼠标右键弹起回调
|
||||
function OnMouseRbUp(MousePos_X, MousePos_Y) {
|
||||
|
||||
}
|
||||
//鼠标滚轮时间回调
|
||||
function OnMouseWheel(Flag, MousePos_X, MousePos_Y) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue