@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 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 = "core/root",
974
- Toast = "core/toast",
975
- BlackMask = "core/black-mask",
976
- Loading = "core/loading",
977
- Notice = "core/notice",
978
- Reconnection = "core/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
- private _gui;
983
- get gui(): Gui;
984
- set gui(v: Gui);
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"] = "core/root";
1713
- BasePrefab["Toast"] = "core/toast";
1714
- BasePrefab["BlackMask"] = "core/black-mask";
1715
- BasePrefab["Loading"] = "core/loading";
1716
- BasePrefab["Notice"] = "core/notice";
1717
- BasePrefab["Reconnection"] = "core/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
- _gui;
1722
- get gui() {
1723
- return this._gui;
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(type, (err, prefab) => {
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shimotsuki/core",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",