加入文本精灵
This commit is contained in:
@@ -20,15 +20,15 @@ function _MainUI_Enter_(UI_Scene) {
|
||||
// _SYS_UI_SCENE_Instance_.AddChild(Tc);
|
||||
// Tc.SetPos(400,300);
|
||||
|
||||
local NgC = GameWidget_NineGridCav("sprite/interface/lenheartwindowcommon.img", 97, 300, 300);
|
||||
_SYS_UI_SCENE_Instance_.AddChild(NgC);
|
||||
NgC.SetPos(400, 300);
|
||||
// local NgC = GameWidget_NineGridCav("sprite/interface/lenheartwindowcommon.img", 97, 300, 300);
|
||||
// _SYS_UI_SCENE_Instance_.AddChild(NgC);
|
||||
// NgC.SetPos(400, 300);
|
||||
|
||||
// local T = sq_GetPng("sprite/item/avatar/swordman/0sm_acap.img",0);
|
||||
// print(T);
|
||||
|
||||
// local Test1 = sq_CreaterWindowInstance("测试窗口", Window_NotiBox, 150, 150, 364, 356, 20);
|
||||
// Test1.ResetFoucus();
|
||||
local Test1 = sq_CreaterWindowInstance("测试窗口", Window_NotiBox, 150, 150, 364, 356, 20);
|
||||
Test1.ResetFoucus();
|
||||
|
||||
// local Canv = Canvas(600, 600);
|
||||
// _SYS_UI_SCENE_Instance_.AddChild(Canv);
|
||||
|
||||
@@ -65,7 +65,7 @@ class GameWidget extends WindowNode {
|
||||
local IMouse = Game_Cursor.GetInstance();
|
||||
local Pos = GetWorldPos();
|
||||
if (isLBDown && Math.IsIntersectRect(IMouse.MouseX, IMouse.MouseY, 1, 1, Pos.x, Pos.y, Width, Height)) {
|
||||
if (OnClick) this.OnClick(this);
|
||||
if (OnClick) this.OnClick.call(this,this);
|
||||
if (ClickSound) {
|
||||
//TODO 音效系统
|
||||
// Sq_PlaySoundEffect(ClickSound);
|
||||
|
||||
16
UI/ObjectClass/Text.nut
Normal file
16
UI/ObjectClass/Text.nut
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
文件名:Text.nut
|
||||
路径:UI/ObjectClass/Text.nut
|
||||
创建日期:2025-10-25 15:40
|
||||
文件用途:
|
||||
*/
|
||||
class Text extends Actor {
|
||||
function _typeof() {
|
||||
return "Text"
|
||||
}
|
||||
|
||||
constructor(Str, FontIndex,Color) {
|
||||
C_Object = sq_CreateText(Str, FontIndex, Color);
|
||||
sq_RegisterDestruction(C_Object,this);
|
||||
}
|
||||
}
|
||||
@@ -6,20 +6,33 @@
|
||||
*/
|
||||
|
||||
class Window_NotiBox extends GameWindow {
|
||||
testvalue = 666;
|
||||
|
||||
constructor(Name, gX, gY, gWidth, gHeight, gTitleHeight) {
|
||||
base.constructor(Name, gX, gY, gWidth, gHeight, gTitleHeight);
|
||||
|
||||
InitSprite();
|
||||
InitButton();
|
||||
// InitButton();
|
||||
}
|
||||
|
||||
function InitSprite() {
|
||||
local Sp = Sprite("sprite/hud/newantonui.img", 0);
|
||||
AddChild(Sp);
|
||||
|
||||
local Textobj = Text("测试文本",0,sq_RGBA(255,255,255,255));
|
||||
AddChild(Textobj);
|
||||
local Textobj2 = Text("测试文本",1,sq_RGBA(255,255,255,255));
|
||||
Textobj2.SetPos(0,50);
|
||||
AddChild(Textobj2);
|
||||
}
|
||||
|
||||
function InitButton() {
|
||||
local Btn = GameWidget_BaseButton(40, 40, 56, 24, "sprite/interface/lenheartwindowcommon.img", 12);
|
||||
Btn.OnClick = function(btn){
|
||||
// print(testvalue);
|
||||
print(this);
|
||||
print(btn);
|
||||
}.bindenv(this);
|
||||
AddChild(Btn);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user