@ives_xxz/framework 1.4.9 → 1.4.11
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/FW.d.ts +1 -1
- package/controller/FWLayerController.ts +2 -4
- package/manager/FWLayerManager.ts +17 -10
- package/package.json +1 -1
package/FW.d.ts
CHANGED
|
@@ -33,18 +33,16 @@ export abstract class FWLayerController implements FW.LayerController {
|
|
|
33
33
|
onEnable?();
|
|
34
34
|
onDisable?();
|
|
35
35
|
onDestroy?();
|
|
36
|
-
onClose?();
|
|
36
|
+
async onClose?();
|
|
37
37
|
initialize() {}
|
|
38
38
|
|
|
39
|
-
destroy() {
|
|
39
|
+
async destroy() {
|
|
40
40
|
FW.Entry.timeMgr?.unSchedule(this);
|
|
41
41
|
FW.Entry.evtMgr?.targetOff(this);
|
|
42
42
|
cc.Tween.stopAllByTarget(this.layer?.node);
|
|
43
43
|
this.layer?.node?.stopAllActions();
|
|
44
44
|
this.layer?.unscheduleAllCallbacks();
|
|
45
45
|
this.layer?.node?.destroy();
|
|
46
|
-
this.onClose?.();
|
|
47
|
-
this.onDestroy?.();
|
|
48
46
|
}
|
|
49
47
|
|
|
50
48
|
/**
|
|
@@ -47,9 +47,9 @@ class FWLayerDataManager {
|
|
|
47
47
|
/**
|
|
48
48
|
* 从类型创建Layer数据
|
|
49
49
|
*/
|
|
50
|
-
|
|
50
|
+
createLayerData<Ctr extends FW.LayerController = FW.LayerController>(
|
|
51
51
|
type: new () => Ctr,
|
|
52
|
-
):
|
|
52
|
+
): FW.LayerData {
|
|
53
53
|
const ctr = new type();
|
|
54
54
|
const ctrName = cc.js.getClassName(ctr);
|
|
55
55
|
const layerData = this.createBaseLayerData(ctr);
|
|
@@ -58,10 +58,15 @@ class FWLayerDataManager {
|
|
|
58
58
|
layerData.controller = ctr;
|
|
59
59
|
layerData.controllerName = ctrName;
|
|
60
60
|
|
|
61
|
-
this.layerMap.set(type, layerData);
|
|
62
61
|
return layerData;
|
|
63
62
|
}
|
|
64
63
|
|
|
64
|
+
addLayerData(ctr: new () => FW.LayerController, layerData: FW.LayerData) {
|
|
65
|
+
if (!this.layerMap.has(ctr)) {
|
|
66
|
+
this.layerMap.set(ctr, layerData);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
65
70
|
/**
|
|
66
71
|
* 创建基础Layer数据
|
|
67
72
|
*/
|
|
@@ -248,7 +253,8 @@ class FWLayerOpenManager {
|
|
|
248
253
|
return this.wrapResult(existingLayer, isAsync) as Ctr;
|
|
249
254
|
}
|
|
250
255
|
|
|
251
|
-
const layerData = this.dataManager.
|
|
256
|
+
const layerData = this.dataManager.createLayerData(data.type);
|
|
257
|
+
|
|
252
258
|
if (!layerData) {
|
|
253
259
|
return this.getUndefinedResult(isAsync);
|
|
254
260
|
}
|
|
@@ -262,6 +268,8 @@ class FWLayerOpenManager {
|
|
|
262
268
|
return this.getUndefinedResult(isAsync);
|
|
263
269
|
}
|
|
264
270
|
|
|
271
|
+
this.dataManager.addLayerData(data.type, layerData);
|
|
272
|
+
|
|
265
273
|
if (isAsync) {
|
|
266
274
|
return this.loadAndCreateLayerAsync(layerData, data);
|
|
267
275
|
} else {
|
|
@@ -459,7 +467,7 @@ class FWLayerQueueManager {
|
|
|
459
467
|
): boolean {
|
|
460
468
|
if (layerData.controller.layerType === FWSystemDefine.FWLayerType.POPUP_QUEUE) {
|
|
461
469
|
const hasNonPermanentLayers = Array.from(layerMap.values()).some(
|
|
462
|
-
(value) => value.layerType
|
|
470
|
+
(value) => value.layerType === FWSystemDefine.FWLayerType.POPUP_QUEUE,
|
|
463
471
|
);
|
|
464
472
|
|
|
465
473
|
if (hasNonPermanentLayers) {
|
|
@@ -673,9 +681,9 @@ export class FWLayerManager extends FWManager implements FW.LayerManager {
|
|
|
673
681
|
* @param layer
|
|
674
682
|
* @returns
|
|
675
683
|
*/
|
|
676
|
-
async removeAllChildren(
|
|
677
|
-
if (cc.isValid(
|
|
678
|
-
const layers =
|
|
684
|
+
async removeAllChildren(node: cc.Node) {
|
|
685
|
+
if (!cc.isValid(node)) return;
|
|
686
|
+
const layers = node.getComponentsInChildren(FWLayer);
|
|
679
687
|
layers.forEach((v) => {
|
|
680
688
|
if (cc.isValid(v?.node)) {
|
|
681
689
|
v?.ctr?.close();
|
|
@@ -694,9 +702,8 @@ export class FWLayerManager extends FWManager implements FW.LayerManager {
|
|
|
694
702
|
let layerData = ctr.layerData;
|
|
695
703
|
|
|
696
704
|
if (cc.isValid(ctr.layer?.node)) {
|
|
697
|
-
ctr.
|
|
705
|
+
await ctr.onClose?.();
|
|
698
706
|
ctr.destroy?.();
|
|
699
|
-
ctr.onClose?.();
|
|
700
707
|
if (ctr.autoRelease) {
|
|
701
708
|
FW.Entry.resMgr.releaseAsset(ctr.layerData.layerAssetProperty);
|
|
702
709
|
}
|