@ccgf/game-template 0.2.11 → 0.2.13
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/assets/scenes/main.scene +5 -5
- package/assets/scripts/AppStart.ts +47 -28
- package/package.json +2 -2
package/assets/scenes/main.scene
CHANGED
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
"_prefab": null,
|
|
90
90
|
"_lpos": {
|
|
91
91
|
"__type__": "cc.Vec3",
|
|
92
|
-
"x":
|
|
93
|
-
"y":
|
|
92
|
+
"x": 960,
|
|
93
|
+
"y": 540,
|
|
94
94
|
"z": 0
|
|
95
95
|
},
|
|
96
96
|
"_lrot": {
|
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
"_priority": 0,
|
|
176
176
|
"_fov": 45,
|
|
177
177
|
"_fovAxis": 0,
|
|
178
|
-
"_orthoHeight":
|
|
178
|
+
"_orthoHeight": 645.0731707317074,
|
|
179
179
|
"_near": 0,
|
|
180
180
|
"_far": 2000,
|
|
181
181
|
"_color": {
|
|
@@ -277,8 +277,8 @@
|
|
|
277
277
|
"__prefab": null,
|
|
278
278
|
"_contentSize": {
|
|
279
279
|
"__type__": "cc.Size",
|
|
280
|
-
"width":
|
|
281
|
-
"height":
|
|
280
|
+
"width": 1920,
|
|
281
|
+
"height": 1080
|
|
282
282
|
},
|
|
283
283
|
"_anchorPoint": {
|
|
284
284
|
"__type__": "cc.Vec2",
|
|
@@ -1,28 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
/**
|
|
2
|
+
* ⚠️ 这是**模板专属**的 AppStart,不是 dev 工程那份的副本 —— 两者**故意不一样**:
|
|
3
|
+
*
|
|
4
|
+
* dev 工程 :import '../scripts/shared/red-dot'; (工作区形态 ✓ 开发红点用 ✓)
|
|
5
|
+
* 模板工程 :**不 import red-dot** ✓✓
|
|
6
|
+
*
|
|
7
|
+
* 为什么模板不能引它:@ccgf/red-dot 是**公共模块页按需安装**的 ✓,模板的 dependencies
|
|
8
|
+
* 里没有它 ✗ —— 引了的话新工程一打开就是:
|
|
9
|
+
*
|
|
10
|
+
* 以 .../assets/scripts/AppStart.ts 为起点找不到模块 "@ccgf/red-dot"
|
|
11
|
+
* Missing class: ... (AppStart 上的脚本全丢)
|
|
12
|
+
*
|
|
13
|
+
* (实测踩过:dev 那份被改写成包名后带进模板,导致每个新工程都打不开 ✓)
|
|
14
|
+
*
|
|
15
|
+
* 另外两点:
|
|
16
|
+
* - `tools/template-files/**` 的文件是**原样拷贝**的 ✓,不参与 import 改写 ✗
|
|
17
|
+
* -> 所以这里必须直接写成**包名**(@ccgf/framework)✓;
|
|
18
|
+
* - **不要**在这里放 AppStart.ts.meta:模板构建先拷 dev 工程(含它的 meta ✓),
|
|
19
|
+
* 再用本文件覆盖 .ts ✓ —— 这样场景里 AppStart 的 **UUID 保持不变** ✓✓
|
|
20
|
+
* (自己带一份 meta 会让 UUID 变,场景上的组件会变成 missing ✗)。
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { _decorator, Component, Node } from 'cc';
|
|
24
|
+
import { GameIns } from '@ccgf/framework';
|
|
25
|
+
import { Gm } from '@ccgf/framework';
|
|
26
|
+
import { DEBUG } from 'cc/env';
|
|
27
|
+
const { ccclass, property } = _decorator;
|
|
28
|
+
|
|
29
|
+
@ccclass('AppStart')
|
|
30
|
+
export class AppStart extends Component {
|
|
31
|
+
|
|
32
|
+
@property({ displayName: "是否启用GM" })
|
|
33
|
+
public enableGm = false;
|
|
34
|
+
|
|
35
|
+
protected onLoad(): void {
|
|
36
|
+
GameIns.init(this.node);
|
|
37
|
+
|
|
38
|
+
Gm.setEnabled(this.enableGm && DEBUG);
|
|
39
|
+
Gm.open();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
start() { }
|
|
43
|
+
|
|
44
|
+
update(deltaTime: number) {
|
|
45
|
+
GameIns.update(deltaTime);
|
|
46
|
+
}
|
|
47
|
+
}
|