2025-12-11 20:05:06 +08:00
|
|
|
/*
|
|
|
|
|
文件名:Trainingroom.nut
|
|
|
|
|
路径:Project/Trainingroom/Trainingroom.nut
|
|
|
|
|
创建日期:2025-12-11 01:20
|
|
|
|
|
文件用途:
|
|
|
|
|
*/
|
|
|
|
|
class TrainingroomC extends LenheartNewUI_Windows {
|
2025-12-15 15:02:34 +08:00
|
|
|
|
|
|
|
|
X = -321;
|
|
|
|
|
|
2025-12-11 20:05:06 +08:00
|
|
|
//调试模式
|
2025-12-15 15:02:34 +08:00
|
|
|
// DeBugMode = true;
|
2025-12-11 20:05:06 +08:00
|
|
|
|
|
|
|
|
//不是窗口
|
2025-12-15 15:02:34 +08:00
|
|
|
NoWindow = true;
|
2025-12-11 20:05:06 +08:00
|
|
|
|
|
|
|
|
//是否可见
|
|
|
|
|
// Visible = false;
|
|
|
|
|
|
|
|
|
|
//位移修炼场信息
|
|
|
|
|
MoveTrainingroomInfo = null;
|
|
|
|
|
//位移修炼场Flag
|
|
|
|
|
MoveTrainingroomFlag = false;
|
|
|
|
|
//位移修炼场副本编号
|
|
|
|
|
MoveTrainingroomDungeonId = 1;
|
|
|
|
|
|
2025-12-15 15:02:34 +08:00
|
|
|
//是否在修炼场中
|
|
|
|
|
InTrainingroom = false;
|
|
|
|
|
|
|
|
|
|
//队列
|
|
|
|
|
Queue = null;
|
|
|
|
|
//图像
|
|
|
|
|
Img = Rindro_Image("training/main.img");
|
|
|
|
|
|
2025-12-11 20:05:06 +08:00
|
|
|
|
2025-12-15 15:02:34 +08:00
|
|
|
//主界面展开状态
|
|
|
|
|
MainState = 0;
|
2025-12-11 20:05:06 +08:00
|
|
|
|
2025-12-15 15:02:34 +08:00
|
|
|
//子页面配置
|
|
|
|
|
PageConfig = ["召唤怪物", "修改属性", "状态", "设置"];
|
|
|
|
|
//子页面标题
|
|
|
|
|
Title = null;
|
|
|
|
|
//子页面
|
|
|
|
|
PageList = null;
|
2025-12-11 20:05:06 +08:00
|
|
|
|
|
|
|
|
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
|
|
|
|
Childrens = [];
|
2025-12-15 15:02:34 +08:00
|
|
|
Title = [];
|
|
|
|
|
PageList = [];
|
|
|
|
|
Queue = QuestQueue();
|
2025-12-11 20:05:06 +08:00
|
|
|
//注册控件
|
|
|
|
|
RegisterWidget();
|
|
|
|
|
|
|
|
|
|
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
2025-12-15 15:02:34 +08:00
|
|
|
X = -321;
|
2025-12-11 20:05:06 +08:00
|
|
|
|
|
|
|
|
InitPvf();
|
2025-12-15 15:02:34 +08:00
|
|
|
|
|
|
|
|
Cb_OpenWindow_Enter_Func.rawset("TrainingroomC", function(args) {
|
|
|
|
|
NativePointer(Rindro_Haker.CpuContext.ecx).add(4344 * 4).writeInt(1);
|
|
|
|
|
if (args[0] == 244 && InTrainingroom) {
|
|
|
|
|
NativePointer(Rindro_Haker.CpuContext.ecx).add(4344 * 4).writeInt(0);
|
|
|
|
|
ChangeMainState(false);
|
|
|
|
|
}
|
|
|
|
|
}.bindenv(this));
|
|
|
|
|
|
2025-12-11 20:05:06 +08:00
|
|
|
}
|
|
|
|
|
|
2025-12-15 15:02:34 +08:00
|
|
|
|
2025-12-11 20:05:06 +08:00
|
|
|
function RegisterWidget() {
|
2025-12-15 15:02:34 +08:00
|
|
|
|
|
|
|
|
local LogicFunc = function(Btn) {
|
|
|
|
|
foreach(Pos, obj in Title) {
|
|
|
|
|
if (obj != Btn) obj.State = 0;
|
|
|
|
|
else {
|
|
|
|
|
obj.State = 1;
|
|
|
|
|
ChangeSubPage(Pos);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
foreach(Pos, Name in PageConfig) {
|
|
|
|
|
local Tabbars1 = LenheartNewUI_TabbarsText((Pos * 61), 4, Name);
|
|
|
|
|
if (Pos == 0) Tabbars1.State = 1;
|
|
|
|
|
Tabbars1.SetTextOffset(31 - LenheartTextClass.GetStringLength(Name) / 2, 4);
|
|
|
|
|
AddChild(Tabbars1);
|
|
|
|
|
Tabbars1.OnClickEx = LogicFunc.bindenv(this);
|
|
|
|
|
Title.append(Tabbars1);
|
|
|
|
|
}
|
2025-12-11 20:05:06 +08:00
|
|
|
|
|
|
|
|
|
2025-12-15 15:02:34 +08:00
|
|
|
//返回城镇
|
|
|
|
|
local ReturnToTheTownButton = LenheartNewUI_ButtonText(236, 450, 15, "返回城镇");
|
|
|
|
|
ReturnToTheTownButton.Idx = 74;
|
|
|
|
|
ReturnToTheTownButton.DWidth = 18;
|
|
|
|
|
ReturnToTheTownButton.Width = 74;
|
|
|
|
|
ReturnToTheTownButton.SetTextOffset(-4, 1);
|
|
|
|
|
ReturnToTheTownButton.OnClickEx = function(Btn) {
|
|
|
|
|
L_sq_SendPackType(45);
|
|
|
|
|
L_sq_SendPack();
|
|
|
|
|
ChangeMainState(false);
|
|
|
|
|
}.bindenv(this);
|
|
|
|
|
AddChild(ReturnToTheTownButton);
|
|
|
|
|
|
|
|
|
|
PageList.append(Training_SummonMonsterC("修炼场_召唤怪物页面", 0, 0, 300, 140, 0));
|
|
|
|
|
PageList.append(Training_ModifyAttributesC("修炼场_修改属性页面", 0, 0, 300, 140, 0));
|
|
|
|
|
PageList.append(Training_StateC("修炼场_状态页面", 0, 0, 300, 140, 0));
|
|
|
|
|
PageList.append(Training_SettingC("修炼场_设置页面", 0, 0, 300, 140, 0));
|
|
|
|
|
|
|
|
|
|
ChangeSubPage(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function ChangeSubPage(Index) {
|
|
|
|
|
for (local i = 0; i< PageList.len(); i++) {
|
|
|
|
|
local Object = PageList[i];
|
|
|
|
|
Object.Visible = false;
|
|
|
|
|
RemoveChild(Object.ObjectId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PageList[Index].Visible = true;
|
|
|
|
|
AddChild(PageList[Index]);
|
2025-12-11 20:05:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//绘制主界面
|
|
|
|
|
function DrawMain(obj) {
|
2025-12-15 15:02:34 +08:00
|
|
|
Img.DrawPng(0, X, Y);
|
|
|
|
|
//分割线
|
|
|
|
|
Rindro_Image_GlobalMap["lenheartui"].DrawExPng(230, X, Y + 25, 0, sq_RGBA(255, 255, 255, 250), 1.5, 1.0);
|
|
|
|
|
//子页面背景框
|
|
|
|
|
//嵌套背景框
|
|
|
|
|
// DrawNineBox(X + 0, Y + 26, 302, 146, "interface/lenheartwindowcommon.img", 0);
|
|
|
|
|
}
|
2025-12-11 20:05:06 +08:00
|
|
|
|
2025-12-15 15:02:34 +08:00
|
|
|
function ChangeMainState(flag) {
|
|
|
|
|
if (MainState == 0) {
|
|
|
|
|
MainState = 1
|
|
|
|
|
Queue.AddQuest("界面移动动画", function(Name, Time) {
|
|
|
|
|
local Offset = sq_GetAccel(-321, 0, Time, 500, true);
|
|
|
|
|
X = Offset;
|
|
|
|
|
if (Offset == 0) {
|
|
|
|
|
MainState = 2;
|
|
|
|
|
Queue.RemoveQuest(Name);
|
|
|
|
|
}
|
|
|
|
|
}.bindenv(this));
|
|
|
|
|
} else if (MainState == 2) {
|
|
|
|
|
MainState = 1;
|
|
|
|
|
Queue.AddQuest("界面移动动画", function(Name, Time) {
|
|
|
|
|
local Offset = sq_GetAccel(0, -321, Time, 500, true);
|
|
|
|
|
X = Offset;
|
|
|
|
|
if (Offset == -321) {
|
|
|
|
|
MainState = 0;
|
|
|
|
|
Queue.RemoveQuest(Name);
|
|
|
|
|
}
|
|
|
|
|
}.bindenv(this));
|
|
|
|
|
}
|
2025-12-11 20:05:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function Show(obj) {
|
|
|
|
|
DrawMain(obj);
|
|
|
|
|
LenheartNewUI_Windows.Show(obj);
|
|
|
|
|
|
2025-12-15 15:02:34 +08:00
|
|
|
Queue.Run();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//修炼场中Proc
|
|
|
|
|
function ProcInTraining(obj) {
|
|
|
|
|
InTrainingroom = false;
|
|
|
|
|
//判断自己是否在修炼场中
|
|
|
|
|
if (sq_GetCurrentModuleType() != 3) return;
|
|
|
|
|
local stage = sq_GetGlobaludpModuleStage();
|
|
|
|
|
local dungeon = sq_GetDungeonByStage(stage);
|
|
|
|
|
local dungeonIndex = sq_GetDuegonIndex(dungeon);
|
|
|
|
|
if (dungeonIndex != MoveTrainingroomDungeonId) return;
|
|
|
|
|
InTrainingroom = true;
|
|
|
|
|
|
|
|
|
|
local KThisC = L_sq_RA(0x1B470E0);
|
|
|
|
|
local KeyFlag = L_sq_RA(KThisC + 269 + DIK_F12);
|
|
|
|
|
if (KeyFlag == 128 && MainState != 1) {
|
|
|
|
|
ChangeMainState(true);
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-11 20:05:06 +08:00
|
|
|
}
|
|
|
|
|
|
2025-12-15 15:02:34 +08:00
|
|
|
|
2025-12-11 20:05:06 +08:00
|
|
|
//逻辑入口
|
|
|
|
|
function Proc(obj) {
|
|
|
|
|
LenheartNewUI_Windows.SyncPos(X, Y);
|
2025-12-15 15:02:34 +08:00
|
|
|
//主动调用子对象窗口的Proc
|
|
|
|
|
foreach(Object in Childrens) {
|
|
|
|
|
if (Object instanceof LenheartNewUI_Windows)
|
|
|
|
|
Object.Proc(obj);
|
|
|
|
|
}
|
2025-12-11 20:05:06 +08:00
|
|
|
|
|
|
|
|
//判断自己是否在需要位移修炼场的区域
|
|
|
|
|
if (sq_GetCurrentModuleType() == 1) {
|
|
|
|
|
if (MoveTrainingroomInfo) {
|
|
|
|
|
if (L_sq_GetTownIndex() == MoveTrainingroomInfo[0] && L_sq_GetRegionIndex() == MoveTrainingroomInfo[1] && L_sq_GetTownXpos() >= MoveTrainingroomInfo[2] && L_sq_GetTownXpos() <= (MoveTrainingroomInfo[2] + MoveTrainingroomInfo[4]) && L_sq_GetTownYpos() >= MoveTrainingroomInfo[3] && L_sq_GetTownYpos() <= (MoveTrainingroomInfo[3] + MoveTrainingroomInfo[5])) {
|
|
|
|
|
if (!MoveTrainingroomFlag) {
|
|
|
|
|
MoveTrainingroomFlag = true;
|
|
|
|
|
L_sq_GoDungeon(MoveTrainingroomDungeonId);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (MoveTrainingroomFlag) {
|
|
|
|
|
MoveTrainingroomFlag = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-12-15 15:02:34 +08:00
|
|
|
|
|
|
|
|
ProcInTraining(obj);
|
2025-12-11 20:05:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function InitPvf() {
|
|
|
|
|
Rindro_Script.GetFileData("etc/trainingroom.etc", function(DataTable, Data) {
|
|
|
|
|
while (!Data.Eof()) {
|
|
|
|
|
local Fragment = Data.Get();
|
|
|
|
|
if (Fragment == "[area]") {
|
|
|
|
|
MoveTrainingroomInfo = [Data.Get(), Data.Get(), Data.Get(), Data.Get(), Data.Get(), Data.Get()];
|
|
|
|
|
} else if (Fragment == "[dungeon]") {
|
|
|
|
|
MoveTrainingroomDungeonId = Data.Get();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
L_Windows_List <- [];
|
|
|
|
|
getroottable().rawdelete("LenheartPluginsInitFlag");
|
|
|
|
|
getroottable().rawdelete("EventList_Obj")
|
|
|
|
|
getroottable().rawdelete("Trainingroom_Obj");
|
|
|
|
|
|
|
|
|
|
function Lenheart_Trainingroom_Fun(obj) {
|
|
|
|
|
local RootTab = getroottable();
|
|
|
|
|
if (!RootTab.rawin("Trainingroom_Obj")) {
|
|
|
|
|
RootTab.rawset("Trainingroom_Obj", true);
|
2025-12-15 15:02:34 +08:00
|
|
|
LenheartNewUI_CreateWindow(TrainingroomC, "修炼场窗口", 0, 35, 306, 474, 0);
|
2025-12-11 20:05:06 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getroottable()["LenheartFuncTab"].rawset("TrainingroomFuncN", Lenheart_Trainingroom_Fun);
|