This commit is contained in:
2026-07-14 11:44:07 +08:00
commit 4409c7b031
5906 changed files with 6959792 additions and 0 deletions
@@ -0,0 +1,116 @@
System.register(["__unresolved_0", "cc", "__unresolved_1"], function (_export, _context) {
"use strict";
var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Node, Component, js, PanelBase, _dec, _dec2, _class, _class2, _descriptor, _class3, _crd, ccclass, property, UIManager;
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
function _reportPossibleCrUseOfPanelBase(extras) {
_reporterNs.report("PanelBase", "./PanelBase", _context.meta, extras);
}
return {
setters: [function (_unresolved_) {
_reporterNs = _unresolved_;
}, function (_cc) {
_cclegacy = _cc.cclegacy;
__checkObsolete__ = _cc.__checkObsolete__;
__checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
_decorator = _cc._decorator;
Node = _cc.Node;
Component = _cc.Component;
js = _cc.js;
}, function (_unresolved_2) {
PanelBase = _unresolved_2.PanelBase;
}],
execute: function () {
_crd = true;
_cclegacy._RF.push({}, "9f00cIGPrRP9YFExjtCbuvA", "UIManager", undefined);
__checkObsolete__(['_decorator', 'Node', 'director', 'resources', 'instantiate', 'Canvas', 'Component', 'js']);
({
ccclass,
property
} = _decorator);
_export("UIManager", UIManager = (_dec = ccclass('UIManager'), _dec2 = property({
type: Node
}), _dec(_class = (_class2 = (_class3 = class UIManager extends Component {
constructor(...args) {
super(...args);
this.panels = new Map();
_initializerDefineProperty(this, "uiRoot", _descriptor, this);
}
onLoad() {
UIManager.instance = this;
} // 打开UI面板
async openPanel(panelClass) {
const panelName = js.getClassName(panelClass);
if (!this.panels.has(panelName)) {
let panelNode = (_crd && PanelBase === void 0 ? (_reportPossibleCrUseOfPanelBase({
error: Error()
}), PanelBase) : PanelBase).LoadPanel(`ui/${js.getClassName(panelClass)}`, this.uiRoot);
let newPanel = (await panelNode).getComponent(_crd && PanelBase === void 0 ? (_reportPossibleCrUseOfPanelBase({
error: Error()
}), PanelBase) : PanelBase);
this.panels.set(panelName, newPanel);
}
const existingPanel = this.panels.get(panelName);
if (existingPanel) {
existingPanel.open();
return existingPanel;
}
} // 关闭UI面板
closePanel(panelClass) {
const panelName = js.getClassName(panelClass);
if (this.panels.has(panelName)) {
const panel = this.panels.get(panelName);
if (panel) {
panel.close();
this.panels.delete(panelName);
}
}
} // 关闭所有面板
closeAllPanels() {
this.panels.forEach(panel => {
console.log("关闭页面", panel.node.name);
panel.close();
});
this.panels.clear();
}
}, _class3.instance = void 0, _class3), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "uiRoot", [_dec2], {
configurable: true,
enumerable: true,
writable: true,
initializer: function () {
return null;
}
})), _class2)) || _class));
_cclegacy._RF.pop();
_crd = false;
}
};
});
//# sourceMappingURL=846848029ee2eaec7dd62969289523953b0fd69b.js.map
@@ -0,0 +1 @@
{"version":3,"sources":["file:///D:/Users/admin/Alien_Sniper/assets/scripts/framework/ui/UIManager.ts"],"names":["_decorator","Node","Component","js","PanelBase","ccclass","property","UIManager","type","panels","Map","onLoad","instance","openPanel","panelClass","panelName","getClassName","has","panelNode","LoadPanel","uiRoot","newPanel","getComponent","set","existingPanel","get","open","closePanel","panel","close","delete","closeAllPanels","forEach","console","log","node","name","clear"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAASA,MAAAA,U,OAAAA,U;AAAYC,MAAAA,I,OAAAA,I;AAAgDC,MAAAA,S,OAAAA,S;AAAWC,MAAAA,E,OAAAA,E;;AACvEC,MAAAA,S,iBAAAA,S;;;;;;;;;OACH;AAAEC,QAAAA,OAAF;AAAWC,QAAAA;AAAX,O,GAAwBN,U;;2BAGjBO,S,WADZF,OAAO,CAAC,WAAD,C,UAQHC,QAAQ,CAAC;AAAEE,QAAAA,IAAI,EAAEP;AAAR,OAAD,C,sCARb,MACaM,SADb,SAC+BL,SAD/B,CACyC;AAAA;AAAA;AAAA,eAK7BO,MAL6B,GAKI,IAAIC,GAAJ,EALJ;;AAAA;AAAA;;AAUrCC,QAAAA,MAAM,GAAG;AACLJ,UAAAA,SAAS,CAACK,QAAV,GAAqB,IAArB;AACH,SAZoC,CAerC;;;AACsB,cAATC,SAAS,CAAsBC,UAAtB,EAA2D;AAC7E,gBAAMC,SAAS,GAAGZ,EAAE,CAACa,YAAH,CAAgBF,UAAhB,CAAlB;;AAEA,cAAI,CAAC,KAAKL,MAAL,CAAYQ,GAAZ,CAAgBF,SAAhB,CAAL,EAAiC;AAC7B,gBAAIG,SAAS,GAAG;AAAA;AAAA,wCAAUC,SAAV,CAAqB,MAAKhB,EAAE,CAACa,YAAH,CAAgBF,UAAhB,CAA4B,EAAtD,EAAyD,KAAKM,MAA9D,CAAhB;AACA,gBAAIC,QAAQ,GAAG,CAAC,MAAMH,SAAP,EAAkBI,YAAlB;AAAA;AAAA,uCAAf;AACA,iBAAKb,MAAL,CAAYc,GAAZ,CAAgBR,SAAhB,EAA2BM,QAA3B;AACH;;AACD,gBAAMG,aAAa,GAAG,KAAKf,MAAL,CAAYgB,GAAZ,CAAgBV,SAAhB,CAAtB;;AACA,cAAIS,aAAJ,EAAmB;AACfA,YAAAA,aAAa,CAACE,IAAd;AACA,mBAAOF,aAAP;AACH;AAEJ,SA9BoC,CA+BrC;;;AACOG,QAAAA,UAAU,CAAsBb,UAAtB,EAAqD;AAClE,gBAAMC,SAAS,GAAGZ,EAAE,CAACa,YAAH,CAAgBF,UAAhB,CAAlB;;AACA,cAAI,KAAKL,MAAL,CAAYQ,GAAZ,CAAgBF,SAAhB,CAAJ,EAAgC;AAC5B,kBAAMa,KAAK,GAAG,KAAKnB,MAAL,CAAYgB,GAAZ,CAAgBV,SAAhB,CAAd;;AACA,gBAAIa,KAAJ,EAAW;AACPA,cAAAA,KAAK,CAACC,KAAN;AACA,mBAAKpB,MAAL,CAAYqB,MAAZ,CAAmBf,SAAnB;AACH;AACJ;AACJ,SAzCoC,CA2CrC;;;AACOgB,QAAAA,cAAc,GAAS;AAC1B,eAAKtB,MAAL,CAAYuB,OAAZ,CAAoBJ,KAAK,IAAI;AACzBK,YAAAA,OAAO,CAACC,GAAR,CAAY,MAAZ,EAAoBN,KAAK,CAACO,IAAN,CAAWC,IAA/B;AACAR,YAAAA,KAAK,CAACC,KAAN;AACH,WAHD;AAIA,eAAKpB,MAAL,CAAY4B,KAAZ;AACH;;AAlDoC,O,UAC9BzB,Q;;;;;iBAOQ,I","sourcesContent":["import { _decorator, Node, director, resources, instantiate, Canvas, Component, js } from 'cc';\r\nimport { PanelBase } from './PanelBase';\r\nconst { ccclass, property } = _decorator;\r\n\r\n@ccclass('UIManager')\r\nexport class UIManager extends Component {\r\n static instance: UIManager\r\n\r\n\r\n\r\n private panels: Map<string, PanelBase> = new Map();\r\n\r\n @property({ type: Node })\r\n uiRoot: Node = null;\r\n\r\n onLoad() {\r\n UIManager.instance = this;\r\n }\r\n\r\n\r\n // 打开UI面板\r\n public async openPanel<T extends PanelBase>(panelClass: new () => T): Promise<T> {\r\n const panelName = js.getClassName(panelClass);\r\n\r\n if (!this.panels.has(panelName)) {\r\n let panelNode = PanelBase.LoadPanel(`ui/${js.getClassName(panelClass)}`, this.uiRoot)\r\n let newPanel = (await panelNode).getComponent(PanelBase)\r\n this.panels.set(panelName, newPanel);\r\n }\r\n const existingPanel = this.panels.get(panelName);\r\n if (existingPanel) {\r\n existingPanel.open();\r\n return existingPanel as T;\r\n }\r\n\r\n }\r\n // 关闭UI面板\r\n public closePanel<T extends PanelBase>(panelClass: new () => T): void {\r\n const panelName = js.getClassName(panelClass);\r\n if (this.panels.has(panelName)) {\r\n const panel = this.panels.get(panelName);\r\n if (panel) {\r\n panel.close();\r\n this.panels.delete(panelName);\r\n }\r\n }\r\n }\r\n\r\n // 关闭所有面板\r\n public closeAllPanels(): void {\r\n this.panels.forEach(panel => {\r\n console.log(\"关闭页面\", panel.node.name)\r\n panel.close();\r\n });\r\n this.panels.clear();\r\n }\r\n}"]}