This commit is contained in:
2024-10-05 11:46:39 +08:00
parent 8c2522f366
commit c1df659af4
12 changed files with 556 additions and 65 deletions

View File

@@ -6,6 +6,8 @@
*/
dofile("sqr/Project/MarrySystem/MarrySystem_Request.nut");
dofile("sqr/Project/MarrySystem/MarrySystem_Response.nut");
dofile("sqr/Project/MarrySystem/MarrySystem_Preparation.nut");
class MarrySystemC extends Rindro_BaseToolClass {
//调试模式
@@ -18,33 +20,69 @@ class MarrySystemC extends Rindro_BaseToolClass {
// Visible = false;
//包头
OP = 20099000;
OP = 20078000;
//自身是否结婚
IsMarryFlag = false;
//结婚状态
MarryState = 0;
//申请订婚窗口
ApplyEngagementWindow = null;
RequestWindow = null;
//答复窗口
ResponseWindow = null;
//准备婚礼窗口
PreparationWindow = null;
//查看自己是否有结婚
function CheckMarry() {
function CheckMarryState() {
SendPackEx({
op = OP + 1
op = OP + 9
});
}
function CheckMarryCallBack(Chunk) {
function CheckMarryStateCallBack(Chunk) {
local Jso = Json.Decode(Chunk);
IsMarryFlag = Jso.Flag;
MarryState = Jso.Flag;
InitNpcEachButton();
}
//收到结婚请求
function RequestMarryCallBack(Chunk) {
local Jso = Json.Decode(Chunk);
ResponseWindow.applicantName = Jso.applicantName;
ResponseWindow.applicantCid = Jso.applicantCid;
ResponseWindow.applicantUid = Jso.applicantUid;
ResponseWindow.Visible = true;
ResponseWindow.ResetFocus();
}
//打开准备婚礼窗口
function OpenPreparationWindowCallBack(Chunk) {
local Jso = Json.Decode(Chunk);
PreparationWindow.Name1 = Jso.MyName;
PreparationWindow.Name2 = Jso.TargetName;
PreparationWindow.Visible = true;
PreparationWindow.ResetFocus();
}
constructor() {
ApplyEngagementWindow = MarrySystem_RequestC("结婚系统_申请订婚窗口", ((getroottable().Rindro_Scr_Width - 329) / 2).tointeger(), 140, 329, 267, 28);
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);
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));
CheckMarryState();
}
function RegisterWidget() {
@@ -66,7 +104,7 @@ class MarrySystemC extends Rindro_BaseToolClass {
EachManager.RemoveEachForNpc(20013);
//没结婚注册申请结婚按钮
if (!IsMarryFlag) {
if (MarryState == 0) {
EachManager.AddEachForNpc(20013, function(SThis) {
//关闭按钮
local ApplyEngagementButton = LenheartNewUI_Each_BaseButton(0, 0, 100, 21, "interface2/popup_menu/popup_back.img", 3);
@@ -76,16 +114,93 @@ class MarrySystemC extends Rindro_BaseToolClass {
ApplyEngagementButton.OnClick = function(Button) {
Button.Parent.CloseAllEach();
Button.Parent.CloseWindow();
ApplyEngagementWindow.Visible = true;
ApplyEngagementWindow.ResetFocus();
RequestWindow.Visible = true;
RequestWindow.ResetFocus();
}.bindenv(this);
ApplyEngagementButton.SetCallBackFunc(function(Button) {})
SThis.AddChild(ApplyEngagementButton);
}.bindenv(this));
}
//已订婚 未结婚
else if (MarryState == 1) {
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 = 12;
ApplyEngagementButton.Str = "退婚";
ApplyEngagementButton.OnClick = function(Button) {
Button.Parent.CloseAllEach();
Button.Parent.CloseWindow();
local T = {
op = OP + 7,
}
SendPackEx(T);
}.bindenv(this);
ApplyEngagementButton.SetCallBackFunc(function(Button) {})
SThis.AddChild(ApplyEngagementButton);
//关闭按钮
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 = 11;
ApplyEngagementButton.Str = "举办婚礼";
ApplyEngagementButton.OnClick = function(Button) {
Button.Parent.CloseAllEach();
Button.Parent.CloseWindow();
local T = {
op = OP + 11,
}
SendPackEx(T);
}.bindenv(this);
ApplyEngagementButton.SetCallBackFunc(function(Button) {})
SThis.AddChild(ApplyEngagementButton);
}.bindenv(this));
}
//等待举行婚礼
else if (MarryState == 2) {
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 = 13;
ApplyEngagementButton.Str = "进入礼堂";
ApplyEngagementButton.OnClick = function(Button) {
Button.Parent.CloseAllEach();
Button.Parent.CloseWindow();
local T = {
op = OP + 15,
room = -1
}
SendPackEx(T);
}.bindenv(this);
ApplyEngagementButton.SetCallBackFunc(function(Button) {})
SThis.AddChild(ApplyEngagementButton);
}.bindenv(this));
EachManager.AddEachForNpc(20014, 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 = 14;
ApplyEngagementButton.Str = "离开礼堂";
ApplyEngagementButton.OnClick = function(Button) {
Button.Parent.CloseAllEach();
Button.Parent.CloseWindow();
local T = {
op = OP + 17
}
SendPackEx(T);
}.bindenv(this);
ApplyEngagementButton.SetCallBackFunc(function(Button) {})
SThis.AddChild(ApplyEngagementButton);
}.bindenv(this));
}
}
//重选角色回调
function OnSetCharacter() {
CheckMarryState();
}
//逻辑入口
function Proc(obj) {
@@ -104,4 +219,15 @@ function Lenheart_MarrySystem_Fun(obj) {
}
}
getroottable()["LenheartFuncTab"].rawset("MarrySystemFuncN", Lenheart_MarrySystem_Fun);
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);
// asos.setCurrentPos(sq_getMyCharacter().getXPos() + 100, sq_getMyCharacter().getYPos(), 0);
// sq_AddObject(sq_getMyCharacter(), asos, OBJECTTYPE_VIRTUALCHARACTER, false);
// local ItemObject = L_sq_GetItem(27675);
// // local ItemObject = L_sq_GetItem(27582);
// L_Sq_CallFunc(0x8265A0, "void", FFI_THISCALL, ["int","int","int"], L_Sq_GetObjectAddress(asos),ItemObject,0xFFFFFFFF);