@ives_xxz/framework 2.0.6 → 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.
- package/manager/FWAssetManager.ts +1 -1
- package/manager/FWEngineManager.ts +20 -16
- package/manager/FWResManager.ts +0 -1
- package/package.json +1 -1
- package/scene/FWScene.ts +4 -0
- package/types/FW.d.ts +1 -0
|
@@ -381,8 +381,8 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
|
|
|
381
381
|
assetData.refCount--;
|
|
382
382
|
|
|
383
383
|
if (assetData.refCount <= 0) {
|
|
384
|
+
this.resMgr.getBundle(bundleName)?.release(path);
|
|
384
385
|
this.assetsMap.delete(key);
|
|
385
|
-
autoRelease && this.resMgr.getBundle(bundleName)?.release(path);
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { FWManager } from
|
|
1
|
+
import { FWManager } from "./FWManager";
|
|
2
2
|
|
|
3
|
-
export default class FWEngineManager
|
|
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
|
-
|
|
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[
|
|
28
|
+
if (window.performance && window.performance["memory"]) {
|
|
25
29
|
FW.Log.debug(
|
|
26
|
-
|
|
27
|
-
this.formatBytes(window.performance[
|
|
30
|
+
"浏览器允许的最大内存:",
|
|
31
|
+
this.formatBytes(window.performance["memory"].jsHeapSizeLimit)
|
|
28
32
|
);
|
|
29
33
|
FW.Log.debug(
|
|
30
|
-
|
|
31
|
-
this.formatBytes(window.performance[
|
|
34
|
+
"浏览器已分配内存:",
|
|
35
|
+
this.formatBytes(window.performance["memory"].totalJSHeapSize)
|
|
32
36
|
);
|
|
33
37
|
FW.Log.debug(
|
|
34
|
-
|
|
35
|
-
this.formatBytes(window.performance[
|
|
38
|
+
"浏览器已使用内存:",
|
|
39
|
+
this.formatBytes(window.performance["memory"].usedJSHeapSize)
|
|
36
40
|
);
|
|
37
41
|
} else {
|
|
38
|
-
FW.Log.debug(
|
|
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(
|
|
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(
|
|
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) +
|
|
66
|
+
return (bytes / 1024).toFixed(2) + " KB";
|
|
63
67
|
} else if (bytes < 1024 * 1024 * 1024) {
|
|
64
|
-
return (bytes / 1024 / 1024).toFixed(2) +
|
|
68
|
+
return (bytes / 1024 / 1024).toFixed(2) + " MB";
|
|
65
69
|
} else {
|
|
66
|
-
return (bytes / 1024 / 1024 / 1024).toFixed(2) +
|
|
70
|
+
return (bytes / 1024 / 1024 / 1024).toFixed(2) + " GB";
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
}
|
package/manager/FWResManager.ts
CHANGED
package/package.json
CHANGED
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 {
|