@ccgf/game-template 0.2.23 → 0.2.25

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.
@@ -0,0 +1,683 @@
1
+ [
2
+ {
3
+ "__type__": "cc.Prefab",
4
+ "_name": "Loading",
5
+ "_objFlags": 0,
6
+ "__editorExtras__": {},
7
+ "_native": "",
8
+ "data": {
9
+ "__id__": 1
10
+ },
11
+ "optimizationPolicy": 0,
12
+ "persistent": false
13
+ },
14
+ {
15
+ "__type__": "cc.Node",
16
+ "_name": "Loading",
17
+ "_objFlags": 0,
18
+ "__editorExtras__": {},
19
+ "_parent": null,
20
+ "_children": [
21
+ {
22
+ "__id__": 2
23
+ },
24
+ {
25
+ "__id__": 16
26
+ }
27
+ ],
28
+ "_active": true,
29
+ "_components": [
30
+ {
31
+ "__id__": 22
32
+ },
33
+ {
34
+ "__id__": 24
35
+ },
36
+ {
37
+ "__id__": 26
38
+ },
39
+ {
40
+ "__id__": 28
41
+ }
42
+ ],
43
+ "_prefab": {
44
+ "__id__": 30
45
+ },
46
+ "_lpos": {
47
+ "__type__": "cc.Vec3",
48
+ "x": 0,
49
+ "y": 0,
50
+ "z": 0
51
+ },
52
+ "_lrot": {
53
+ "__type__": "cc.Quat",
54
+ "x": 0,
55
+ "y": 0,
56
+ "z": 0,
57
+ "w": 1
58
+ },
59
+ "_lscale": {
60
+ "__type__": "cc.Vec3",
61
+ "x": 1,
62
+ "y": 1,
63
+ "z": 1
64
+ },
65
+ "_mobility": 0,
66
+ "_layer": 1073741824,
67
+ "_euler": {
68
+ "__type__": "cc.Vec3",
69
+ "x": 0,
70
+ "y": 0,
71
+ "z": 0
72
+ },
73
+ "_id": ""
74
+ },
75
+ {
76
+ "__type__": "cc.Node",
77
+ "_name": "ProgressBar",
78
+ "_objFlags": 0,
79
+ "__editorExtras__": {},
80
+ "_parent": {
81
+ "__id__": 1
82
+ },
83
+ "_children": [
84
+ {
85
+ "__id__": 3
86
+ }
87
+ ],
88
+ "_active": true,
89
+ "_components": [
90
+ {
91
+ "__id__": 9
92
+ },
93
+ {
94
+ "__id__": 11
95
+ },
96
+ {
97
+ "__id__": 13
98
+ }
99
+ ],
100
+ "_prefab": {
101
+ "__id__": 15
102
+ },
103
+ "_lpos": {
104
+ "__type__": "cc.Vec3",
105
+ "x": 0,
106
+ "y": -436.505,
107
+ "z": 0
108
+ },
109
+ "_lrot": {
110
+ "__type__": "cc.Quat",
111
+ "x": 0,
112
+ "y": 0,
113
+ "z": 0,
114
+ "w": 1
115
+ },
116
+ "_lscale": {
117
+ "__type__": "cc.Vec3",
118
+ "x": 1,
119
+ "y": 1,
120
+ "z": 1
121
+ },
122
+ "_mobility": 0,
123
+ "_layer": 1073741824,
124
+ "_euler": {
125
+ "__type__": "cc.Vec3",
126
+ "x": 0,
127
+ "y": 0,
128
+ "z": 0
129
+ },
130
+ "_id": ""
131
+ },
132
+ {
133
+ "__type__": "cc.Node",
134
+ "_name": "Bar",
135
+ "_objFlags": 0,
136
+ "__editorExtras__": {},
137
+ "_parent": {
138
+ "__id__": 2
139
+ },
140
+ "_children": [],
141
+ "_active": true,
142
+ "_components": [
143
+ {
144
+ "__id__": 4
145
+ },
146
+ {
147
+ "__id__": 6
148
+ }
149
+ ],
150
+ "_prefab": {
151
+ "__id__": 8
152
+ },
153
+ "_lpos": {
154
+ "__type__": "cc.Vec3",
155
+ "x": -300,
156
+ "y": 0,
157
+ "z": 0
158
+ },
159
+ "_lrot": {
160
+ "__type__": "cc.Quat",
161
+ "x": 0,
162
+ "y": 0,
163
+ "z": 0,
164
+ "w": 1
165
+ },
166
+ "_lscale": {
167
+ "__type__": "cc.Vec3",
168
+ "x": 1,
169
+ "y": 1,
170
+ "z": 1
171
+ },
172
+ "_mobility": 0,
173
+ "_layer": 1073741824,
174
+ "_euler": {
175
+ "__type__": "cc.Vec3",
176
+ "x": 0,
177
+ "y": 0,
178
+ "z": 0
179
+ },
180
+ "_id": ""
181
+ },
182
+ {
183
+ "__type__": "cc.UITransform",
184
+ "_name": "",
185
+ "_objFlags": 0,
186
+ "__editorExtras__": {},
187
+ "node": {
188
+ "__id__": 3
189
+ },
190
+ "_enabled": true,
191
+ "__prefab": {
192
+ "__id__": 5
193
+ },
194
+ "_contentSize": {
195
+ "__type__": "cc.Size",
196
+ "width": 300,
197
+ "height": 15
198
+ },
199
+ "_anchorPoint": {
200
+ "__type__": "cc.Vec2",
201
+ "x": 0,
202
+ "y": 0.5
203
+ },
204
+ "_id": ""
205
+ },
206
+ {
207
+ "__type__": "cc.CompPrefabInfo",
208
+ "fileId": "ddDQXgVPpFJq/3zj0NLAjS"
209
+ },
210
+ {
211
+ "__type__": "cc.Sprite",
212
+ "_name": "",
213
+ "_objFlags": 0,
214
+ "__editorExtras__": {},
215
+ "node": {
216
+ "__id__": 3
217
+ },
218
+ "_enabled": true,
219
+ "__prefab": {
220
+ "__id__": 7
221
+ },
222
+ "_customMaterial": null,
223
+ "_srcBlendFactor": 2,
224
+ "_dstBlendFactor": 4,
225
+ "_color": {
226
+ "__type__": "cc.Color",
227
+ "r": 255,
228
+ "g": 255,
229
+ "b": 255,
230
+ "a": 255
231
+ },
232
+ "_spriteFrame": {
233
+ "__uuid__": "24a704da-2867-446d-8d1a-5e920c75e09d@f9941",
234
+ "__expectedType__": "cc.SpriteFrame"
235
+ },
236
+ "_type": 1,
237
+ "_fillType": 0,
238
+ "_sizeMode": 0,
239
+ "_fillCenter": {
240
+ "__type__": "cc.Vec2",
241
+ "x": 0,
242
+ "y": 0
243
+ },
244
+ "_fillStart": 0,
245
+ "_fillRange": 0,
246
+ "_isTrimmedMode": true,
247
+ "_useGrayscale": false,
248
+ "_atlas": null,
249
+ "_id": ""
250
+ },
251
+ {
252
+ "__type__": "cc.CompPrefabInfo",
253
+ "fileId": "c07RXlk9RGSqM4th/MVPQ1"
254
+ },
255
+ {
256
+ "__type__": "cc.PrefabInfo",
257
+ "root": {
258
+ "__id__": 1
259
+ },
260
+ "asset": {
261
+ "__id__": 0
262
+ },
263
+ "fileId": "26vu59vb1N8LkP9v/uGQdc",
264
+ "instance": null,
265
+ "targetOverrides": null,
266
+ "nestedPrefabInstanceRoots": null
267
+ },
268
+ {
269
+ "__type__": "cc.UITransform",
270
+ "_name": "",
271
+ "_objFlags": 0,
272
+ "__editorExtras__": {},
273
+ "node": {
274
+ "__id__": 2
275
+ },
276
+ "_enabled": true,
277
+ "__prefab": {
278
+ "__id__": 10
279
+ },
280
+ "_contentSize": {
281
+ "__type__": "cc.Size",
282
+ "width": 600,
283
+ "height": 15
284
+ },
285
+ "_anchorPoint": {
286
+ "__type__": "cc.Vec2",
287
+ "x": 0.5,
288
+ "y": 0.5
289
+ },
290
+ "_id": ""
291
+ },
292
+ {
293
+ "__type__": "cc.CompPrefabInfo",
294
+ "fileId": "83BEVaUddHQZvncPu+Zpae"
295
+ },
296
+ {
297
+ "__type__": "cc.Sprite",
298
+ "_name": "",
299
+ "_objFlags": 0,
300
+ "__editorExtras__": {},
301
+ "node": {
302
+ "__id__": 2
303
+ },
304
+ "_enabled": true,
305
+ "__prefab": {
306
+ "__id__": 12
307
+ },
308
+ "_customMaterial": null,
309
+ "_srcBlendFactor": 2,
310
+ "_dstBlendFactor": 4,
311
+ "_color": {
312
+ "__type__": "cc.Color",
313
+ "r": 255,
314
+ "g": 255,
315
+ "b": 255,
316
+ "a": 255
317
+ },
318
+ "_spriteFrame": {
319
+ "__uuid__": "9fd900dd-221b-4f89-8f2c-fba34243c835@f9941",
320
+ "__expectedType__": "cc.SpriteFrame"
321
+ },
322
+ "_type": 1,
323
+ "_fillType": 0,
324
+ "_sizeMode": 0,
325
+ "_fillCenter": {
326
+ "__type__": "cc.Vec2",
327
+ "x": 0,
328
+ "y": 0
329
+ },
330
+ "_fillStart": 0,
331
+ "_fillRange": 0,
332
+ "_isTrimmedMode": true,
333
+ "_useGrayscale": false,
334
+ "_atlas": null,
335
+ "_id": ""
336
+ },
337
+ {
338
+ "__type__": "cc.CompPrefabInfo",
339
+ "fileId": "1dmFE0+DBF5rDjkbbUmqaN"
340
+ },
341
+ {
342
+ "__type__": "cc.ProgressBar",
343
+ "_name": "",
344
+ "_objFlags": 0,
345
+ "__editorExtras__": {},
346
+ "node": {
347
+ "__id__": 2
348
+ },
349
+ "_enabled": true,
350
+ "__prefab": {
351
+ "__id__": 14
352
+ },
353
+ "_barSprite": {
354
+ "__id__": 6
355
+ },
356
+ "_mode": 0,
357
+ "_totalLength": 600,
358
+ "_progress": 0.5,
359
+ "_reverse": false,
360
+ "_id": ""
361
+ },
362
+ {
363
+ "__type__": "cc.CompPrefabInfo",
364
+ "fileId": "e1ro00aw1LO4o9FTtkb74I"
365
+ },
366
+ {
367
+ "__type__": "cc.PrefabInfo",
368
+ "root": {
369
+ "__id__": 1
370
+ },
371
+ "asset": {
372
+ "__id__": 0
373
+ },
374
+ "fileId": "de2PQTvs1EM4d5bWMbAHKF",
375
+ "instance": null,
376
+ "targetOverrides": null,
377
+ "nestedPrefabInstanceRoots": null
378
+ },
379
+ {
380
+ "__type__": "cc.Node",
381
+ "_name": "Label",
382
+ "_objFlags": 0,
383
+ "__editorExtras__": {},
384
+ "_parent": {
385
+ "__id__": 1
386
+ },
387
+ "_children": [],
388
+ "_active": true,
389
+ "_components": [
390
+ {
391
+ "__id__": 17
392
+ },
393
+ {
394
+ "__id__": 19
395
+ }
396
+ ],
397
+ "_prefab": {
398
+ "__id__": 21
399
+ },
400
+ "_lpos": {
401
+ "__type__": "cc.Vec3",
402
+ "x": 0,
403
+ "y": 0,
404
+ "z": 0
405
+ },
406
+ "_lrot": {
407
+ "__type__": "cc.Quat",
408
+ "x": 0,
409
+ "y": 0,
410
+ "z": 0,
411
+ "w": 1
412
+ },
413
+ "_lscale": {
414
+ "__type__": "cc.Vec3",
415
+ "x": 1,
416
+ "y": 1,
417
+ "z": 1
418
+ },
419
+ "_mobility": 0,
420
+ "_layer": 1073741824,
421
+ "_euler": {
422
+ "__type__": "cc.Vec3",
423
+ "x": 0,
424
+ "y": 0,
425
+ "z": 0
426
+ },
427
+ "_id": ""
428
+ },
429
+ {
430
+ "__type__": "cc.UITransform",
431
+ "_name": "",
432
+ "_objFlags": 0,
433
+ "__editorExtras__": {},
434
+ "node": {
435
+ "__id__": 16
436
+ },
437
+ "_enabled": true,
438
+ "__prefab": {
439
+ "__id__": 18
440
+ },
441
+ "_contentSize": {
442
+ "__type__": "cc.Size",
443
+ "width": 355.908203125,
444
+ "height": 126
445
+ },
446
+ "_anchorPoint": {
447
+ "__type__": "cc.Vec2",
448
+ "x": 0.5,
449
+ "y": 0.5
450
+ },
451
+ "_id": ""
452
+ },
453
+ {
454
+ "__type__": "cc.CompPrefabInfo",
455
+ "fileId": "2aVGfdl/ZF7on30DtBKd9l"
456
+ },
457
+ {
458
+ "__type__": "cc.Label",
459
+ "_name": "",
460
+ "_objFlags": 0,
461
+ "__editorExtras__": {},
462
+ "node": {
463
+ "__id__": 16
464
+ },
465
+ "_enabled": true,
466
+ "__prefab": {
467
+ "__id__": 20
468
+ },
469
+ "_customMaterial": null,
470
+ "_srcBlendFactor": 2,
471
+ "_dstBlendFactor": 4,
472
+ "_color": {
473
+ "__type__": "cc.Color",
474
+ "r": 0,
475
+ "g": 0,
476
+ "b": 0,
477
+ "a": 255
478
+ },
479
+ "_string": "Loading",
480
+ "_horizontalAlign": 1,
481
+ "_verticalAlign": 1,
482
+ "_actualFontSize": 100,
483
+ "_fontSize": 100,
484
+ "_fontFamily": "Arial",
485
+ "_lineHeight": 100,
486
+ "_overflow": 0,
487
+ "_enableWrapText": true,
488
+ "_font": null,
489
+ "_isSystemFontUsed": true,
490
+ "_spacingX": 0,
491
+ "_isItalic": false,
492
+ "_isBold": false,
493
+ "_isUnderline": false,
494
+ "_underlineHeight": 2,
495
+ "_cacheMode": 0,
496
+ "_enableOutline": false,
497
+ "_outlineColor": {
498
+ "__type__": "cc.Color",
499
+ "r": 0,
500
+ "g": 0,
501
+ "b": 0,
502
+ "a": 255
503
+ },
504
+ "_outlineWidth": 2,
505
+ "_enableShadow": false,
506
+ "_shadowColor": {
507
+ "__type__": "cc.Color",
508
+ "r": 0,
509
+ "g": 0,
510
+ "b": 0,
511
+ "a": 255
512
+ },
513
+ "_shadowOffset": {
514
+ "__type__": "cc.Vec2",
515
+ "x": 2,
516
+ "y": 2
517
+ },
518
+ "_shadowBlur": 2,
519
+ "_id": ""
520
+ },
521
+ {
522
+ "__type__": "cc.CompPrefabInfo",
523
+ "fileId": "93wi1J399M8rVjSwvZEosi"
524
+ },
525
+ {
526
+ "__type__": "cc.PrefabInfo",
527
+ "root": {
528
+ "__id__": 1
529
+ },
530
+ "asset": {
531
+ "__id__": 0
532
+ },
533
+ "fileId": "4baicImpxNE6jawlFxJRW6",
534
+ "instance": null,
535
+ "targetOverrides": null,
536
+ "nestedPrefabInstanceRoots": null
537
+ },
538
+ {
539
+ "__type__": "cc.UITransform",
540
+ "_name": "",
541
+ "_objFlags": 0,
542
+ "__editorExtras__": {},
543
+ "node": {
544
+ "__id__": 1
545
+ },
546
+ "_enabled": true,
547
+ "__prefab": {
548
+ "__id__": 23
549
+ },
550
+ "_contentSize": {
551
+ "__type__": "cc.Size",
552
+ "width": 1920,
553
+ "height": 1080
554
+ },
555
+ "_anchorPoint": {
556
+ "__type__": "cc.Vec2",
557
+ "x": 0.5,
558
+ "y": 0.5
559
+ },
560
+ "_id": ""
561
+ },
562
+ {
563
+ "__type__": "cc.CompPrefabInfo",
564
+ "fileId": "2dwx2zC6xE157OjcuO+/bQ"
565
+ },
566
+ {
567
+ "__type__": "cc.Sprite",
568
+ "_name": "",
569
+ "_objFlags": 0,
570
+ "__editorExtras__": {},
571
+ "node": {
572
+ "__id__": 1
573
+ },
574
+ "_enabled": true,
575
+ "__prefab": {
576
+ "__id__": 25
577
+ },
578
+ "_customMaterial": null,
579
+ "_srcBlendFactor": 2,
580
+ "_dstBlendFactor": 4,
581
+ "_color": {
582
+ "__type__": "cc.Color",
583
+ "r": 255,
584
+ "g": 255,
585
+ "b": 255,
586
+ "a": 255
587
+ },
588
+ "_spriteFrame": {
589
+ "__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941",
590
+ "__expectedType__": "cc.SpriteFrame"
591
+ },
592
+ "_type": 1,
593
+ "_fillType": 0,
594
+ "_sizeMode": 0,
595
+ "_fillCenter": {
596
+ "__type__": "cc.Vec2",
597
+ "x": 0,
598
+ "y": 0
599
+ },
600
+ "_fillStart": 0,
601
+ "_fillRange": 0,
602
+ "_isTrimmedMode": true,
603
+ "_useGrayscale": false,
604
+ "_atlas": null,
605
+ "_id": ""
606
+ },
607
+ {
608
+ "__type__": "cc.CompPrefabInfo",
609
+ "fileId": "48NjcGSPxDlL4D01N9Z45E"
610
+ },
611
+ {
612
+ "__type__": "5ef022KE5NFq7B2SNxSS5r+",
613
+ "_name": "",
614
+ "_objFlags": 0,
615
+ "__editorExtras__": {},
616
+ "node": {
617
+ "__id__": 1
618
+ },
619
+ "_enabled": true,
620
+ "__prefab": {
621
+ "__id__": 27
622
+ },
623
+ "bar": {
624
+ "__id__": 13
625
+ },
626
+ "label": {
627
+ "__id__": 19
628
+ },
629
+ "_id": ""
630
+ },
631
+ {
632
+ "__type__": "cc.CompPrefabInfo",
633
+ "fileId": "e8u/C4b9xCIJS4OXtXkifT"
634
+ },
635
+ {
636
+ "__type__": "cc.Widget",
637
+ "_name": "",
638
+ "_objFlags": 0,
639
+ "__editorExtras__": {},
640
+ "node": {
641
+ "__id__": 1
642
+ },
643
+ "_enabled": false,
644
+ "__prefab": {
645
+ "__id__": 29
646
+ },
647
+ "_alignFlags": 45,
648
+ "_target": null,
649
+ "_left": 0,
650
+ "_right": 0,
651
+ "_top": 0,
652
+ "_bottom": 0,
653
+ "_horizontalCenter": 0,
654
+ "_verticalCenter": 0,
655
+ "_isAbsLeft": true,
656
+ "_isAbsRight": true,
657
+ "_isAbsTop": true,
658
+ "_isAbsBottom": true,
659
+ "_isAbsHorizontalCenter": true,
660
+ "_isAbsVerticalCenter": true,
661
+ "_originalWidth": 1920,
662
+ "_originalHeight": 1080,
663
+ "_alignMode": 2,
664
+ "_lockFlags": 0,
665
+ "_id": ""
666
+ },
667
+ {
668
+ "__type__": "cc.CompPrefabInfo",
669
+ "fileId": "f9ryjqv1NG/rEtNex/0kGa"
670
+ },
671
+ {
672
+ "__type__": "cc.PrefabInfo",
673
+ "root": {
674
+ "__id__": 1
675
+ },
676
+ "asset": {
677
+ "__id__": 0
678
+ },
679
+ "fileId": "c46/YsCPVOJYA4mWEpNYRx",
680
+ "instance": null,
681
+ "targetOverrides": null
682
+ }
683
+ ]
@@ -0,0 +1,13 @@
1
+ {
2
+ "ver": "1.1.50",
3
+ "importer": "prefab",
4
+ "imported": true,
5
+ "uuid": "97b66d22-5f6c-43be-8728-a6e0568a57be",
6
+ "files": [
7
+ ".json"
8
+ ],
9
+ "subMetas": {},
10
+ "userData": {
11
+ "syncNodeName": "Loading"
12
+ }
13
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "ver": "1.2.0",
3
+ "importer": "directory",
4
+ "imported": true,
5
+ "uuid": "13518c61-92dc-43a5-bda1-fb986776ace1",
6
+ "files": [],
7
+ "subMetas": {},
8
+ "userData": {}
9
+ }
@@ -260,9 +260,14 @@
260
260
  },
261
261
  "_enabled": true,
262
262
  "__prefab": null,
263
+ "homeScene": "main",
264
+ "loadingPrefab": {
265
+ "__uuid__": "97b66d22-5f6c-43be-8728-a6e0568a57be",
266
+ "__expectedType__": "cc.Prefab"
267
+ },
268
+ "loadingMinShowMs": 2000,
263
269
  "enableGm": true,
264
- "_id": "c8U8P4lMhAdLDrejIz+NuJ",
265
- "homeScene": "main"
270
+ "_id": "c8U8P4lMhAdLDrejIz+NuJ"
266
271
  },
267
272
  {
268
273
  "__type__": "cc.UITransform",
@@ -508,4 +513,4 @@
508
513
  "__type__": "cc.PostSettingsInfo",
509
514
  "_toneMappingType": 0
510
515
  }
511
- ]
516
+ ]
@@ -1,6 +1,7 @@
1
- import { _decorator, Component, director, log } from 'cc';
1
+ import { _decorator, Component, director, log, Prefab } from 'cc';
2
2
  import { GameIns } from '@ccgf/framework';
3
3
  import { Gm } from '@ccgf/framework';
4
+ import { LoadingService } from '@ccgf/framework';
4
5
  import { ModuleManager } from '@ccgf/framework';
5
6
  import { SubGame } from '@ccgf/framework';
6
7
  import { DEBUG } from 'cc/env';
@@ -21,6 +22,12 @@ export class AppStart extends Component {
21
22
  @property({ displayName: "主场景" })
22
23
  public homeScene = 'main';
23
24
 
25
+ @property({ type: Prefab, displayName: "加载面板" })
26
+ public loadingPrefab: Prefab | null = null;
27
+
28
+ @property({ displayName: "Loading最短展示(ms)" })
29
+ public loadingMinShowMs = 1000;
30
+
24
31
  @property({ displayName: "是否启用GM" })
25
32
  public enableGm = false;
26
33
 
@@ -31,6 +38,7 @@ export class AppStart extends Component {
31
38
  if (!director.isPersistRootNode(this.node)) director.addPersistRootNode(this.node);
32
39
 
33
40
  GameIns.init(this.node);
41
+ LoadingService.configure({ prefab: this.loadingPrefab, minShowMs: this.loadingMinShowMs });
34
42
 
35
43
  Gm.setEnabled(this.enableGm && DEBUG);
36
44
  }
@@ -43,23 +51,36 @@ export class AppStart extends Component {
43
51
  SubGame.setHomeScene(sceneName);
44
52
  log(`[AppStart] boot -> ${sceneName}`);
45
53
 
46
- await this.loadMainScene(sceneName);
47
- ModuleManager.getInstance().notifySceneEnter('', sceneName);
54
+ await LoadingService.run(async (progress) => {
55
+ await this.loadMainScene(sceneName, progress);
56
+ ModuleManager.getInstance().notifySceneEnter('', sceneName);
57
+ });
48
58
  Gm.open();
49
59
  }
50
60
 
51
- private loadMainScene(sceneName: string): Promise<void> {
61
+ private loadMainScene(
62
+ sceneName: string,
63
+ progress: (value: number, label?: string) => void,
64
+ ): Promise<void> {
52
65
  return new Promise((resolve, reject) => {
53
- let settled = false;
54
- const finish = (err: Error | null): void => {
55
- if (settled) return;
56
- settled = true;
57
- err ? reject(err) : resolve();
58
- };
59
- const ok = director.loadScene(sceneName, (err) => finish(err ?? null));
60
- if (!ok) {
61
- finish(new Error(`[AppStart] loadScene failed:${sceneName}(主包场景不存在?)`));
62
- }
66
+ director.preloadScene(
67
+ sceneName,
68
+ (completed, total) => progress(total > 0 ? completed / total : 0, '加载主场景'),
69
+ (err) => {
70
+ if (err) {
71
+ reject(err);
72
+ return;
73
+ }
74
+ progress(0.95, '进入主场景');
75
+ director.loadScene(sceneName, (loadErr) => {
76
+ if (loadErr) {
77
+ reject(loadErr);
78
+ } else {
79
+ resolve();
80
+ }
81
+ });
82
+ },
83
+ );
63
84
  });
64
85
  }
65
86
 
@@ -0,0 +1,30 @@
1
+ import { _decorator, Component, Label, ProgressBar, tween, UIOpacity } from 'cc';
2
+ import type { ILoadingHandler } from '@ccgf/framework';
3
+
4
+ const { ccclass, property } = _decorator;
5
+
6
+ @ccclass('LoadingPanel')
7
+ export class LoadingPanel extends Component implements ILoadingHandler {
8
+
9
+ @property(ProgressBar)
10
+ public bar: ProgressBar | null = null;
11
+
12
+ @property(Label)
13
+ public label: Label | null = null;
14
+
15
+ public onShow(): void { }
16
+
17
+ public onProgress(progress: number, label?: string): void {
18
+ if (this.bar) this.bar.progress = progress;
19
+ if (this.label && label) this.label.string = label;
20
+ }
21
+
22
+ public async onHide(): Promise<void> {
23
+ const opacity = this.node.getComponent(UIOpacity) ?? this.node.addComponent(UIOpacity);
24
+ await new Promise<void>((resolve) => {
25
+ tween(opacity)
26
+ .to(0.25, { opacity: 0 }, { onComplete: () => resolve() })
27
+ .start();
28
+ });
29
+ }
30
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "ver": "4.0.24",
3
+ "importer": "typescript",
4
+ "imported": true,
5
+ "uuid": "5ef02d8a-1393-45ab-b076-48dc524b9afe",
6
+ "files": [],
7
+ "subMetas": {},
8
+ "userData": {}
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "ver": "1.2.0",
3
+ "importer": "directory",
4
+ "imported": true,
5
+ "uuid": "38c33eb2-a724-447a-bb73-56aa0cee2f0e",
6
+ "files": [],
7
+ "subMetas": {},
8
+ "userData": {}
9
+ }
package/package.json CHANGED
@@ -5,9 +5,9 @@
5
5
  "version": "3.8.8"
6
6
  },
7
7
  "dependencies": {
8
- "@ccgf/framework": "^0.1.12"
8
+ "@ccgf/framework": "^0.1.14"
9
9
  },
10
- "version": "0.2.23",
10
+ "version": "0.2.25",
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },
@@ -21,6 +21,6 @@
21
21
  ]
22
22
  },
23
23
  "devDependencies": {
24
- "ccgf-game-tool": "^1.0.23"
24
+ "ccgf-game-tool": "^1.0.25"
25
25
  }
26
26
  }