Compare commits
2 Commits
2025102501
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 64659ae536 | |||
| 89899a3799 |
@@ -20,6 +20,7 @@ UI/ObjectClass/Actor.nut
|
|||||||
UI/ObjectClass/WindowNode.nut
|
UI/ObjectClass/WindowNode.nut
|
||||||
UI/ObjectClass/GameWindow.nut
|
UI/ObjectClass/GameWindow.nut
|
||||||
UI/ObjectClass/GameWidget.nut
|
UI/ObjectClass/GameWidget.nut
|
||||||
|
UI/ObjectClass/Text.nut
|
||||||
UI/ObjectClass/Sprite.nut
|
UI/ObjectClass/Sprite.nut
|
||||||
UI/ObjectClass/Canvas.nut
|
UI/ObjectClass/Canvas.nut
|
||||||
|
|
||||||
|
|||||||
@@ -22,3 +22,20 @@ function print(Object) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回颜色的十六进制数
|
||||||
|
* @function
|
||||||
|
* @param {any} R
|
||||||
|
* @param {any} G
|
||||||
|
* @param {any} B
|
||||||
|
* @param {any} A
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
function sq_RGBA(R, G, B, A) {
|
||||||
|
R = R.tointeger();
|
||||||
|
G = G.tointeger();
|
||||||
|
B = B.tointeger();
|
||||||
|
A = A.tointeger();
|
||||||
|
return (A << 24) + (R << 16) + (G << 8) + B;
|
||||||
|
}
|
||||||
@@ -20,15 +20,15 @@ function _MainUI_Enter_(UI_Scene) {
|
|||||||
// _SYS_UI_SCENE_Instance_.AddChild(Tc);
|
// _SYS_UI_SCENE_Instance_.AddChild(Tc);
|
||||||
// Tc.SetPos(400,300);
|
// Tc.SetPos(400,300);
|
||||||
|
|
||||||
local NgC = GameWidget_NineGridCav("sprite/interface/lenheartwindowcommon.img", 97, 300, 300);
|
// local NgC = GameWidget_NineGridCav("sprite/interface/lenheartwindowcommon.img", 97, 300, 300);
|
||||||
_SYS_UI_SCENE_Instance_.AddChild(NgC);
|
// _SYS_UI_SCENE_Instance_.AddChild(NgC);
|
||||||
NgC.SetPos(400, 300);
|
// NgC.SetPos(400, 300);
|
||||||
|
|
||||||
// local T = sq_GetPng("sprite/item/avatar/swordman/0sm_acap.img",0);
|
// local T = sq_GetPng("sprite/item/avatar/swordman/0sm_acap.img",0);
|
||||||
// print(T);
|
// print(T);
|
||||||
|
|
||||||
// local Test1 = sq_CreaterWindowInstance("测试窗口", Window_NotiBox, 150, 150, 364, 356, 20);
|
local Test1 = sq_CreaterWindowInstance("测试窗口", Window_NotiBox, 150, 150, 364, 356, 20);
|
||||||
// Test1.ResetFoucus();
|
Test1.ResetFoucus();
|
||||||
|
|
||||||
// local Canv = Canvas(600, 600);
|
// local Canv = Canvas(600, 600);
|
||||||
// _SYS_UI_SCENE_Instance_.AddChild(Canv);
|
// _SYS_UI_SCENE_Instance_.AddChild(Canv);
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class GameWidget extends WindowNode {
|
|||||||
local IMouse = Game_Cursor.GetInstance();
|
local IMouse = Game_Cursor.GetInstance();
|
||||||
local Pos = GetWorldPos();
|
local Pos = GetWorldPos();
|
||||||
if (isLBDown && Math.IsIntersectRect(IMouse.MouseX, IMouse.MouseY, 1, 1, Pos.x, Pos.y, Width, Height)) {
|
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) {
|
if (ClickSound) {
|
||||||
//TODO 音效系统
|
//TODO 音效系统
|
||||||
// Sq_PlaySoundEffect(ClickSound);
|
// 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 {
|
class Window_NotiBox extends GameWindow {
|
||||||
|
testvalue = 666;
|
||||||
|
|
||||||
constructor(Name, gX, gY, gWidth, gHeight, gTitleHeight) {
|
constructor(Name, gX, gY, gWidth, gHeight, gTitleHeight) {
|
||||||
base.constructor(Name, gX, gY, gWidth, gHeight, gTitleHeight);
|
base.constructor(Name, gX, gY, gWidth, gHeight, gTitleHeight);
|
||||||
|
|
||||||
InitSprite();
|
InitSprite();
|
||||||
InitButton();
|
// InitButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
function InitSprite() {
|
function InitSprite() {
|
||||||
local Sp = Sprite("sprite/hud/newantonui.img", 0);
|
local Sp = Sprite("sprite/hud/newantonui.img", 0);
|
||||||
AddChild(Sp);
|
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() {
|
function InitButton() {
|
||||||
local Btn = GameWidget_BaseButton(40, 40, 56, 24, "sprite/interface/lenheartwindowcommon.img", 12);
|
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);
|
AddChild(Btn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,5 +85,8 @@
|
|||||||
},
|
},
|
||||||
"UI/Windows/Widget/NineGridCav.nut": {
|
"UI/Windows/Widget/NineGridCav.nut": {
|
||||||
"description": "九宫格画布"
|
"description": "九宫格画布"
|
||||||
|
},
|
||||||
|
"UI/ObjectClass/Text.nut": {
|
||||||
|
"description": "文本类"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -95,6 +95,7 @@ function sq_CreateActor() {}
|
|||||||
function sq_RegisterDestruction(a,b) {}
|
function sq_RegisterDestruction(a,b) {}
|
||||||
function sq_CreateSprite(a,b) {}
|
function sq_CreateSprite(a,b) {}
|
||||||
function sq_CreateCanvas(a,b) {}
|
function sq_CreateCanvas(a,b) {}
|
||||||
|
function sq_CreateText(a,b,c) {}
|
||||||
function sq_AddChild(a,b){}
|
function sq_AddChild(a,b){}
|
||||||
function sq_RemoveChild(a,b){}
|
function sq_RemoveChild(a,b){}
|
||||||
function sq_SetZOrder(a,b){}
|
function sq_SetZOrder(a,b){}
|
||||||
|
|||||||
10
main.nut
10
main.nut
@@ -1,9 +1,15 @@
|
|||||||
|
function _InitFont_() {
|
||||||
|
return [
|
||||||
|
{ path = "Fonts/VonwaonBitmap-12px.ttf", size = 12 },
|
||||||
|
{ path = "Fonts/VonwaonBitmap-12px.ttf", size = 24 },
|
||||||
|
{ path = "Fonts/NotoSansSC-Light.otf", size = 12 }
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
//初始化随机数种子
|
//初始化随机数种子
|
||||||
srand(time());
|
srand(time());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local SM = StateMachine.GetInstance();
|
local SM = StateMachine.GetInstance();
|
||||||
|
|
||||||
SM.RegisterState(CHARACTERJOB.SWORDMAN, "Character_Rest", 0);
|
SM.RegisterState(CHARACTERJOB.SWORDMAN, "Character_Rest", 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user