@ives_xxz/framework 2.0.7 → 2.0.8

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.
@@ -421,9 +421,6 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
421
421
  }
422
422
 
423
423
  public onDestroy(): void {
424
- this.assetsMap.forEach((v) => {
425
- this.release(v.assetProperty);
426
- });
427
424
  this.assetsMap.clear();
428
425
  }
429
426
  }
@@ -92,9 +92,6 @@ export class FWBundleManager extends FWManager implements FW.BundleManager {
92
92
  }
93
93
 
94
94
  public onDestroy(): void {
95
- this.bundleMap.forEach((bundle) => {
96
- cc.assetManager.removeBundle(bundle);
97
- });
98
95
  this.bundleMap.clear();
99
96
  }
100
97
  }
@@ -1,7 +1,11 @@
1
- import { FWManager } from './FWManager';
1
+ import { FWManager } from "./FWManager";
2
2
 
3
- export default class FWEngineManager extends FWManager implements FW.EngineManager {
3
+ export default class FWEngineManager
4
+ extends FWManager
5
+ implements FW.EngineManager
6
+ {
4
7
  debug: boolean = false;
8
+ launchScene: string = "";
5
9
 
6
10
  initialize() {
7
11
  this.registerCCCSystemEvent();
@@ -16,26 +20,26 @@ export default class FWEngineManager extends FWManager implements FW.EngineManag
16
20
  FW.Entry.evtMgr.dispatch(FW.EventDefine.SystemEvent.SYSTEM_RESTART);
17
21
  FW.Entry.initialize();
18
22
  FW.Framework.restart();
19
- cc.game.restart();
23
+ FW.Entry.launchScene(this.launchScene);
20
24
  }
21
25
 
22
26
  getMemory() {
23
27
  if (!this.debug) return;
24
- if (window.performance && window.performance['memory']) {
28
+ if (window.performance && window.performance["memory"]) {
25
29
  FW.Log.debug(
26
- '浏览器允许的最大内存:',
27
- this.formatBytes(window.performance['memory'].jsHeapSizeLimit),
30
+ "浏览器允许的最大内存:",
31
+ this.formatBytes(window.performance["memory"].jsHeapSizeLimit)
28
32
  );
29
33
  FW.Log.debug(
30
- '浏览器已分配内存:',
31
- this.formatBytes(window.performance['memory'].totalJSHeapSize),
34
+ "浏览器已分配内存:",
35
+ this.formatBytes(window.performance["memory"].totalJSHeapSize)
32
36
  );
33
37
  FW.Log.debug(
34
- '浏览器已使用内存:',
35
- this.formatBytes(window.performance['memory'].usedJSHeapSize),
38
+ "浏览器已使用内存:",
39
+ this.formatBytes(window.performance["memory"].usedJSHeapSize)
36
40
  );
37
41
  } else {
38
- FW.Log.debug('当前浏览器不支持 performance.memory');
42
+ FW.Log.debug("当前浏览器不支持 performance.memory");
39
43
  }
40
44
  }
41
45
  /**
@@ -47,23 +51,23 @@ export default class FWEngineManager extends FWManager implements FW.EngineManag
47
51
  }
48
52
  /** 应用切换到前台 */
49
53
  private onAppShow() {
50
- FW.Log.debug('game on show!');
54
+ FW.Log.debug("game on show!");
51
55
  FW.Entry.evtMgr?.dispatch(FW.EventDefine.CCEvent.ON_SHOW);
52
56
  }
53
57
 
54
58
  /** 应用切换到后台 */
55
59
  private onAppHide() {
56
- FW.Log.debug('game on hide!');
60
+ FW.Log.debug("game on hide!");
57
61
  FW.Entry.evtMgr?.dispatch(FW.EventDefine.CCEvent.ON_HIDE);
58
62
  }
59
63
 
60
64
  private formatBytes(bytes: number) {
61
65
  if (bytes < 1024 * 1024) {
62
- return (bytes / 1024).toFixed(2) + ' KB';
66
+ return (bytes / 1024).toFixed(2) + " KB";
63
67
  } else if (bytes < 1024 * 1024 * 1024) {
64
- return (bytes / 1024 / 1024).toFixed(2) + ' MB';
68
+ return (bytes / 1024 / 1024).toFixed(2) + " MB";
65
69
  } else {
66
- return (bytes / 1024 / 1024 / 1024).toFixed(2) + ' GB';
70
+ return (bytes / 1024 / 1024 / 1024).toFixed(2) + " GB";
67
71
  }
68
72
  }
69
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ives_xxz/framework",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "cocoscreator 2.x mvc framework",
5
5
  "main": "index.js",
6
6
  "keywords": [
package/scene/FWScene.ts CHANGED
@@ -7,6 +7,10 @@ export abstract class FWScene extends cc.Component {
7
7
  @FWSocketAutoProcessResume()
8
8
  onLoad(): void {
9
9
  this.entry.scene = this;
10
+ if (!this.entry.engineMgr.launchScene) {
11
+ this.entry.engineMgr.launchScene =
12
+ cc.director.getScene()?.name || undefined;
13
+ }
10
14
  }
11
15
 
12
16
  update(dt: number): void {
package/types/FW.d.ts CHANGED
@@ -1019,6 +1019,7 @@ declare namespace FW {
1019
1019
  };
1020
1020
 
1021
1021
  type EngineManager = {
1022
+ launchScene: string;
1022
1023
  debug: boolean;
1023
1024
  getMemory(): void;
1024
1025
  restart(): void;