107 lines
2.9 KiB
Plaintext
107 lines
2.9 KiB
Plaintext
/*
|
|
文件名:MarrySystem.nut
|
|
路径:Project/MarrySystem/MarrySystem.nut
|
|
创建日期:2024-10-01 00:01
|
|
文件用途:结婚系统
|
|
*/
|
|
|
|
dofile("sqr/Project/MarrySystem/MarrySystem_Request.nut");
|
|
|
|
class MarrySystemC extends Rindro_BaseToolClass {
|
|
//调试模式
|
|
// DeBugMode = true;
|
|
|
|
//不是窗口
|
|
// NoWindow = true;
|
|
|
|
//是否可见
|
|
// Visible = false;
|
|
|
|
//包头
|
|
OP = 20099000;
|
|
|
|
//自身是否结婚
|
|
IsMarryFlag = false;
|
|
|
|
//申请订婚窗口
|
|
ApplyEngagementWindow = null;
|
|
|
|
|
|
//查看自己是否有结婚
|
|
function CheckMarry() {
|
|
SendPackEx({
|
|
op = OP + 1
|
|
});
|
|
}
|
|
|
|
function CheckMarryCallBack(Chunk) {
|
|
local Jso = Json.Decode(Chunk);
|
|
IsMarryFlag = Jso.Flag;
|
|
InitNpcEachButton();
|
|
}
|
|
|
|
constructor() {
|
|
|
|
|
|
ApplyEngagementWindow = MarrySystem_RequestC("结婚系统_申请订婚窗口", ((getroottable().Rindro_Scr_Width - 329) / 2).tointeger(), 140, 329, 267, 28);
|
|
|
|
}
|
|
|
|
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 (!IsMarryFlag) {
|
|
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();
|
|
ApplyEngagementWindow.Visible = true;
|
|
ApplyEngagementWindow.ResetFocus();
|
|
}.bindenv(this);
|
|
ApplyEngagementButton.SetCallBackFunc(function(Button) {})
|
|
SThis.AddChild(ApplyEngagementButton);
|
|
}.bindenv(this));
|
|
}
|
|
|
|
}
|
|
|
|
|
|
//逻辑入口
|
|
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); |