233 lines
8.7 KiB
Plaintext
233 lines
8.7 KiB
Plaintext
/*
|
|
文件名:MarrySystem.nut
|
|
路径:Project/MarrySystem/MarrySystem.nut
|
|
创建日期:2024-10-01 00:01
|
|
文件用途:结婚系统
|
|
*/
|
|
|
|
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 {
|
|
//调试模式
|
|
// DeBugMode = true;
|
|
|
|
//不是窗口
|
|
// NoWindow = true;
|
|
|
|
//是否可见
|
|
// Visible = false;
|
|
|
|
//包头
|
|
OP = 20078000;
|
|
|
|
//结婚状态
|
|
MarryState = 0;
|
|
|
|
//申请订婚窗口
|
|
RequestWindow = null;
|
|
//答复窗口
|
|
ResponseWindow = null;
|
|
//准备婚礼窗口
|
|
PreparationWindow = null;
|
|
|
|
|
|
|
|
|
|
|
|
//查看自己是否有结婚
|
|
function CheckMarryState() {
|
|
SendPackEx({
|
|
op = OP + 9
|
|
});
|
|
}
|
|
|
|
function CheckMarryStateCallBack(Chunk) {
|
|
local Jso = Json.Decode(Chunk);
|
|
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() {
|
|
|
|
|
|
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() {
|
|
// //关闭按钮
|
|
// local CloseButton = LenheartNewUI_BaseButton(278, 0, 11, 12, "interface/lenheartwindowcommon.img", 276);
|
|
// CloseButton.OnClick = function() {
|
|
// this.Visible = false;
|
|
// }.bindenv(this);
|
|
// Childrens.append(CloseButton);
|
|
|
|
|
|
}
|
|
|
|
|
|
//注册NPC按钮
|
|
function InitNpcEachButton() {
|
|
local EachManager = getroottable()["L_Each_Obj"];
|
|
//先清空注册
|
|
EachManager.RemoveEachForNpc(20013);
|
|
|
|
//没结婚注册申请结婚按钮
|
|
if (MarryState == 0) {
|
|
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 = 10;
|
|
ApplyEngagementButton.Str = "申请结婚";
|
|
ApplyEngagementButton.OnClick = function(Button) {
|
|
Button.Parent.CloseAllEach();
|
|
Button.Parent.CloseWindow();
|
|
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) {
|
|
|
|
}
|
|
|
|
}
|
|
getroottable().rawdelete("MarrySystem_Obj");
|
|
|
|
function Lenheart_MarrySystem_Fun(obj) {
|
|
local RootTab = getroottable();
|
|
if (!RootTab.rawin("MarrySystem_Obj")) {
|
|
RootTab.rawset("MarrySystem_Obj", MarrySystemC());
|
|
} else {
|
|
RootTab["MarrySystem_Obj"].Proc(obj);
|
|
}
|
|
}
|
|
|
|
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); |