@ives_xxz/framework 1.4.7 → 1.4.9
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 +13 -42
- package/Framework.ts +0 -8
- package/animation/FWSkeleton.ts +0 -1
- package/define/FWSystemDefine.ts +7 -0
- package/layer/FWLayer.ts +1 -0
- package/manager/FWAnimationManager.ts +7 -44
- package/manager/FWAssetManager.ts +0 -1
- package/manager/FWLayerManager.ts +522 -300
- package/manager/FWPromiseManager.ts +172 -46
- package/package.json +1 -1
- package/utils/FWQueue.ts +8 -0
package/FW.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ declare namespace FW {
|
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
type PromiseManager = {
|
|
53
|
-
|
|
53
|
+
execute<T = any>(
|
|
54
54
|
executor: (
|
|
55
55
|
resolve: (value: T | PromiseLike<T>) => void,
|
|
56
56
|
reject: (reason?: any) => void,
|
|
@@ -58,6 +58,10 @@ declare namespace FW {
|
|
|
58
58
|
) => void = PromiseExcutor,
|
|
59
59
|
options: PromiseExecuteOptions = {},
|
|
60
60
|
): PromiseProxy<T>;
|
|
61
|
+
all<T = any>(
|
|
62
|
+
promises: FW.PromiseProxy<T>[],
|
|
63
|
+
options: FW.PromiseExecuteOptions = {},
|
|
64
|
+
): FW.PromiseProxy<FW.PromiseResult<T>>;
|
|
61
65
|
};
|
|
62
66
|
|
|
63
67
|
type Registry = {
|
|
@@ -656,6 +660,11 @@ declare namespace FW {
|
|
|
656
660
|
* @param name
|
|
657
661
|
*/
|
|
658
662
|
closeFromLayerName(name: string | string[]);
|
|
663
|
+
/**
|
|
664
|
+
* 移除所有子Layer
|
|
665
|
+
* @param layer
|
|
666
|
+
*/
|
|
667
|
+
removeAllChildren(layer: Layer);
|
|
659
668
|
|
|
660
669
|
getLayerMap(): Map<new () => LayerController, LayerData>;
|
|
661
670
|
};
|
|
@@ -964,6 +973,8 @@ declare namespace FW {
|
|
|
964
973
|
|
|
965
974
|
type Layer = {
|
|
966
975
|
readonly entry: FW.Entry;
|
|
976
|
+
node: cc.Node;
|
|
977
|
+
ctr: LayerController;
|
|
967
978
|
onLoad(): void;
|
|
968
979
|
start(): void;
|
|
969
980
|
onEnable(): void;
|
|
@@ -1215,33 +1226,6 @@ declare namespace FW {
|
|
|
1215
1226
|
* @returns
|
|
1216
1227
|
*/
|
|
1217
1228
|
createSkeleton(skeleton: sp.Skeleton): FW.Skeleton;
|
|
1218
|
-
/**
|
|
1219
|
-
* 获取一个skeleton动画
|
|
1220
|
-
* @param animationName
|
|
1221
|
-
* @returns
|
|
1222
|
-
*/
|
|
1223
|
-
getSkeleton(animationName: string): FW.Skeleton;
|
|
1224
|
-
|
|
1225
|
-
/**
|
|
1226
|
-
* 暂停一个skeleton动画
|
|
1227
|
-
* @param animationName
|
|
1228
|
-
* @returns
|
|
1229
|
-
*/
|
|
1230
|
-
pauseSkeleton(animationName: string): void;
|
|
1231
|
-
|
|
1232
|
-
/**
|
|
1233
|
-
* 恢复一个skeleton动画
|
|
1234
|
-
* @param animationName
|
|
1235
|
-
* @returns
|
|
1236
|
-
*/
|
|
1237
|
-
resumeSkeleton(animationName: string): void;
|
|
1238
|
-
|
|
1239
|
-
/**
|
|
1240
|
-
* 移除一个skeleton动画
|
|
1241
|
-
* @param animationName
|
|
1242
|
-
* @returns
|
|
1243
|
-
*/
|
|
1244
|
-
removeSkeleton(animationName: string): void;
|
|
1245
1229
|
|
|
1246
1230
|
/**
|
|
1247
1231
|
* 暂停所有动画
|
|
@@ -1251,19 +1235,6 @@ declare namespace FW {
|
|
|
1251
1235
|
* 恢复所有动画
|
|
1252
1236
|
* */
|
|
1253
1237
|
resumeAll(): void;
|
|
1254
|
-
/**
|
|
1255
|
-
* 创建动画机
|
|
1256
|
-
* @param animationMachineName
|
|
1257
|
-
* @returns
|
|
1258
|
-
*/
|
|
1259
|
-
createAnimationMachine(animationMachineName: string): void;
|
|
1260
|
-
|
|
1261
|
-
/**
|
|
1262
|
-
* 移除动画机
|
|
1263
|
-
* @param animationMachineName
|
|
1264
|
-
* @returns
|
|
1265
|
-
*/
|
|
1266
|
-
removeAnimationMachine(animationMachineName: string): void;
|
|
1267
1238
|
};
|
|
1268
1239
|
|
|
1269
1240
|
type Tween = {
|
|
@@ -1950,7 +1921,7 @@ declare namespace FW {
|
|
|
1950
1921
|
type Promise = (resolve: (value: any) => void, reject: (reason?: any) => void) => void;
|
|
1951
1922
|
|
|
1952
1923
|
type PromiseResult<T = any> = {
|
|
1953
|
-
success: T[];
|
|
1924
|
+
success: PromiseProxy<T>[];
|
|
1954
1925
|
failed: { id: number; reason: any }[];
|
|
1955
1926
|
cancelled: number[];
|
|
1956
1927
|
};
|
package/Framework.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import { Container, interfaces } from 'inversify';
|
|
3
3
|
import { FWSystemDefine } from './define/FWSystemDefine';
|
|
4
|
-
import FWLog from './log/FWLog';
|
|
5
4
|
|
|
6
5
|
class Framework {
|
|
7
6
|
private container: Container;
|
|
@@ -140,15 +139,12 @@ class Framework {
|
|
|
140
139
|
*/
|
|
141
140
|
register(data: FW.RegisterFramework) {
|
|
142
141
|
const classes = [data.logic, data.data, data.config, data.sender, data.handle];
|
|
143
|
-
FWLog.debug('framework注册->', classes);
|
|
144
142
|
classes.forEach((cls, index) => {
|
|
145
143
|
if (cls && !this.container.isBound(cls)) {
|
|
146
|
-
FWLog.debug('framework容器绑定成功->', cls);
|
|
147
144
|
this.container.bind(cls).toSelf().inSingletonScope();
|
|
148
145
|
this.container.bind(this.getKey(data.bundleName, index)).toService(cls);
|
|
149
146
|
}
|
|
150
147
|
});
|
|
151
|
-
FWLog.debug('framework注册完成->', this.container);
|
|
152
148
|
}
|
|
153
149
|
/**
|
|
154
150
|
* 注销数据
|
|
@@ -157,21 +153,17 @@ class Framework {
|
|
|
157
153
|
*/
|
|
158
154
|
unRegister(data: FW.RegisterFramework) {
|
|
159
155
|
const classes = [data.logic, data.data, data.config, data.sender, data.handle];
|
|
160
|
-
FWLog.debug('framework注销->', classes);
|
|
161
156
|
classes.forEach((cls, index) => {
|
|
162
157
|
const key = this.getKey(data.bundleName, index);
|
|
163
158
|
if (cls && this.container.isBound(cls)) {
|
|
164
159
|
this.container.get(key)['onDestroy']?.();
|
|
165
160
|
this.container.unbind(cls);
|
|
166
|
-
FWLog.debug('framework容器解开绑定->', cls);
|
|
167
161
|
}
|
|
168
162
|
if (this.container.isBound(key)) {
|
|
169
163
|
this.container.get(key)['onDestroy']?.();
|
|
170
164
|
this.container.unbind(this.getKey(data.bundleName, index));
|
|
171
|
-
FWLog.debug('framework容器解开绑定->', this.getKey(data.bundleName, index));
|
|
172
165
|
}
|
|
173
166
|
});
|
|
174
|
-
FWLog.debug('framework注销完成->', this.container);
|
|
175
167
|
}
|
|
176
168
|
|
|
177
169
|
private getKey(bundleName: string, tag: FWSystemDefine.FWBindTag) {
|
package/animation/FWSkeleton.ts
CHANGED
|
@@ -28,7 +28,6 @@ export class FWSkeleton extends FWAnimation implements FW.Skeleton {
|
|
|
28
28
|
return new Promise((resolve) => {
|
|
29
29
|
this.animation.setCompleteListener(() => {
|
|
30
30
|
this.animation.setCompleteListener(null);
|
|
31
|
-
FW.Entry.animationMgr.removeSkeleton(this.animationName);
|
|
32
31
|
args?.cb?.();
|
|
33
32
|
resolve();
|
|
34
33
|
});
|
package/define/FWSystemDefine.ts
CHANGED
package/layer/FWLayer.ts
CHANGED
|
@@ -3,6 +3,7 @@ const { ccclass, property } = cc._decorator;
|
|
|
3
3
|
@ccclass
|
|
4
4
|
export default class FWLayer extends cc.Component implements FW.Layer {
|
|
5
5
|
public readonly entry: FW.Entry = FW.Entry;
|
|
6
|
+
public ctr: FW.LayerController;
|
|
6
7
|
public onLoad(): void {}
|
|
7
8
|
public start(): void {}
|
|
8
9
|
public onEnable(): void {}
|
|
@@ -44,47 +44,6 @@ export default class FWAnimationManager extends FWManager {
|
|
|
44
44
|
return s;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
/**
|
|
48
|
-
* 获取一个skeleton动画
|
|
49
|
-
* @param animationName
|
|
50
|
-
* @returns
|
|
51
|
-
*/
|
|
52
|
-
getSkeleton(animationName: string) {
|
|
53
|
-
if (!this.animationMachineMap.has(FWSystemDefine.FWAnimationMachineType.SKELETON)) return;
|
|
54
|
-
return this.animationMachineMap
|
|
55
|
-
.get(FWSystemDefine.FWAnimationMachineType.SKELETON)
|
|
56
|
-
.getAnimation(animationName) as FWSkeleton;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* 暂停一个skeleton动画
|
|
61
|
-
* @param animationName
|
|
62
|
-
* @returns
|
|
63
|
-
*/
|
|
64
|
-
pauseSkeleton(animationName: string) {
|
|
65
|
-
if (!this.animationMachineMap.has(FWSystemDefine.FWAnimationMachineType.SKELETON)) return;
|
|
66
|
-
this.animationMachineMap.get(animationName).pause();
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* 恢复一个skeleton动画
|
|
71
|
-
* @param animationName
|
|
72
|
-
* @returns
|
|
73
|
-
*/
|
|
74
|
-
resumeSkeleton(animationName: string) {
|
|
75
|
-
if (!this.animationMachineMap.has(FWSystemDefine.FWAnimationMachineType.SKELETON)) return;
|
|
76
|
-
this.animationMachineMap.get(animationName).resume();
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* 移除一个skeleton动画
|
|
80
|
-
* @param animationName
|
|
81
|
-
* @returns
|
|
82
|
-
*/
|
|
83
|
-
removeSkeleton(animationName: string) {
|
|
84
|
-
if (!this.animationMachineMap.has(FWSystemDefine.FWAnimationMachineType.SKELETON)) return;
|
|
85
|
-
this.animationMachineMap.delete(animationName);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
47
|
/**
|
|
89
48
|
* 暂停所有动画
|
|
90
49
|
*/
|
|
@@ -102,7 +61,7 @@ export default class FWAnimationManager extends FWManager {
|
|
|
102
61
|
* @param animationMachineName
|
|
103
62
|
* @returns
|
|
104
63
|
*/
|
|
105
|
-
createAnimationMachine(animationMachineName: string) {
|
|
64
|
+
private createAnimationMachine(animationMachineName: string) {
|
|
106
65
|
if (this.animationMachineMap.has(animationMachineName)) {
|
|
107
66
|
FWLog.warn(`已创建动画机:${animationMachineName},请勿重复注册!`);
|
|
108
67
|
return;
|
|
@@ -117,12 +76,16 @@ export default class FWAnimationManager extends FWManager {
|
|
|
117
76
|
* @param animationMachineName
|
|
118
77
|
* @returns
|
|
119
78
|
*/
|
|
120
|
-
removeAnimationMachine(animationMachineName: string) {
|
|
79
|
+
private removeAnimationMachine(animationMachineName: string) {
|
|
121
80
|
if (!this.animationMachineMap.has(animationMachineName)) {
|
|
122
81
|
return;
|
|
123
82
|
}
|
|
124
83
|
this.animationMachineMap.delete(animationMachineName);
|
|
125
84
|
}
|
|
126
85
|
|
|
127
|
-
onDestroy(): void {
|
|
86
|
+
onDestroy(): void {
|
|
87
|
+
this.animationMachineMap.forEach((v, k) => {
|
|
88
|
+
this.removeAnimationMachine(k);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
128
91
|
}
|
|
@@ -179,7 +179,6 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
|
|
|
179
179
|
FWLog.error(`加载资源失败,请检查参数列表:${assetProperty}!`);
|
|
180
180
|
return undefined;
|
|
181
181
|
}
|
|
182
|
-
|
|
183
182
|
const bundleName = assetProperty.bundle || FW.Entry.bundleName;
|
|
184
183
|
const type = assetProperty.type;
|
|
185
184
|
const path = assetProperty.path;
|