@shimotsuki/core 1.0.6 → 1.0.7
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 +14 -9
- package/dist/index.js +19 -16
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -970,24 +970,29 @@ type UIComponentType<T> = T extends UILayer<infer U> ? U : void;
|
|
|
970
970
|
type SceneComponentType<T> = T extends SceneLayer<infer U> ? U : void;
|
|
971
971
|
/**预制体路径 */
|
|
972
972
|
declare enum BasePrefab {
|
|
973
|
-
Root = "
|
|
974
|
-
Toast = "
|
|
975
|
-
BlackMask = "
|
|
976
|
-
Loading = "
|
|
977
|
-
Notice = "
|
|
978
|
-
Reconnection = "
|
|
973
|
+
Root = "root",
|
|
974
|
+
Toast = "toast",
|
|
975
|
+
BlackMask = "black-mask",
|
|
976
|
+
Loading = "loading",
|
|
977
|
+
Notice = "notice",
|
|
978
|
+
Reconnection = "reconnection"
|
|
979
979
|
}
|
|
980
980
|
declare class GuiManager extends BaseManager {
|
|
981
981
|
/**常驻顶层UI节点层级 */
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
982
|
+
gui: Gui;
|
|
983
|
+
private path;
|
|
984
|
+
private bundleName;
|
|
985
985
|
/**
|
|
986
986
|
* 获取预制体
|
|
987
987
|
* @param type 类型
|
|
988
988
|
* @returns
|
|
989
989
|
*/
|
|
990
990
|
private getGuiPrefabByType;
|
|
991
|
+
/**GUI资源配置 */
|
|
992
|
+
setGuiConfig: ({ path, bundleName }?: {
|
|
993
|
+
path?: string;
|
|
994
|
+
bundleName?: string;
|
|
995
|
+
}) => this;
|
|
991
996
|
/**初始化 */
|
|
992
997
|
init(): Promise<this>;
|
|
993
998
|
}
|
package/dist/index.js
CHANGED
|
@@ -1709,30 +1709,26 @@ CoreBlackMask = __decorate([
|
|
|
1709
1709
|
/**预制体路径 */
|
|
1710
1710
|
var BasePrefab;
|
|
1711
1711
|
(function (BasePrefab) {
|
|
1712
|
-
BasePrefab["Root"] = "
|
|
1713
|
-
BasePrefab["Toast"] = "
|
|
1714
|
-
BasePrefab["BlackMask"] = "
|
|
1715
|
-
BasePrefab["Loading"] = "
|
|
1716
|
-
BasePrefab["Notice"] = "
|
|
1717
|
-
BasePrefab["Reconnection"] = "
|
|
1712
|
+
BasePrefab["Root"] = "root";
|
|
1713
|
+
BasePrefab["Toast"] = "toast";
|
|
1714
|
+
BasePrefab["BlackMask"] = "black-mask";
|
|
1715
|
+
BasePrefab["Loading"] = "loading";
|
|
1716
|
+
BasePrefab["Notice"] = "notice";
|
|
1717
|
+
BasePrefab["Reconnection"] = "reconnection";
|
|
1718
1718
|
})(BasePrefab || (BasePrefab = {}));
|
|
1719
1719
|
class GuiManager extends BaseManager {
|
|
1720
1720
|
/**常驻顶层UI节点层级 */
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
}
|
|
1725
|
-
set gui(v) {
|
|
1726
|
-
this._gui = v;
|
|
1727
|
-
}
|
|
1721
|
+
gui;
|
|
1722
|
+
path = 'core';
|
|
1723
|
+
bundleName = 'resources';
|
|
1728
1724
|
/**
|
|
1729
1725
|
* 获取预制体
|
|
1730
1726
|
* @param type 类型
|
|
1731
1727
|
* @returns
|
|
1732
1728
|
*/
|
|
1733
|
-
getGuiPrefabByType = (type) => {
|
|
1729
|
+
getGuiPrefabByType = (bundleName, type) => {
|
|
1734
1730
|
return new Promise((resolve, reject) => {
|
|
1735
|
-
this.cat.res.load(
|
|
1731
|
+
this.cat.res.load(bundleName, `${this.path}/${type}`, (err, prefab) => {
|
|
1736
1732
|
if (err) {
|
|
1737
1733
|
reject(err);
|
|
1738
1734
|
}
|
|
@@ -1742,10 +1738,17 @@ class GuiManager extends BaseManager {
|
|
|
1742
1738
|
});
|
|
1743
1739
|
});
|
|
1744
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
|
+
};
|
|
1745
1748
|
/**初始化 */
|
|
1746
1749
|
async init() {
|
|
1747
1750
|
// 初始化常驻节点
|
|
1748
|
-
const root_prefab = await this.getGuiPrefabByType(BasePrefab.Root);
|
|
1751
|
+
const root_prefab = await this.getGuiPrefabByType(this.bundleName, BasePrefab.Root);
|
|
1749
1752
|
const root = instantiate(root_prefab);
|
|
1750
1753
|
this.gui = root.getComponent(Gui).init(this.cat);
|
|
1751
1754
|
director.addPersistRootNode(root);
|