88 lines
2.1 KiB
Plaintext
88 lines
2.1 KiB
Plaintext
/*
|
|
文件名:GameWindow.nut
|
|
路径:UI/ObjectClass/GameWindow.nut
|
|
创建日期:2025-10-18 20:58
|
|
文件用途:游戏窗口类
|
|
*/
|
|
_SYS_UI_SCENE_Instance_ <- null
|
|
_SYS_WINDOW_LIST_ <- []
|
|
|
|
class GameWindow extends WindowNode {
|
|
//窗口名称
|
|
WindowName = "undefined"
|
|
|
|
function _typeof() {
|
|
return "GameWindow"
|
|
}
|
|
|
|
constructor(WindowName) {
|
|
base.constructor()
|
|
}
|
|
|
|
function ResetFoucus() {
|
|
SetVisible(true)
|
|
//遍历全局窗口数组将自己移除重新添加在末尾
|
|
foreach (Index, WindowObj in _SYS_WINDOW_LIST_) {
|
|
if (WindowObj.WindowName == this.WindowName) {
|
|
_SYS_WINDOW_LIST_.remove(Index)
|
|
break
|
|
}
|
|
}
|
|
_SYS_WINDOW_LIST_.append(this)
|
|
SetZOrder(_SYS_WINDOW_LIST_.len())
|
|
}
|
|
|
|
function Proc(Dt) {
|
|
|
|
}
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @function
|
|
* @param {any} WindowName
|
|
* @param {GameWindow} WindowClass
|
|
* @returns {any}
|
|
*/
|
|
function sq_CreaterWindow(WindowName, WindowClass) {
|
|
foreach (idx, val in _SYS_WINDOW_LIST_) {
|
|
if (val.WindowName == WindowName) return val;
|
|
}
|
|
|
|
local NewWindow = WindowClass(WindowName);
|
|
getroottable()._SYS_WINDOW_LIST_.push(NewWindow);
|
|
return NewWindow;
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @function
|
|
* @param {float} Dt
|
|
* @returns {void}
|
|
*/
|
|
function _Global_Windows_Logic_(Dt) {
|
|
if (_SYS_UI_SCENE_Instance_) {
|
|
for (local i = 0; i < _SYS_WINDOW_LIST_.len(); i++) {
|
|
local Window = _SYS_WINDOW_LIST_[i]
|
|
//如果窗口不可见并且 处于演出状态
|
|
if (!Window.Visible && Window.PerformanceState) {
|
|
Window.PerformanceState = false
|
|
_SYS_UI_SCENE_Instance_.RemoveChild(Window)
|
|
if (Window.DestroyFlag) {
|
|
_SYS_WINDOW_LIST_.remove(i);
|
|
i--;
|
|
}
|
|
} else if (Window.Visible && !Window.PerformanceState) {
|
|
_SYS_UI_SCENE_Instance_.AddChild(Window)
|
|
Window.PerformanceState = true;
|
|
}
|
|
//无论窗口是否显示都需要调用Proc
|
|
Window.Proc(Dt);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|