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);

View File

@@ -0,0 +1,202 @@
/*
文件名:MarrySystem_Preparation.nut
路径:Project/MarrySystem/MarrySystem_Preparation.nut
创建日期:2024-10-03 22:43
文件用途:准备婚礼窗口
*/
class MarrySystem_PreparationC extends LenheartNewUI_Windows {
//调试模式
// DeBugMode = true;
//不是窗口
// NoWindow = true;
//是否可见
Visible = false;
//包头
OP = 20078000;
//名字
Name1 = "测试角色名字";
Name2 = "测试角色名字";
//时间按钮
NowTimeBtn = null;
littleTimeBtn = null;
longTimeBtn = null;
//时间Flag
TimeFlag = 0;
//婚礼等级按钮
//普通
NormalBtn = null;
//高级
AdvancedBtn = null;
//豪华
LuxuryBtn = null;
//婚礼等级Flag
MarryLevelFlag = -1;
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
Childrens = [];
//注册控件
RegisterWidget();
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
}
function RegisterWidget() {
//关闭按钮
local CloseButton = LenheartNewUI_BaseButton(244, 0, 11, 12, "interface/lenheartwindowcommon.img", 276);
CloseButton.OnClick = function() {
this.Visible = false;
}.bindenv(this);
Childrens.append(CloseButton);
NowTimeBtn = LenheartNewUI_SwitchButtonText(24, 138, "现在");
NowTimeBtn.ImgIndex = 358;
NowTimeBtn.SetTextPos(12, 2);
NowTimeBtn.Width = 50;
NowTimeBtn.Height = 16;
NowTimeBtn.OnClick = function() {
TimeFlag = 0;
}.bindenv(this);
NowTimeBtn.SetCallBackFunc(function(Button) {
if (TimeFlag == 0) Button.State = 1;
else Button.State = 0;
}.bindenv(this));
AddChild(NowTimeBtn);
littleTimeBtn = LenheartNewUI_SwitchButtonText(96, 138, "20分钟");
littleTimeBtn.ImgIndex = 358;
littleTimeBtn.SetTextPos(12, 2);
littleTimeBtn.Width = 50;
littleTimeBtn.Height = 16;
littleTimeBtn.OnClick = function() {
TimeFlag = 1;
}.bindenv(this);
littleTimeBtn.SetCallBackFunc(function(Button) {
if (TimeFlag == 1) Button.State = 1;
else Button.State = 0;
}.bindenv(this));
AddChild(littleTimeBtn);
longTimeBtn = LenheartNewUI_SwitchButtonText(174, 138, "30分钟");
longTimeBtn.ImgIndex = 358;
longTimeBtn.SetTextPos(12, 2);
longTimeBtn.Width = 50;
longTimeBtn.Height = 16;
longTimeBtn.OnClick = function() {
TimeFlag = 2;
}.bindenv(this);
longTimeBtn.SetCallBackFunc(function(Button) {
if (TimeFlag == 2) Button.State = 1;
else Button.State = 0;
}.bindenv(this));
AddChild(longTimeBtn);
NormalBtn = LenheartNewUI_SwitchButton(28, 202);
NormalBtn.ImgPath = "interface2/wedding/weddingreservationpopupui.img";
NormalBtn.ImgIndex = 2;
NormalBtn.Width = 200;
NormalBtn.Height = 39;
NormalBtn.OnClick = function() {
MarryLevelFlag = 0;
}.bindenv(this);
NormalBtn.SetCallBackFunc(function(Button) {
if (MarryLevelFlag == 0) Button.State = 1;
else Button.State = 0;
}.bindenv(this));
AddChild(NormalBtn);
AdvancedBtn = LenheartNewUI_SwitchButton(28, 242);
AdvancedBtn.ImgPath = "interface2/wedding/weddingreservationpopupui.img";
AdvancedBtn.ImgIndex = 6;
AdvancedBtn.Width = 200;
AdvancedBtn.Height = 39;
AdvancedBtn.OnClick = function() {
MarryLevelFlag = 1;
}.bindenv(this);
AdvancedBtn.SetCallBackFunc(function(Button) {
if (MarryLevelFlag == 1) Button.State = 1;
else Button.State = 0;
}.bindenv(this));
AddChild(AdvancedBtn);
LuxuryBtn = LenheartNewUI_SwitchButton(28, 282);
LuxuryBtn.ImgPath = "interface2/wedding/weddingreservationpopupui.img";
LuxuryBtn.ImgIndex = 10;
LuxuryBtn.Width = 200;
LuxuryBtn.Height = 39;
LuxuryBtn.OnClick = function() {
MarryLevelFlag = 2;
}.bindenv(this);
LuxuryBtn.SetCallBackFunc(function(Button) {
if (MarryLevelFlag == 2) Button.State = 1;
else Button.State = 0;
}.bindenv(this));
AddChild(LuxuryBtn);
//确认按钮
local ConfirmButton = LenheartNewUI_ButtonText(55, 338, 15, " 确 认");
ConfirmButton.DWidth = 18;
ConfirmButton.Width = 74;
ConfirmButton.SetTextOffset(-4, 1);
ConfirmButton.OnClick = function() {
local T = {
op = OP + 13,
Time = TimeFlag,
Level = MarryLevelFlag
}
SendPackEx(T);
R_Utils.PlaySound("BUTTON_06");
CloseWindow();
}.bindenv(this);
AddChild(ConfirmButton);
//取消按钮
local CancelButton = LenheartNewUI_ButtonText(131, 338, 15, " 取 消");
CancelButton.DWidth = 18;
CancelButton.Width = 74;
CancelButton.SetTextOffset(-4, 1);
CancelButton.OnClick = function() {
CloseWindow();
}.bindenv(this);
AddChild(CancelButton);
}
//绘制主界面
function DrawMain(obj) {
//标题栏
L_sq_DrawButton(X - 2, Y, 252, "interface/lenheartwindowcommon.img", 609, 2, 7);
//绘制窗口名字
L_sq_DrawCode("申请举办婚礼", X + 95, Y + 4, sq_RGBA(134, 120, 79, 255), 0, 1);
//Item信息框一般为211的宽度
L_sq_DrawWindow(X, Y + 16, 240, 316, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13);
//绘制背景
L_sq_DrawImg("interface2/wedding/weddingreservationpopupui.img", 0, X + 16, Y + 36);
//绘制爱心
L_sq_DrawImg("interface2/wedding/weddingreservationpopupui.img", 1, X + 120, Y + 80);
//绘制姓名
L_sq_DrawCode(Name1, X + 110 - LenheartTextClass.GetStringLength(Name1), Y + 79, sq_RGBA(134, 120, 79, 255), 0, 1);
L_sq_DrawCode(Name2, X + 146, Y + 79, sq_RGBA(134, 120, 79, 255), 0, 1);
}
function Show(obj) {
DrawMain(obj);
LenheartNewUI_Windows.Show(obj);
}
//逻辑入口
function Proc(obj) {
LenheartNewUI_Windows.SyncPos(X, Y);
}
}
getroottable().rawdelete("MarrySystem_Obj");

View File

@@ -11,6 +11,9 @@ class MarrySystem_RequestC extends LenheartNewUI_Windows {
//不是窗口
// NoWindow = true;
//包头
OP = 20078000;
//是否可见
Visible = false;
@@ -26,33 +29,35 @@ class MarrySystem_RequestC extends LenheartNewUI_Windows {
function RegisterWidget() {
//关闭按钮
local CloseButton = LenheartNewUI_BaseButton(308, 3, 11, 12, "interface/lenheartwindowcommon.img", 276);
local CloseButton = LenheartNewUI_BaseButton(312, 0, 11, 12, "interface/lenheartwindowcommon.img", 276);
CloseButton.OnClick = function() {
this.Visible = false;
}.bindenv(this);
Childrens.append(CloseButton);
InputObject = LenheartNewUI_BaseInput(83, 190, 160, 20);
InputObject = LenheartNewUI_BaseInput(83, 90, 160, 20);
AddChild(InputObject);
//确认按钮
local ConfirmButton = LenheartNewUI_ButtonText(83, 220, 15, "确认申请");
local ConfirmButton = LenheartNewUI_ButtonText(83, 120, 15, "确认申请");
ConfirmButton.DWidth = 18;
ConfirmButton.Width = 74;
ConfirmButton.SetTextOffset(-4, 1);
ConfirmButton.OnClick = function() {
local T = {
op = 20055005,
op = OP + 3,
Name = InputObject.str,
}
SendPackEx(T);
R_Utils.PlaySound("BUTTON_06");
CloseWindow();
}.bindenv(this);
AddChild(ConfirmButton);
//取消按钮
local CancelButton = LenheartNewUI_ButtonText(174, 220, 15, " 取 消");
local CancelButton = LenheartNewUI_ButtonText(174, 120, 15, " 取 消");
CancelButton.DWidth = 18;
CancelButton.Width = 74;
CancelButton.SetTextOffset(-4, 1);
@@ -67,16 +72,22 @@ class MarrySystem_RequestC extends LenheartNewUI_Windows {
//绘制窗口底
// L_sq_DrawWindow(X, Y, 347, 160, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13);
//标题栏
L_sq_DrawButton(X - 1, Y, 320, "interface/lenheartwindowcommon.img", 609, 2, 7);
//绘制窗口名字
L_sq_DrawCode("申请订婚", X + 142, Y + 4, sq_RGBA(134, 120, 79, 255), 0, 1);
//Item信息框一般为211的宽度
L_sq_DrawWindow(X - 1, Y + 16, 312, 120, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13);
//绘制窗口
L_sq_DrawImg("marrysystem.img", 0, X, Y);
// L_sq_DrawImg("marrysystem.img", 0, X, Y);
local Str = "请输入你想要与之订婚的角色名。";
//绘制文字
L_sq_DrawCode(Str, X + 80, Y + 150, sq_RGBA(255, 255, 255, 250), 0, 1);
L_sq_DrawCode(Str, X + 80, Y + 50, sq_RGBA(255, 255, 255, 250), 0, 1);
local Str = "(直接点击想要订婚的角色,可自动输入名称。)";
//绘制文字
L_sq_DrawCode(Str, X + 53, Y + 166, sq_RGBA(255, 255, 255, 250), 0, 1);
L_sq_DrawCode(Str, X + 53, Y + 66, sq_RGBA(255, 255, 255, 250), 0, 1);
}
function Show(obj) {
@@ -88,17 +99,14 @@ class MarrySystem_RequestC extends LenheartNewUI_Windows {
//逻辑入口
function Proc(obj) {
LenheartNewUI_Windows.SyncPos(X, Y);
local Str = L_Sq_GetPlayerEachName();
if (Str.len() > 0 && InputObject.str.len() == 0) {
// InputObject.SetStr(Str);
InputObject.str = Str;
InputObject.SetStr(Str);
}
}
}
getroottable().rawdelete("MarrySystem_Obj");
// function Lenheart_MarrySystem_Request_Fun(obj) {
// local RootTab = getroottable();
// if (!RootTab.rawin("MarrySystem_Request_Obj")) {
// RootTab.rawset("MarrySystem_Request_Obj", true);
// LenheartNewUI_CreateWindow(MarrySystem_RequestC, "结婚系统请求窗口", ((getroottable().Rindro_Scr_Width - 329) / 2).tointeger(), 140, 329, 267, 28);
// }
// }
// getroottable()["LenheartFuncTab"].rawset("MarrySystem_RequestFuncN", Lenheart_MarrySystem_Request_Fun);
getroottable().rawdelete("MarrySystem_Obj");

View File

@@ -0,0 +1,112 @@
/*
文件名:MarrySystem_Response.nut
路径:Project/MarrySystem/MarrySystem_Response.nut
创建日期:2024-10-01 10:32
文件用途:结婚答复
*/
class MarrySystem_ResponseC extends LenheartNewUI_Windows {
//调试模式
// DeBugMode = true;
//不是窗口
// NoWindow = true;
//是否可见
Visible = false;
//包头
OP = 20078000;
//申请人
applicantName = "瓜瓜";
//申请人CID
applicantCid = -1;
//申请人UID
applicantUid = -1;
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
Childrens = [];
//注册控件
RegisterWidget();
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
}
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);
//确认按钮
local ConfirmButton = LenheartNewUI_ButtonText(83, 120, 15, "同意请求");
ConfirmButton.DWidth = 18;
ConfirmButton.Width = 74;
ConfirmButton.SetTextOffset(-4, 1);
ConfirmButton.OnClick = function() {
local T = {
op = OP + 5,
applicantCid = this.applicantCid,
applicantUid = this.applicantUid,
Flag = 1
}
SendPackEx(T);
R_Utils.PlaySound("BUTTON_06");
CloseWindow();
}.bindenv(this);
AddChild(ConfirmButton);
//取消按钮
local CancelButton = LenheartNewUI_ButtonText(174, 120, 15, " 拒 绝");
CancelButton.DWidth = 18;
CancelButton.Width = 74;
CancelButton.SetTextOffset(-4, 1);
CancelButton.OnClick = function() {
local T = {
op = OP + 5,
applicantCid = this.applicantCid,
applicantUid = this.applicantUid,
Flag = 0
}
SendPackEx(T);
R_Utils.PlaySound("BUTTON_07");
CloseWindow();
}.bindenv(this);
AddChild(CancelButton);
}
//绘制主界面
function DrawMain(obj) {
//标题栏
L_sq_DrawButton(X - 1, Y, 320, "interface/lenheartwindowcommon.img", 609, 2, 7);
//绘制窗口名字
L_sq_DrawCode("申请订婚", X + 142, Y + 4, sq_RGBA(134, 120, 79, 255), 0, 1);
//Item信息框一般为211的宽度
L_sq_DrawWindow(X - 1, Y + 16, 312, 120, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13);
//绘制窗口
L_sq_DrawImg("interface2/wedding/common.img", 8, X + 64, Y + 34);
local Str = "玩家 [" + applicantName + "] 想要与您订婚,是否同意?"
L_sq_DrawCode(Str, X + 80 - LenheartTextClass.GetStringLength(applicantName) / 2, Y + 88, sq_RGBA(255, 255, 255, 250), 0, 1);
}
function Show(obj) {
DrawMain(obj);
LenheartNewUI_Windows.Show(obj);
}
//逻辑入口
function Proc(obj) {
LenheartNewUI_Windows.SyncPos(X, Y);
}
}
getroottable().rawdelete("MarrySystem_Obj");