@shimotsuki/core 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +8 -9
- package/dist/index.js +21 -17
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -978,23 +978,17 @@ declare enum BasePrefab {
|
|
|
978
978
|
Reconnection = "reconnection"
|
|
979
979
|
}
|
|
980
980
|
declare class GuiManager extends BaseManager {
|
|
981
|
+
#private;
|
|
981
982
|
/**常驻顶层UI节点层级 */
|
|
982
983
|
gui: Gui;
|
|
983
|
-
private path;
|
|
984
|
-
private bundleName;
|
|
985
984
|
/**
|
|
986
985
|
* 获取预制体
|
|
987
986
|
* @param type 类型
|
|
988
987
|
* @returns
|
|
989
988
|
*/
|
|
990
989
|
private getGuiPrefabByType;
|
|
991
|
-
/**GUI资源配置 */
|
|
992
|
-
setGuiConfig: ({ path, bundleName }?: {
|
|
993
|
-
path?: string;
|
|
994
|
-
bundleName?: string;
|
|
995
|
-
}) => this;
|
|
996
990
|
/**初始化 */
|
|
997
|
-
init(): Promise<this>;
|
|
991
|
+
init(path?: string, bundleName?: string): Promise<this>;
|
|
998
992
|
}
|
|
999
993
|
|
|
1000
994
|
/**
|
|
@@ -1003,7 +997,7 @@ declare class GuiManager extends BaseManager {
|
|
|
1003
997
|
* @date 2024-09-12 11:49:44
|
|
1004
998
|
*/
|
|
1005
999
|
declare class Manager {
|
|
1006
|
-
|
|
1000
|
+
#private;
|
|
1007
1001
|
static get instance(): Manager;
|
|
1008
1002
|
readonly onAppInitDelegate: AsyncDelegate<() => (Promise<void> | void)>;
|
|
1009
1003
|
/**音频 */
|
|
@@ -1018,6 +1012,11 @@ declare class Manager {
|
|
|
1018
1012
|
res: ResLoader;
|
|
1019
1013
|
/**工具类 */
|
|
1020
1014
|
util: CoreUtil;
|
|
1015
|
+
/**GUI资源配置 */
|
|
1016
|
+
setConfig: ({ gui_path, gui_bundleName }?: {
|
|
1017
|
+
gui_path?: string;
|
|
1018
|
+
gui_bundleName?: string;
|
|
1019
|
+
}) => this;
|
|
1021
1020
|
/**启动 */
|
|
1022
1021
|
boot(): Promise<void>;
|
|
1023
1022
|
}
|
package/dist/index.js
CHANGED
|
@@ -1719,8 +1719,8 @@ var BasePrefab;
|
|
|
1719
1719
|
class GuiManager extends BaseManager {
|
|
1720
1720
|
/**常驻顶层UI节点层级 */
|
|
1721
1721
|
gui;
|
|
1722
|
-
path = 'core';
|
|
1723
|
-
bundleName = 'resources';
|
|
1722
|
+
#path = 'core';
|
|
1723
|
+
#bundleName = 'resources';
|
|
1724
1724
|
/**
|
|
1725
1725
|
* 获取预制体
|
|
1726
1726
|
* @param type 类型
|
|
@@ -1728,7 +1728,7 @@ class GuiManager extends BaseManager {
|
|
|
1728
1728
|
*/
|
|
1729
1729
|
getGuiPrefabByType = (bundleName, type) => {
|
|
1730
1730
|
return new Promise((resolve, reject) => {
|
|
1731
|
-
this.cat.res.load(bundleName, `${this
|
|
1731
|
+
this.cat.res.load(bundleName, `${this.#path}/${type}`, (err, prefab) => {
|
|
1732
1732
|
if (err) {
|
|
1733
1733
|
reject(err);
|
|
1734
1734
|
}
|
|
@@ -1738,17 +1738,12 @@ class GuiManager extends BaseManager {
|
|
|
1738
1738
|
});
|
|
1739
1739
|
});
|
|
1740
1740
|
};
|
|
1741
|
-
/**GUI资源配置 */
|
|
1742
|
-
setGuiConfig = ({ path = 'core', bundleName = 'resources' } = {}) => {
|
|
1743
|
-
this.path = path;
|
|
1744
|
-
this.bundleName = bundleName;
|
|
1745
|
-
console.log('GUI资源配置', this.path, this.bundleName);
|
|
1746
|
-
return this;
|
|
1747
|
-
};
|
|
1748
1741
|
/**初始化 */
|
|
1749
|
-
async init() {
|
|
1742
|
+
async init(path = 'core', bundleName = 'resources') {
|
|
1743
|
+
this.#bundleName = bundleName;
|
|
1744
|
+
this.#path = path;
|
|
1750
1745
|
// 初始化常驻节点
|
|
1751
|
-
const root_prefab = await this.getGuiPrefabByType(this
|
|
1746
|
+
const root_prefab = await this.getGuiPrefabByType(this.#bundleName, BasePrefab.Root);
|
|
1752
1747
|
const root = instantiate(root_prefab);
|
|
1753
1748
|
this.gui = root.getComponent(Gui).init(this.cat);
|
|
1754
1749
|
director.addPersistRootNode(root);
|
|
@@ -2532,12 +2527,12 @@ CoreUIModal = __decorate([
|
|
|
2532
2527
|
* @date 2024-09-12 11:49:44
|
|
2533
2528
|
*/
|
|
2534
2529
|
class Manager {
|
|
2535
|
-
static ins;
|
|
2530
|
+
static #ins;
|
|
2536
2531
|
static get instance() {
|
|
2537
|
-
if (!this
|
|
2538
|
-
this
|
|
2532
|
+
if (!this.#ins) {
|
|
2533
|
+
this.#ins = new Manager();
|
|
2539
2534
|
}
|
|
2540
|
-
return this
|
|
2535
|
+
return this.#ins;
|
|
2541
2536
|
}
|
|
2542
2537
|
onAppInitDelegate = new AsyncDelegate();
|
|
2543
2538
|
/**音频 */
|
|
@@ -2552,6 +2547,15 @@ class Manager {
|
|
|
2552
2547
|
res;
|
|
2553
2548
|
/**工具类 */
|
|
2554
2549
|
util;
|
|
2550
|
+
#gui_path = 'core';
|
|
2551
|
+
#gui_bundleName = 'resources';
|
|
2552
|
+
/**GUI资源配置 */
|
|
2553
|
+
setConfig = ({ gui_path = 'core', gui_bundleName = 'resources' } = {}) => {
|
|
2554
|
+
this.#gui_path = gui_path;
|
|
2555
|
+
this.#gui_bundleName = gui_bundleName;
|
|
2556
|
+
console.log('GUI资源配置', this.#gui_path, this.#gui_bundleName);
|
|
2557
|
+
return this;
|
|
2558
|
+
};
|
|
2555
2559
|
/**启动 */
|
|
2556
2560
|
async boot() {
|
|
2557
2561
|
this.res = new ResLoader();
|
|
@@ -2559,7 +2563,7 @@ class Manager {
|
|
|
2559
2563
|
this.storage = new StorageManager(this);
|
|
2560
2564
|
this.event = new MessageManager();
|
|
2561
2565
|
this.audio = new AudioManager(this);
|
|
2562
|
-
this.gui = (await (new GuiManager(this)).init()).gui;
|
|
2566
|
+
this.gui = (await (new GuiManager(this)).init(this.#gui_bundleName, this.#gui_path)).gui;
|
|
2563
2567
|
}
|
|
2564
2568
|
}
|
|
2565
2569
|
const cat = Manager.instance;
|