no message

This commit is contained in:
Lenheart 2024-12-25 11:36:28 +08:00
parent fc8c9f4376
commit 7e4d318c5c
4 changed files with 69 additions and 41 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ Yosin_Game_Reloading.Sign
Script.pvf
Yosin_Engine.pdb
*.pvf
sqr/.vscode/launch.json

View File

@ -11,44 +11,25 @@ function TestStage() {
local Window = Sq_CreateWindow(_Login_Window, "登录界面窗口", 0, 0, 1066, 600, 0);
// local Window = Sq_CreateWindow(_Login_Window, "登录界面窗口", 0, 0, 1066, 600, 0);
// local Fontobj = Font();
// local MapObj = Map("map/cataclysm/town/elvengard/new_elvengard.map");
local TownObj = Town(1);
// local MapObj = Map("map/cataclysm/town/seria_room/elvengard.map");
// // local MapObj = Map("map/cataclysm/town/hendonmyre/new_backstreet_2.map");
// // local MapObj = Map("map/cataclysm/town/seria_room/elvengard.map");
// // local MapObj = Map("map/cataclysm/town/sainthorn_heaven/sainthorn_heaven_ship_rear_down.map");
// T.Addchild(MapObj);
// // local Equ = GameItem.Equipment(601500060);
// local Charc = GameObject.CreateCharacter(0, [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023]);
// // Charc.coat = Equ;
// // Charc.Init(0);
// // Charc.SetUpdateFunc(function(Chr, dt) {
// // if (!("time" in Chr.Var)) Chr.Var.time <- 0;
// // Chr.Var.time += dt;
// // if (Chr.Var.time > 2000 && Chr.Var.time< 3000) {
// // local Equ = GameItem.Equipment(601500060);
// // Chr.ChangeEquipment(Equ);
// // Chr.Var.time = 3000;
// // } else if (Chr.Var.time > 4000 && Chr.Var.time< 5000) {
// // local Equ = GameItem.Equipment(601500059);
// // Chr.ChangeEquipment(Equ);
// // Chr.Var.time = 5000;
// // } else if (Chr.Var.time > 6000 && Chr.Var.time< 7000) {
// // local Equ = GameItem.Equipment(601500058);
// // Chr.ChangeEquipment(Equ);
// // Chr.Var.time = 8000;
// // }
// // })
// Charc.SetPosition(356, 430, 0);
local Charc = GameObject.CreateCharacter(0, [101590007, 27675, 601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023]);
// Charc.SetPosition(356, 250, 0);
// Charc.SetAnimation("RestAni");
// Charc.SetZOrder(99999999);
// MapObj.Addchild(Charc);
TownObj.AddObject(Charc, true);
// local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1066, 600, 0);

View File

@ -233,7 +233,9 @@ class _CreateCharacter extends Yosin_Window {
changJobAniClock = null;
changNextJobAniClock = null;
jobIndex = null;
jobIndex = 0;
NoticeBox = null;
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
@ -243,6 +245,21 @@ class _CreateCharacter extends Yosin_Window {
//注册控件
RegisterWidget();
// 创建角色回包
MySocket.RegisterHandler(4, function(Jso) {
if (NoticeBox) NoticeBox.CloseWindow();
if (Jso.type == 0){
// 创建成功.
//关闭创建界面
NoticeBox.DestroyWindow();
DestroyWindow();
}else{
// 创建失败.
NoticeBox = _Yosin_MessageBox("创建失败.");
}
}.bindenv(this));
}
function PlayBackgroundMusic() {
@ -344,7 +361,7 @@ class _CreateCharacter extends Yosin_Window {
// 确定
enter.OnClick = function (enterName) {
local jobEnum = getJobEnum(jobIndex);
MySocket.Send(9, {
MySocket.Send(7, {
name = enterName,
gkb = jobEnum,
})
@ -751,8 +768,15 @@ class _create_Character_enterName extends Yosin_Window {
//是否为独立窗口
IsIndependent = false;
affirmButton = null;
OnClick = null;
// 检查过的名称
checkName = null;
// 当前名称
name = null;
constructor() {
base.constructor("输入角色名称", 0, 0, 1066, 600, 0);
@ -770,14 +794,17 @@ class _create_Character_enterName extends Yosin_Window {
Addchild(title);
// 输入框
nameInputBox = Yosin_InputBox(433, 270, 150);
local nameInputBox = Yosin_InputBox(433, 270, 150);
AddUIChild(nameInputBox);
nameInputBox.SetUpdateFunc(function(inputBox, Dt) {
inputBox.Parent.name = inputBox.str;
})
// 重复检查按钮
local checkButton = Yosin_BaseButton(593, 267, 46, 24 "sprite/interface/lenheartwindowcommon.img", 400);
checkButton.State = 3;
checkButton.SetUpdateFunc(function(button, Dt) {
if (button.Parent.nameInputBox.str.len() > 0) {
if (button.Parent.name.len() > 0) {
button.State = 0;
}else{
button.State = 3;
@ -785,7 +812,11 @@ class _create_Character_enterName extends Yosin_Window {
})
//点击事件回调
checkButton.OnClick = function(Button) {
if (OnClick != null) OnClick(Button.Parent.nameInputBox.str);
MySocket.Send(6, {
name = nameInputBox.str,
})
}.bindenv(this);
//按钮文本
local checkTextActor = FontAssetManager.GenerateNormal("重复", true, {
@ -805,19 +836,17 @@ class _create_Character_enterName extends Yosin_Window {
Addchild(tipTextActor);
// 确认检查按钮
local affirmButton = Yosin_BaseButton(473, 338, 46, 24 "sprite/interface/lenheartwindowcommon.img", 400);
// 确认按钮
affirmButton = Yosin_BaseButton(473, 338, 46, 24 "sprite/interface/lenheartwindowcommon.img", 400);
affirmButton.State = 3;
affirmButton.SetUpdateFunc(function(button, Dt) {
if (button.Parent.nameInputBox.str.len() > 0) {
button.State = 0;
}else{
if (button.Parent.name != button.Parent.checkName && button.State != 3) {
button.State = 3;
}
})
//点击事件回调
affirmButton.OnClick = function(Button) {
if (OnClick != null) OnClick(Button.Parent.checkName);
}.bindenv(this);
//按钮文本
local affirmTextActor = FontAssetManager.GenerateNormal("确认", true, {
@ -828,7 +857,7 @@ class _create_Character_enterName extends Yosin_Window {
AddUIChild(affirmButton);
// 取消检查按钮
// 取消按钮
local cancelButton = Yosin_BaseButton(533, 338, 46, 24 "sprite/interface/lenheartwindowcommon.img", 400);
//点击事件回调
cancelButton.OnClick = function(button) {
@ -843,6 +872,23 @@ class _create_Character_enterName extends Yosin_Window {
cancelButton.Addchild(cancelTextActor);
AddUIChild(cancelButton);
// 昵称重复检查回包
MySocket.RegisterHandler(3, function(Jso) {
if (Parent.NoticeBox) Parent.NoticeBox.CloseWindow();
if (Jso.type == 0){
// 可以使用的ID 确认按钮可以使用.
Parent.NoticeBox = _Yosin_MessageBox("可以使用的ID.");
checkName = name;
affirmButton.State = 0;
}else{
// 名称重复.
Parent.NoticeBox = _Yosin_MessageBox("名称重复.");
}
}.bindenv(this));
}
//逻辑入口
@ -850,6 +896,7 @@ class _create_Character_enterName extends Yosin_Window {
SyncPos(X, Y);
base.Proc(Dt);
}
}

View File

@ -10,7 +10,6 @@
function main(args) {
local Game = GameWindow();
Game.title = "Yosin & Kiwano";
Game.bg_color = [255.0, 255.0, 255.0, 255.0];