因为GenerateNormal 文字类的修改 而修改的UI窗口例程

This commit is contained in:
Lenheart 2024-12-14 23:15:53 +08:00
parent 5cacad707e
commit 254d6856c2
2 changed files with 29 additions and 9 deletions

View File

@ -62,7 +62,9 @@ class _Login_Window extends Yosin_Window {
}.bindenv(this); }.bindenv(this);
//登录按钮文本 //登录按钮文本
local LoginTextActor = FontAssetManager.GenerateNormal("登录", sq_RGBA(200, 195, 169, 255), true); local LoginTextActor = FontAssetManager.GenerateNormal("登录", true, {
color = sq_RGBA(200, 195, 169, 255)
});
LoginTextActor.SetPosition(26, 4); LoginTextActor.SetPosition(26, 4);
LoginButton.Addchild(LoginTextActor); LoginButton.Addchild(LoginTextActor);
AddUIChild(LoginButton); AddUIChild(LoginButton);
@ -77,7 +79,9 @@ class _Login_Window extends Yosin_Window {
}) })
}.bindenv(this); }.bindenv(this);
//注册按钮文本 //注册按钮文本
local RegisterTextActor = FontAssetManager.GenerateNormal("注册", sq_RGBA(200, 195, 169, 255), true); local RegisterTextActor = FontAssetManager.GenerateNormal("注册", true, {
color = sq_RGBA(200, 195, 169, 255)
});
RegisterTextActor.SetPosition(26, 4); RegisterTextActor.SetPosition(26, 4);
RegisterButton.Addchild(RegisterTextActor); RegisterButton.Addchild(RegisterTextActor);
AddUIChild(RegisterButton); AddUIChild(RegisterButton);
@ -107,11 +111,15 @@ class _Login_Window extends Yosin_Window {
LoginText.Addchild(LoginTexttip); LoginText.Addchild(LoginTexttip);
//账号 //账号
local AccountTextActor = FontAssetManager.GenerateNormal("账号:", sq_RGBA(200, 195, 169, 255), false); local AccountTextActor = FontAssetManager.GenerateNormal("账号:", false, {
color = sq_RGBA(200, 195, 169, 255)
});
AccountTextActor.SetPosition(720, 241); AccountTextActor.SetPosition(720, 241);
Addchild(AccountTextActor); Addchild(AccountTextActor);
//密码 //密码
local PasswordTextActor = FontAssetManager.GenerateNormal("密码:", sq_RGBA(200, 195, 169, 255), false); local PasswordTextActor = FontAssetManager.GenerateNormal("密码:", false, {
color = sq_RGBA(200, 195, 169, 255)
});
PasswordTextActor.SetPosition(720, 281); PasswordTextActor.SetPosition(720, 281);
Addchild(PasswordTextActor); Addchild(PasswordTextActor);
} }

View File

@ -77,13 +77,15 @@ class _Select_Character_SettingBackground_Window extends Yosin_Window {
IsIndependent = false; IsIndependent = false;
//是否可见 //是否可见
Visible = false; // Visible = false;
//选择背景按钮集合 //选择背景按钮集合
SettingBackgroundButtonList = null; SettingBackgroundButtonList = null;
Background = null; Background = null;
ScrollObject = null;
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
SettingBackgroundButtonList = []; SettingBackgroundButtonList = [];
@ -113,6 +115,14 @@ class _Select_Character_SettingBackground_Window extends Yosin_Window {
} }
AddUIChild(Buf); AddUIChild(Buf);
} }
ScrollObject = Yosin_ScrollBar(Width - 13, 5, Height - 8, 20);
ScrollObject.SetChangeCallBack(function(Value) {
foreach(Pos, Button in SettingBackgroundButtonList) {
Button.SetPosition(5 + (101 * (Pos % 2)), 9 + (61 * (Pos / 2)) - Value * (61 * 12));
}
}.bindenv(this));
AddUIChild(ScrollObject);
} }
@ -156,6 +166,9 @@ class _Select_Character_Window extends Yosin_Window {
//注册绘制 //注册绘制
RegisterDraw(); RegisterDraw();
//注册控件 //注册控件
// for (local i = 0; i< 50; i++) {
// RegisterWidget();
// }
RegisterWidget(); RegisterWidget();
//注册窗口 //注册窗口
RegisterWindow(); RegisterWindow();
@ -191,7 +204,9 @@ class _Select_Character_Window extends Yosin_Window {
}.bindenv(this); }.bindenv(this);
AddUIChild(SettingButton); AddUIChild(SettingButton);
//登录按钮文本 //登录按钮文本
local LoginTextActor = FontAssetManager.GenerateNormal("背景设置", sq_RGBA(221, 197, 147, 255), true); local LoginTextActor = FontAssetManager.GenerateNormal("背景设置", true, {
color = sq_RGBA(221, 197, 147, 255)
});
LoginTextActor.SetPosition(23, 3); LoginTextActor.SetPosition(23, 3);
LoginTextActor.SetUpdateFunc(function(Text, Dt) { LoginTextActor.SetUpdateFunc(function(Text, Dt) {
if (Text.Parent.State == 1 || Text.Parent.State == 2) { if (Text.Parent.State == 1 || Text.Parent.State == 2) {
@ -203,9 +218,6 @@ class _Select_Character_Window extends Yosin_Window {
SettingButton.Addchild(LoginTextActor); SettingButton.Addchild(LoginTextActor);
local TestButton = Yosin_ScrollBar(500, 100, 150, 40);
AddUIChild(TestButton);
} }
//切换背景 //切换背景