This commit is contained in:
2024-11-15 10:32:19 +08:00
parent c1df659af4
commit e1528c41bb
35 changed files with 6343 additions and 62 deletions

View File

@@ -8,6 +8,9 @@
dofile("sqr/Project/MarrySystem/MarrySystem_Request.nut");
dofile("sqr/Project/MarrySystem/MarrySystem_Response.nut");
dofile("sqr/Project/MarrySystem/MarrySystem_Preparation.nut");
dofile("sqr/Project/MarrySystem/MarrySystem_OpenAuditoriumList.nut");
dofile("sqr/Project/MarrySystem/MarrySystem_ActionAni.nut");
dofile("sqr/Project/MarrySystem/MarrySystem_Room.nut");
class MarrySystemC extends Rindro_BaseToolClass {
//调试模式
@@ -21,6 +24,8 @@ class MarrySystemC extends Rindro_BaseToolClass {
//包头
OP = 20078000;
//配置
Config = null;
//结婚状态
MarryState = 0;
@@ -31,9 +36,31 @@ class MarrySystemC extends Rindro_BaseToolClass {
ResponseWindow = null;
//准备婚礼窗口
PreparationWindow = null;
//礼堂列表窗口
OpenAuditoriumList = null;
//婚礼演出脚本对象
MarriageScript = null;
//我的结婚时间
MyMarryTime = null;
MyMarryTimeFlag = null;
//婚房逻辑
MarrySystemRoomObject = null;
//请求配置
function GetConfig() {
SendPackEx({
op = OP + 777
});
}
function GetConfigCallBack(Chunk) {
local Jso = Json.Decode(Chunk);
Config = {};
Config.Town <- Jso.town;
Config.Area <- Jso.area;
}
//查看自己是否有结婚
@@ -68,20 +95,48 @@ class MarrySystemC extends Rindro_BaseToolClass {
PreparationWindow.ResetFocus();
}
constructor() {
//打开礼堂列表窗口
function OpenAuditoriumListWindowCallBack(Chunk) {
local Jso = Json.Decode(Chunk);
OpenAuditoriumList.List = Jso.info;
OpenAuditoriumList.Visible = true;
OpenAuditoriumList.ResetFocus();
}
//进入礼堂信息包
function OnEnterAuditoriumInfoCallBack(Chunk) {
local Jso = Json.Decode(Chunk);
MyMarryTime = Jso.time;
MyMarryTimeFlag = Clock();
}
//结婚动画包
function ActionCallBack(Chunk) {
local Jso = Json.Decode(Chunk);
MarriageScript.Init(Jso.info);
}
constructor() {
RequestWindow = MarrySystem_RequestC("结婚系统_申请订婚窗口", ((getroottable().Rindro_Scr_Width - 329) / 2).tointeger(), 180, 329, 166, 16);
ResponseWindow = MarrySystem_ResponseC("结婚系统_订婚答复窗口", ((getroottable().Rindro_Scr_Width - 329) / 2).tointeger(), 180, 329, 166, 16);
PreparationWindow = MarrySystem_PreparationC("结婚系统_准备婚礼窗口", ((getroottable().Rindro_Scr_Width - 256) / 2).tointeger(), 100, 260, 374, 28);
OpenAuditoriumList = MarrySystem_OpenAuditoriumListC("结婚系统_礼堂列表窗口", ((getroottable().Rindro_Scr_Width - 474) / 2).tointeger(), 100, 474, 354, 28);
MarriageScript = MarrySystem_ActionAniC();
MarrySystemRoomObject = MarrySystem_Room();
OnSetCharacter_Control.MarrySystem <- OnSetCharacter.bindenv(this);
Pack_Control.rawset(OP + 10, CheckMarryStateCallBack.bindenv(this));
Pack_Control.rawset(OP + 4, RequestMarryCallBack.bindenv(this));
Pack_Control.rawset(OP + 12, OpenPreparationWindowCallBack.bindenv(this));
Pack_Control.rawset(OP + 20, OpenAuditoriumListWindowCallBack.bindenv(this));
Pack_Control.rawset(OP + 22, OnEnterAuditoriumInfoCallBack.bindenv(this));
Pack_Control.rawset(OP + 34, ActionCallBack.bindenv(this));
Pack_Control.rawset(OP + 778, GetConfigCallBack.bindenv(this));
GetConfig();
CheckMarryState();
}
@@ -195,6 +250,25 @@ class MarrySystemC extends Rindro_BaseToolClass {
SThis.AddChild(ApplyEngagementButton);
}.bindenv(this));
}
//无论如何都添加礼堂列表
EachManager.AddEachForNpc(20013, function(SThis) {
//关闭按钮
local ApplyEngagementButton = LenheartNewUI_Each_BaseButton(0, 0, 100, 21, "interface2/popup_menu/popup_back.img", 3);
ApplyEngagementButton.Icon = "interface2/popup_menu/popup_icon_cn.img";
ApplyEngagementButton.IconIdx = 23;
ApplyEngagementButton.Str = "礼堂列表";
ApplyEngagementButton.OnClick = function(Button) {
Button.Parent.CloseAllEach();
Button.Parent.CloseWindow();
local T = {
op = OP + 19,
}
SendPackEx(T);
}.bindenv(this);
ApplyEngagementButton.SetCallBackFunc(function(Button) {})
SThis.AddChild(ApplyEngagementButton);
}.bindenv(this));
}
//重选角色回调
@@ -202,14 +276,100 @@ class MarrySystemC extends Rindro_BaseToolClass {
CheckMarryState();
}
//逻辑入口
function Proc(obj) {
// print(getroottable().Camera_Pos);
//判断在礼堂房间
if (Config && L_sq_GetTownIndex() == Config.Town && L_sq_GetRegionIndex() == Config.Area) {
if (MyMarryTimeFlag && MyMarryTime) {
L_sq_DrawImg("map/church/chn_church_count_number.img", 0, 720 - getroottable().Camera_Pos.X, 72 - getroottable().Camera_Pos.Y);
DrawMarryTime(obj, MyMarryTime - ((Clock() / 1000) - (MyMarryTimeFlag / 1000)));
}
}
MarriageScript.Show(obj);
}
TimeFlag = Clock();
//攻坚时间
function DrawMarryTime(obj, RealTime) {
local X = 720 - getroottable().Camera_Pos.X;
local Y = 114 - getroottable().Camera_Pos.Y;
local seconds = RealTime;
local minutes = seconds / 60;
seconds %= 60;
if (seconds< 0 && minutes< 0) return;
seconds = format("%02d", seconds).slice(-2);
minutes = format("%02d", minutes).slice(-2);
local X1 = -15;
local X2 = X1 + 18;
local Offset = 0;
Offset += 46;
L_sq_DrawImg("map/church/chn_church_count_number.img", minutes.slice(0, 1).tointeger() + 1, X + X1 + Offset, Y + 28);
L_sq_DrawImg("map/church/chn_church_count_number.img", minutes.slice(1).tointeger() + 1, X + X2 + Offset, Y + 28);
Offset += 46;
L_sq_DrawImg("map/church/chn_church_count_number.img", seconds.slice(0, 1).tointeger() + 1, X + X1 + Offset, Y + 28);
L_sq_DrawImg("map/church/chn_church_count_number.img", seconds.slice(1).tointeger() + 1, X + X2 + Offset, Y + 28);
}
}
getroottable().rawdelete("MarrySystem_Obj");
// local ReadPath = L_sq_P2I(Memory.allocUtf8String("equipment/equipment.lst").C_Object);
// local Reader = Memory.alloc(409600);
// local ReadBuffer = L_sq_P2I(Reader.C_Object);
// print(format("%02x", ReadBuffer));
// L_Sq_CallFunc(0x11A2030, "int", FFI_FASTCALL, ["int", "int", "int", "int", "int", "int"], 0x1D17638, 0, ReadPath, ReadBuffer, 0x100000, 0x19DAF4);
// L_Sq_CallFunc(0x112A9F0, "int", FFI_THISCALL, ["int", "int", "int", "int","int", "int", "int"], L_sq_RA(0x1A5FAE4), AniPath, pATH2, 1,0,0,0);
// local ItemObject = L_sq_GetItem(601500069);
// print(format("%02x", ItemObject));
// local ThisC = L_Sq_CallFunc(0x11A5990, "int", FFI_THISCALL, ["int"], 508);
// print(format("%02x", ThisC));
// local AniPath = L_sq_P2I(Memory.allocUtf8String("character/swordman/animation/attack1.ani").C_Object);
//TTTAni <- L_Sq_CallFunc(0x108F8B0, "int", FFI_THISCALL, ["int", "int", "int", "int"], ThisC, AniPath, 1, 0);
// local AniPath = L_sq_P2I(Memory.allocUtf8String("character/swordman/animation/attack1.ani").C_Object);
// TTTAni <- L_Sq_CallFunc(0x112A9F0, "int", FFI_THISCALL, ["int", "int", "int", "int", "int", "int", "int"], 0x19dc64, AniPath, 1695745, 1, 0, 0, 0);
// Rindro_Haker.LoadHook(0x65de50, ["int", "int"],
// function(args) {
// // print(format("%02x", args[0]));
// // local AniPath = NativePointer(L_sq_I2P(args[0])).readUnicodeString();
// print(format("%02x", args[0]));
// // print(args[2]);
// return null;
// },
// function(args) {
// // print(666);
// // print(format("%02x", args.pop()));
// // TTTAni <- args.pop();
// return null;
// });
// local ItemObject = R_Utils.GetEquPath(601500069);
// print(NativePointer(L_sq_I2P(ItemObject)).readUnicodeString());
function Lenheart_MarrySystem_Fun(obj) {
local RootTab = getroottable();
if (!RootTab.rawin("MarrySystem_Obj")) {
@@ -217,11 +377,17 @@ function Lenheart_MarrySystem_Fun(obj) {
} else {
RootTab["MarrySystem_Obj"].Proc(obj);
}
// if (TTTAni) {
// print(format("%02x", TTTAni));
// L_Sq_CallFunc(0x1091890, "char", FFI_THISCALL, ["int"], TTTAni);
// L_Sq_CallFunc(0x108B770, "int", FFI_THISCALL, ["int", "int", "int", "int", "int", "int"], TTTAni, L_sq_RA(0x1B45B94), 200, 200, 0, 0);
// }
}
getroottable()["LenheartFuncTab"].rawset("MarrySystemFuncN", Lenheart_MarrySystem_Fun);
// local asos = R_Utils.GetCharacByEqu(0, 0, [601550071, 601560067, 601570062, 601520061, 601500069, 601510068, 601530060, 601540069, 601580026, 101010035]);
// local asos = sq_CreateAICharacter(900);