因为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);
//登录按钮文本
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);
LoginButton.Addchild(LoginTextActor);
AddUIChild(LoginButton);
@ -77,7 +79,9 @@ class _Login_Window extends Yosin_Window {
})
}.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);
RegisterButton.Addchild(RegisterTextActor);
AddUIChild(RegisterButton);
@ -107,11 +111,15 @@ class _Login_Window extends Yosin_Window {
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);
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);
Addchild(PasswordTextActor);
}

View File

@ -77,13 +77,15 @@ class _Select_Character_SettingBackground_Window extends Yosin_Window {
IsIndependent = false;
//是否可见
Visible = false;
// Visible = false;
//选择背景按钮集合
SettingBackgroundButtonList = null;
Background = null;
ScrollObject = null;
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
SettingBackgroundButtonList = [];
@ -113,6 +115,14 @@ class _Select_Character_SettingBackground_Window extends Yosin_Window {
}
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();
//注册控件
// for (local i = 0; i< 50; i++) {
// RegisterWidget();
// }
RegisterWidget();
//注册窗口
RegisterWindow();
@ -191,7 +204,9 @@ class _Select_Character_Window extends Yosin_Window {
}.bindenv(this);
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.SetUpdateFunc(function(Text, Dt) {
if (Text.Parent.State == 1 || Text.Parent.State == 2) {
@ -203,9 +218,6 @@ class _Select_Character_Window extends Yosin_Window {
SettingButton.Addchild(LoginTextActor);
local TestButton = Yosin_ScrollBar(500, 100, 150, 40);
AddUIChild(TestButton);
}
//切换背景