@ccgf/game-template 0.2.22 → 0.2.23

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.
@@ -261,7 +261,8 @@
261
261
  "_enabled": true,
262
262
  "__prefab": null,
263
263
  "enableGm": true,
264
- "_id": "c8U8P4lMhAdLDrejIz+NuJ"
264
+ "_id": "c8U8P4lMhAdLDrejIz+NuJ",
265
+ "homeScene": "main"
265
266
  },
266
267
  {
267
268
  "__type__": "cc.UITransform",
@@ -507,4 +508,4 @@
507
508
  "__type__": "cc.PostSettingsInfo",
508
509
  "_toneMappingType": 0
509
510
  }
510
- ]
511
+ ]
@@ -9,17 +9,17 @@ const { ccclass, property } = _decorator;
9
9
  /**
10
10
  * Boot 场景入口(**只放在 boot.scene**)。
11
11
  *
12
- * 固定启动流程:
13
- * 1. 初始化框架/主包模块,homeScene = main;
14
- * 2. 加载 main 场景;
12
+ * 1. 初始化框架/主包模块,homeScene 由配置项决定;
13
+ * 2. 加载 homeScene;
15
14
  * 3. 场景就绪后触发模块的 onSceneEnter + Gm.open。
16
15
  *
17
- * 首个场景固定是主包 main;要直接进子游戏,请在主场景模块里自己调 SubGame.enter。
16
+ * 首个场景默认是主包 main;要直接进子游戏,请在主场景模块里自己调 SubGame.enter。
18
17
  */
19
18
  @ccclass('AppStart')
20
19
  export class AppStart extends Component {
21
20
 
22
- private static readonly MAIN_SCENE = 'main';
21
+ @property({ displayName: "主场景" })
22
+ public homeScene = 'main';
23
23
 
24
24
  @property({ displayName: "是否启用GM" })
25
25
  public enableGm = false;
@@ -36,7 +36,10 @@ export class AppStart extends Component {
36
36
  }
37
37
 
38
38
  protected async start(): Promise<void> {
39
- const sceneName = AppStart.MAIN_SCENE;
39
+ const sceneName = (this.homeScene || '').trim();
40
+ if (!sceneName) {
41
+ throw new Error('[AppStart] homeScene 不能为空');
42
+ }
40
43
  SubGame.setHomeScene(sceneName);
41
44
  log(`[AppStart] boot -> ${sceneName}`);
42
45
 
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "dependencies": {
8
8
  "@ccgf/framework": "^0.1.12"
9
9
  },
10
- "version": "0.2.22",
10
+ "version": "0.2.23",
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },