@ives_xxz/framework 2.1.5 → 2.1.7
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 +69 -53
- package/manager/FWResManager.ts +0 -1
- package/package.json +1 -1
- package/types/FW.d.ts +98 -94
- package/types/Global.d.ts +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FWSystemConfig } from
|
|
2
|
-
import { FWManager } from
|
|
1
|
+
import { FWSystemConfig } from "../config/FWSystemConfig";
|
|
2
|
+
import { FWManager } from "./FWManager";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 资源数据
|
|
@@ -14,7 +14,6 @@ class FWAssetData implements FW.AssetData {
|
|
|
14
14
|
dependentBundle: string;
|
|
15
15
|
loaded: boolean;
|
|
16
16
|
autoRelease: boolean;
|
|
17
|
-
refCount: number;
|
|
18
17
|
assetProperty: FW.AssetProperty;
|
|
19
18
|
}
|
|
20
19
|
|
|
@@ -47,7 +46,7 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
|
|
|
47
46
|
const img = data.img;
|
|
48
47
|
const ske = data.ske;
|
|
49
48
|
const atlas = data.atlas;
|
|
50
|
-
const type = bin ?
|
|
49
|
+
const type = bin ? ".bin" : ".txt";
|
|
51
50
|
cc.assetManager.loadAny(
|
|
52
51
|
[
|
|
53
52
|
{ url: atlas, ext: type },
|
|
@@ -59,34 +58,38 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
|
|
|
59
58
|
asset.skeletonJson = assets[1];
|
|
60
59
|
asset.atlasText = assets[0];
|
|
61
60
|
asset.textures.push(texture);
|
|
62
|
-
asset[
|
|
63
|
-
asset[
|
|
61
|
+
asset["textureNames"] = [`${img}.png`];
|
|
62
|
+
asset["_uuid"] = ske;
|
|
64
63
|
resolve(asset);
|
|
65
|
-
}
|
|
64
|
+
}
|
|
66
65
|
);
|
|
67
|
-
}, FWSystemConfig.PromiseConfig.loadAsset).promise
|
|
66
|
+
}, FWSystemConfig.PromiseConfig.loadAsset).promise
|
|
68
67
|
);
|
|
69
68
|
} catch (e) {
|
|
70
|
-
FW.Log.error(
|
|
69
|
+
FW.Log.error("从远程加载spine动画资源失败!");
|
|
71
70
|
}
|
|
72
71
|
}
|
|
73
72
|
|
|
74
73
|
/** 加载远程资源 */
|
|
75
74
|
async loadRemote<T extends cc.Asset = cc.Asset>(
|
|
76
75
|
url?: string,
|
|
77
|
-
cb?: (asset: cc.Asset) => void
|
|
76
|
+
cb?: (asset: cc.Asset) => void
|
|
78
77
|
): Promise<T> {
|
|
79
78
|
return await this.invoke(
|
|
80
79
|
FW.Entry.promiseMgr.execute((resolve, reject, signal) => {
|
|
81
|
-
cc.assetManager.loadRemote(
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
cc.assetManager.loadRemote(
|
|
81
|
+
url,
|
|
82
|
+
{ cacheEnabled: true, maxRetryCount: 3 },
|
|
83
|
+
(err, asset) => {
|
|
84
|
+
if (err || !asset) {
|
|
85
|
+
reject(err);
|
|
86
|
+
}
|
|
87
|
+
cb?.(asset as T);
|
|
88
|
+
resolve(asset as T);
|
|
84
89
|
}
|
|
85
|
-
|
|
86
|
-
resolve(asset as T);
|
|
87
|
-
});
|
|
90
|
+
);
|
|
88
91
|
}, FWSystemConfig.PromiseConfig.loadAsset).promise,
|
|
89
|
-
`loadAssets -> ${url}
|
|
92
|
+
`loadAssets -> ${url}`
|
|
90
93
|
);
|
|
91
94
|
}
|
|
92
95
|
|
|
@@ -96,7 +99,9 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
|
|
|
96
99
|
return undefined;
|
|
97
100
|
}
|
|
98
101
|
|
|
99
|
-
const propertys = Array.isArray(assetProperty)
|
|
102
|
+
const propertys = Array.isArray(assetProperty)
|
|
103
|
+
? assetProperty
|
|
104
|
+
: [assetProperty];
|
|
100
105
|
|
|
101
106
|
await Promise.all(
|
|
102
107
|
propertys.map(async (property) => {
|
|
@@ -105,17 +110,19 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
|
|
|
105
110
|
const path = property.path;
|
|
106
111
|
const progress = property.progress;
|
|
107
112
|
|
|
108
|
-
if (!bundleName || bundleName ===
|
|
113
|
+
if (!bundleName || bundleName === "") {
|
|
109
114
|
FW.Log.error(`找不到bundle${bundleName},或者bundle未加载!`);
|
|
110
115
|
return undefined;
|
|
111
116
|
}
|
|
112
117
|
|
|
113
|
-
if (!path || path ===
|
|
118
|
+
if (!path || path === "") {
|
|
114
119
|
FW.Log.error(`找不到资源路径${path},请检查!`);
|
|
115
120
|
return undefined;
|
|
116
121
|
}
|
|
117
122
|
|
|
118
|
-
let bundle: cc.AssetManager.Bundle = await this.resMgr.loadBundle(
|
|
123
|
+
let bundle: cc.AssetManager.Bundle = await this.resMgr.loadBundle(
|
|
124
|
+
bundleName
|
|
125
|
+
);
|
|
119
126
|
|
|
120
127
|
if (!bundle) {
|
|
121
128
|
FW.Log.error(`加载bundle失败,请检查!`);
|
|
@@ -127,20 +134,24 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
|
|
|
127
134
|
bundle.preload(
|
|
128
135
|
path,
|
|
129
136
|
type,
|
|
130
|
-
(
|
|
137
|
+
(
|
|
138
|
+
finish: number,
|
|
139
|
+
total: number,
|
|
140
|
+
item: cc.AssetManager.RequestItem
|
|
141
|
+
) => {
|
|
131
142
|
progress?.(finish, total, item);
|
|
132
143
|
},
|
|
133
144
|
(err: Error, item: cc.AssetManager.RequestItem[]) => {
|
|
134
145
|
if (err || !item || item?.length == 0) {
|
|
135
|
-
reject(err ||
|
|
146
|
+
reject(err || "preload failed!");
|
|
136
147
|
}
|
|
137
148
|
resolve(item);
|
|
138
|
-
}
|
|
149
|
+
}
|
|
139
150
|
);
|
|
140
151
|
}, FWSystemConfig.PromiseConfig.loadAsset).promise,
|
|
141
|
-
`preLoadAssets -> ${property.path}
|
|
152
|
+
`preLoadAssets -> ${property.path}`
|
|
142
153
|
);
|
|
143
|
-
})
|
|
154
|
+
})
|
|
144
155
|
);
|
|
145
156
|
}
|
|
146
157
|
|
|
@@ -161,17 +172,19 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
|
|
|
161
172
|
const progress = assetProperty.progress;
|
|
162
173
|
const autoRelease = assetProperty.autoRelease;
|
|
163
174
|
|
|
164
|
-
if (!bundleName || bundleName ===
|
|
175
|
+
if (!bundleName || bundleName === "") {
|
|
165
176
|
FW.Log.error(`找不到bundle${bundleName},或者bundle未加载!`);
|
|
166
177
|
return undefined;
|
|
167
178
|
}
|
|
168
179
|
|
|
169
|
-
if (!path || path ===
|
|
180
|
+
if (!path || path === "") {
|
|
170
181
|
FW.Log.error(`找不到资源路径${path},请检查!`);
|
|
171
182
|
return undefined;
|
|
172
183
|
}
|
|
173
184
|
|
|
174
|
-
let bundle: cc.AssetManager.Bundle = await this.resMgr.loadBundle(
|
|
185
|
+
let bundle: cc.AssetManager.Bundle = await this.resMgr.loadBundle(
|
|
186
|
+
bundleName
|
|
187
|
+
);
|
|
175
188
|
|
|
176
189
|
if (!bundle) {
|
|
177
190
|
FW.Log.error(`加载bundle失败,请检查!`);
|
|
@@ -181,10 +194,9 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
|
|
|
181
194
|
|
|
182
195
|
if (this.assetsMap.has(key)) {
|
|
183
196
|
const assetData = this.assetsMap.get(key);
|
|
184
|
-
if
|
|
197
|
+
if(!assetData.asset.loaded){
|
|
185
198
|
this.assetsMap.delete(key);
|
|
186
|
-
}
|
|
187
|
-
assetData.refCount++;
|
|
199
|
+
}else{
|
|
188
200
|
return assetData;
|
|
189
201
|
}
|
|
190
202
|
}
|
|
@@ -199,7 +211,11 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
|
|
|
199
211
|
bundle.load(
|
|
200
212
|
path,
|
|
201
213
|
type,
|
|
202
|
-
(
|
|
214
|
+
(
|
|
215
|
+
finish: number,
|
|
216
|
+
total: number,
|
|
217
|
+
item: cc.AssetManager.RequestItem
|
|
218
|
+
) => {
|
|
203
219
|
progress?.(finish, total, item);
|
|
204
220
|
},
|
|
205
221
|
(err: Error, asset: cc.Asset) => {
|
|
@@ -209,21 +225,20 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
|
|
|
209
225
|
}
|
|
210
226
|
assetData.loaded = true;
|
|
211
227
|
assetData.dependentBundle = bundleName;
|
|
212
|
-
assetData.uuid = asset[
|
|
228
|
+
assetData.uuid = asset["_uuid"];
|
|
213
229
|
assetData.autoRelease = autoRelease;
|
|
214
230
|
assetData.asset = asset;
|
|
215
231
|
assetData.user = assetProperty.user;
|
|
216
|
-
assetData.refCount = 1;
|
|
217
232
|
assetData.assetProperty = assetProperty;
|
|
218
233
|
|
|
219
234
|
self.assetsMap.set(key, assetData);
|
|
220
235
|
|
|
221
236
|
cb?.(assetData);
|
|
222
237
|
resolve(assetData);
|
|
223
|
-
}
|
|
238
|
+
}
|
|
224
239
|
);
|
|
225
240
|
}, FWSystemConfig.PromiseConfig.loadAsset).promise,
|
|
226
|
-
`loadAssets -> ${assetProperty.path}
|
|
241
|
+
`loadAssets -> ${assetProperty.path}`
|
|
227
242
|
);
|
|
228
243
|
}
|
|
229
244
|
/**
|
|
@@ -242,17 +257,19 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
|
|
|
242
257
|
const cb = assetProperty.cb;
|
|
243
258
|
const autoRelease = assetProperty.autoRelease;
|
|
244
259
|
|
|
245
|
-
if (!bundleName || bundleName ===
|
|
260
|
+
if (!bundleName || bundleName === "") {
|
|
246
261
|
FW.Log.error(`找不到bundle${bundleName},或者bundle未加载!`);
|
|
247
262
|
return undefined;
|
|
248
263
|
}
|
|
249
264
|
|
|
250
|
-
if (!path || path ===
|
|
265
|
+
if (!path || path === "") {
|
|
251
266
|
FW.Log.error(`找不到资源路径${path},请检查!`);
|
|
252
267
|
return undefined;
|
|
253
268
|
}
|
|
254
269
|
|
|
255
|
-
const bundle: cc.AssetManager.Bundle = await this.resMgr.loadBundle(
|
|
270
|
+
const bundle: cc.AssetManager.Bundle = await this.resMgr.loadBundle(
|
|
271
|
+
bundleName
|
|
272
|
+
);
|
|
256
273
|
|
|
257
274
|
if (!bundle) {
|
|
258
275
|
FW.Log.error(`加载bundle失败,请检查!`);
|
|
@@ -262,7 +279,7 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
|
|
|
262
279
|
return new Promise(
|
|
263
280
|
(
|
|
264
281
|
resolve: (value: FW.AssetData[] | PromiseLike<FW.AssetData[]>) => void,
|
|
265
|
-
reject: (reason?: any) => void
|
|
282
|
+
reject: (reason?: any) => void
|
|
266
283
|
) => {
|
|
267
284
|
bundle.loadDir(path, type, (err: Error, assets: cc.Asset[]) => {
|
|
268
285
|
if (err || assets.length === 0) {
|
|
@@ -276,7 +293,7 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
|
|
|
276
293
|
const assetData = new FWAssetData();
|
|
277
294
|
assetData.loaded = true;
|
|
278
295
|
assetData.dependentBundle = bundleName;
|
|
279
|
-
assetData.uuid = asset[
|
|
296
|
+
assetData.uuid = asset["_uuid"];
|
|
280
297
|
assetData.autoRelease = autoRelease;
|
|
281
298
|
assetData.asset = asset;
|
|
282
299
|
assetData.type = type;
|
|
@@ -285,7 +302,7 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
|
|
|
285
302
|
const key = `${this.createAssetMapKey({
|
|
286
303
|
bundle: bundleName,
|
|
287
304
|
path: path,
|
|
288
|
-
})}/${asset.name}${type ? `_${type?.name}` :
|
|
305
|
+
})}/${asset.name}${type ? `_${type?.name}` : ""}`;
|
|
289
306
|
|
|
290
307
|
this.assetsMap.set(key, assetData);
|
|
291
308
|
|
|
@@ -295,7 +312,7 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
|
|
|
295
312
|
cb?.(assetDataList);
|
|
296
313
|
resolve(assetDataList);
|
|
297
314
|
});
|
|
298
|
-
}
|
|
315
|
+
}
|
|
299
316
|
);
|
|
300
317
|
}
|
|
301
318
|
|
|
@@ -312,24 +329,23 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
|
|
|
312
329
|
const bundleName = assetProperty.bundle || FW.Entry.bundleName;
|
|
313
330
|
const path = assetProperty.path;
|
|
314
331
|
|
|
315
|
-
if (!bundleName || bundleName ===
|
|
332
|
+
if (!bundleName || bundleName === "") {
|
|
316
333
|
FW.Log.error(`找不到bundle${bundleName},或者bundle未加载!`);
|
|
317
334
|
return undefined;
|
|
318
335
|
}
|
|
319
336
|
|
|
320
|
-
if (!path || path ===
|
|
337
|
+
if (!path || path === "") {
|
|
321
338
|
FW.Log.error(`找不到资源路径${path},请检查!`);
|
|
322
339
|
return undefined;
|
|
323
340
|
}
|
|
324
341
|
|
|
325
342
|
if (!this.has(assetProperty)) {
|
|
326
|
-
FW.Log.error(
|
|
343
|
+
FW.Log.error("获取资源失败,请先加载!");
|
|
327
344
|
return undefined;
|
|
328
345
|
}
|
|
329
346
|
|
|
330
347
|
const key = this.createAssetMapKey(assetProperty);
|
|
331
348
|
const assetsData = this.assetsMap.get(key);
|
|
332
|
-
assetsData.refCount++;
|
|
333
349
|
return assetsData;
|
|
334
350
|
}
|
|
335
351
|
|
|
@@ -347,12 +363,12 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
|
|
|
347
363
|
const path = assetProperty.path;
|
|
348
364
|
const autoRelease = assetProperty.autoRelease;
|
|
349
365
|
|
|
350
|
-
if (!bundleName || bundleName ===
|
|
366
|
+
if (!bundleName || bundleName === "") {
|
|
351
367
|
FW.Log.error(`找不到bundle${bundleName},或者bundle未加载!`);
|
|
352
368
|
return undefined;
|
|
353
369
|
}
|
|
354
370
|
|
|
355
|
-
if (!path || path ===
|
|
371
|
+
if (!path || path === "") {
|
|
356
372
|
FW.Log.error(`找不到资源路径${path},请检查!`);
|
|
357
373
|
return undefined;
|
|
358
374
|
}
|
|
@@ -360,11 +376,11 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
|
|
|
360
376
|
if (!this.has(assetProperty)) {
|
|
361
377
|
return undefined;
|
|
362
378
|
}
|
|
379
|
+
|
|
363
380
|
const key = this.createAssetMapKey(assetProperty);
|
|
364
381
|
const assetData = this.assetsMap.get(key);
|
|
365
|
-
assetData.refCount--;
|
|
366
382
|
|
|
367
|
-
if (assetData.refCount <= 0) {
|
|
383
|
+
if (assetData.asset?.refCount <= 0 && autoRelease) {
|
|
368
384
|
this.resMgr.getBundle(bundleName)?.release(path);
|
|
369
385
|
this.assetsMap.delete(key);
|
|
370
386
|
}
|
|
@@ -377,7 +393,7 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
|
|
|
377
393
|
*/
|
|
378
394
|
public getReferenceCount(assetProperty: FW.AssetProperty): number {
|
|
379
395
|
const key = this.createAssetMapKey(assetProperty);
|
|
380
|
-
return this.assetsMap.get(key)?.refCount || 0;
|
|
396
|
+
return this.assetsMap.get(key)?.asset?.refCount || 0;
|
|
381
397
|
}
|
|
382
398
|
|
|
383
399
|
/**
|
package/manager/FWResManager.ts
CHANGED
package/package.json
CHANGED
package/types/FW.d.ts
CHANGED
|
@@ -467,24 +467,24 @@ declare namespace FW {
|
|
|
467
467
|
/**
|
|
468
468
|
* Socket配置
|
|
469
469
|
*/
|
|
470
|
-
type SocketConfig = {
|
|
470
|
+
type SocketConfig = Partial<{
|
|
471
471
|
/** 心跳间隔 */
|
|
472
|
-
heartInternal
|
|
472
|
+
heartInternal: number;
|
|
473
473
|
/** 心跳超时时间 */
|
|
474
|
-
heartTimeout
|
|
474
|
+
heartTimeout: number;
|
|
475
475
|
/** 心跳弱网时间 */
|
|
476
|
-
heartWeakTime
|
|
476
|
+
heartWeakTime: number;
|
|
477
477
|
/** 最大重连次数 */
|
|
478
|
-
maxReconnectTimes
|
|
478
|
+
maxReconnectTimes: number;
|
|
479
479
|
/** 重连间隔 */
|
|
480
|
-
reconnectInternal
|
|
480
|
+
reconnectInternal: number;
|
|
481
481
|
/** 协议符号 */
|
|
482
|
-
protocolSymbol
|
|
482
|
+
protocolSymbol: Symbol;
|
|
483
483
|
/** 协议轮询时间 */
|
|
484
|
-
protocolPollingTime
|
|
484
|
+
protocolPollingTime: number;
|
|
485
485
|
/** 证书(可选) */
|
|
486
|
-
certificate
|
|
487
|
-
}
|
|
486
|
+
certificate: cc.Asset;
|
|
487
|
+
}>;
|
|
488
488
|
|
|
489
489
|
/**
|
|
490
490
|
* 观察者
|
|
@@ -1001,10 +1001,6 @@ declare namespace FW {
|
|
|
1001
1001
|
* 释放时是否从bundle内释放
|
|
1002
1002
|
*/
|
|
1003
1003
|
autoRelease: boolean;
|
|
1004
|
-
/**
|
|
1005
|
-
* 资源引用计数
|
|
1006
|
-
*/
|
|
1007
|
-
refCount: number;
|
|
1008
1004
|
/**
|
|
1009
1005
|
* 资源属性
|
|
1010
1006
|
*/
|
|
@@ -1233,15 +1229,15 @@ declare namespace FW {
|
|
|
1233
1229
|
retryHandle: () => void;
|
|
1234
1230
|
};
|
|
1235
1231
|
|
|
1236
|
-
type HotUpdatingParam = {
|
|
1237
|
-
downloadedFiles
|
|
1238
|
-
totalFiles
|
|
1239
|
-
downloadedBytes
|
|
1240
|
-
totalBytes
|
|
1241
|
-
percent
|
|
1242
|
-
convertDownloadedBytes
|
|
1243
|
-
convertTotalBytes
|
|
1244
|
-
}
|
|
1232
|
+
type HotUpdatingParam = Partial<{
|
|
1233
|
+
downloadedFiles: number;
|
|
1234
|
+
totalFiles: number;
|
|
1235
|
+
downloadedBytes: number;
|
|
1236
|
+
totalBytes: number;
|
|
1237
|
+
percent: number;
|
|
1238
|
+
convertDownloadedBytes: string;
|
|
1239
|
+
convertTotalBytes: string;
|
|
1240
|
+
}>;
|
|
1245
1241
|
|
|
1246
1242
|
type AssetManager = {
|
|
1247
1243
|
initialize();
|
|
@@ -1302,30 +1298,32 @@ declare namespace FW {
|
|
|
1302
1298
|
};
|
|
1303
1299
|
|
|
1304
1300
|
type CCEvent = {
|
|
1305
|
-
eventName?: string;
|
|
1306
1301
|
cb: (...args: any) => void;
|
|
1307
1302
|
target: TargetType;
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1303
|
+
} & Partial<{
|
|
1304
|
+
eventName: string;
|
|
1305
|
+
responseInterval: number;
|
|
1306
|
+
pause: boolean;
|
|
1307
|
+
enable: boolean;
|
|
1308
|
+
responseTime: number;
|
|
1309
|
+
lastResponseTimestamp: number;
|
|
1310
|
+
data: any;
|
|
1311
|
+
}>;
|
|
1315
1312
|
|
|
1316
1313
|
type FWEvent = {
|
|
1317
|
-
eventName?: string;
|
|
1318
1314
|
cb: (...args: any) => void;
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1315
|
+
} & Partial<{
|
|
1316
|
+
eventName: string;
|
|
1317
|
+
responseTime: number;
|
|
1318
|
+
responseInterval: number;
|
|
1319
|
+
lastResponseTimestamp: number;
|
|
1320
|
+
options: {
|
|
1323
1321
|
priority?: number;
|
|
1324
1322
|
intercept?: boolean;
|
|
1325
1323
|
pause?: boolean;
|
|
1326
1324
|
enable?: boolean;
|
|
1327
1325
|
};
|
|
1328
|
-
}
|
|
1326
|
+
}>;
|
|
1329
1327
|
|
|
1330
1328
|
type RegisterArgs = {
|
|
1331
1329
|
target?: any;
|
|
@@ -1333,7 +1331,7 @@ declare namespace FW {
|
|
|
1333
1331
|
FWEvent?: FWEvent[];
|
|
1334
1332
|
};
|
|
1335
1333
|
|
|
1336
|
-
type RegisterEventArgs = {
|
|
1334
|
+
type RegisterEventArgs = Partial<{
|
|
1337
1335
|
/** 事件名字 */
|
|
1338
1336
|
eventName?: string;
|
|
1339
1337
|
/**
|
|
@@ -1364,7 +1362,7 @@ declare namespace FW {
|
|
|
1364
1362
|
* 是否启用
|
|
1365
1363
|
*/
|
|
1366
1364
|
enable?: boolean;
|
|
1367
|
-
}
|
|
1365
|
+
}>;
|
|
1368
1366
|
|
|
1369
1367
|
/**
|
|
1370
1368
|
* 时间调度器
|
|
@@ -1683,21 +1681,21 @@ declare namespace FW {
|
|
|
1683
1681
|
/**
|
|
1684
1682
|
* spine动画参数
|
|
1685
1683
|
*/
|
|
1686
|
-
type SkeletonArgs = {
|
|
1687
|
-
loop
|
|
1688
|
-
timeScale
|
|
1689
|
-
progress
|
|
1690
|
-
cb
|
|
1691
|
-
}
|
|
1684
|
+
type SkeletonArgs = Partial<{
|
|
1685
|
+
loop: boolean;
|
|
1686
|
+
timeScale: number;
|
|
1687
|
+
progress: number;
|
|
1688
|
+
cb: () => void;
|
|
1689
|
+
}>;
|
|
1692
1690
|
/**
|
|
1693
1691
|
* tween动画参数
|
|
1694
1692
|
*/
|
|
1695
|
-
type TweenArgs = {
|
|
1696
|
-
id
|
|
1697
|
-
tag
|
|
1698
|
-
target
|
|
1699
|
-
timeScale
|
|
1700
|
-
}
|
|
1693
|
+
type TweenArgs = Partial<{
|
|
1694
|
+
id: number;
|
|
1695
|
+
tag: string;
|
|
1696
|
+
target: Component | Node;
|
|
1697
|
+
timeScale: number;
|
|
1698
|
+
}>;
|
|
1701
1699
|
|
|
1702
1700
|
/**
|
|
1703
1701
|
* 时间对象
|
|
@@ -1724,25 +1722,26 @@ declare namespace FW {
|
|
|
1724
1722
|
* 目标对象
|
|
1725
1723
|
*/
|
|
1726
1724
|
target: TargetType;
|
|
1725
|
+
|
|
1727
1726
|
/**
|
|
1728
|
-
*
|
|
1727
|
+
* 执行时间
|
|
1729
1728
|
*/
|
|
1730
|
-
|
|
1729
|
+
executeTime: number;
|
|
1730
|
+
} & Partial<{
|
|
1731
1731
|
/**
|
|
1732
|
-
*
|
|
1732
|
+
* 执行间隔
|
|
1733
1733
|
*/
|
|
1734
|
-
|
|
1735
|
-
|
|
1734
|
+
internal: number;
|
|
1736
1735
|
/**
|
|
1737
|
-
*
|
|
1736
|
+
* 标签
|
|
1738
1737
|
*/
|
|
1739
|
-
|
|
1738
|
+
tag: string;
|
|
1740
1739
|
/**
|
|
1741
1740
|
* 回调函数
|
|
1742
1741
|
* @returns
|
|
1743
1742
|
*/
|
|
1744
|
-
cb
|
|
1745
|
-
}
|
|
1743
|
+
cb: () => void;
|
|
1744
|
+
}>;
|
|
1746
1745
|
|
|
1747
1746
|
type RegisterInitialize = {
|
|
1748
1747
|
initialize();
|
|
@@ -1756,11 +1755,14 @@ declare namespace FW {
|
|
|
1756
1755
|
autoRelease?: boolean;
|
|
1757
1756
|
};
|
|
1758
1757
|
|
|
1759
|
-
type
|
|
1758
|
+
type RegisterFrameworkBundle = {
|
|
1760
1759
|
/**
|
|
1761
1760
|
* bundle名字
|
|
1762
1761
|
*/
|
|
1763
1762
|
bundleName: string;
|
|
1763
|
+
};
|
|
1764
|
+
|
|
1765
|
+
type RegisterFrameworkComponent = {
|
|
1764
1766
|
/**
|
|
1765
1767
|
* 逻辑
|
|
1766
1768
|
*/
|
|
@@ -1783,6 +1785,8 @@ declare namespace FW {
|
|
|
1783
1785
|
handle?: Newable<SocketHandle>;
|
|
1784
1786
|
};
|
|
1785
1787
|
|
|
1788
|
+
type RegisterFramework = RegisterFrameworkBundle & RegisterFrameworkComponent;
|
|
1789
|
+
|
|
1786
1790
|
/**
|
|
1787
1791
|
* 状态机
|
|
1788
1792
|
*/
|
|
@@ -2007,27 +2011,30 @@ declare namespace FW {
|
|
|
2007
2011
|
type OpacityAnimationArgs = {
|
|
2008
2012
|
target: cc.Node;
|
|
2009
2013
|
duration: number;
|
|
2010
|
-
|
|
2014
|
+
} & Partial<{
|
|
2015
|
+
initOpacity: number;
|
|
2011
2016
|
targetOpacity: number;
|
|
2012
|
-
cb
|
|
2013
|
-
}
|
|
2017
|
+
cb: () => void;
|
|
2018
|
+
}>;
|
|
2014
2019
|
|
|
2015
2020
|
type ScaleAnimationArgs = {
|
|
2016
2021
|
target: cc.Node;
|
|
2017
2022
|
duration: number;
|
|
2018
|
-
|
|
2023
|
+
} & Partial<{
|
|
2024
|
+
initScale: number;
|
|
2019
2025
|
targetScale: number;
|
|
2020
|
-
easing
|
|
2021
|
-
cb
|
|
2022
|
-
}
|
|
2026
|
+
easing: cc.Easing;
|
|
2027
|
+
cb: () => void;
|
|
2028
|
+
}>;
|
|
2023
2029
|
|
|
2024
2030
|
type PositionAnimationArgs = {
|
|
2025
2031
|
target: cc.Node;
|
|
2026
2032
|
duration: number;
|
|
2027
|
-
|
|
2033
|
+
} & Partial<{
|
|
2034
|
+
initPosition: Vec3;
|
|
2028
2035
|
targetPosition: Vec3;
|
|
2029
|
-
cb
|
|
2030
|
-
}
|
|
2036
|
+
cb: () => void;
|
|
2037
|
+
}>;
|
|
2031
2038
|
|
|
2032
2039
|
type Vec3 = {
|
|
2033
2040
|
x?: number;
|
|
@@ -2108,7 +2115,7 @@ declare namespace FW {
|
|
|
2108
2115
|
getString: <T extends string>(key: string) => T;
|
|
2109
2116
|
}
|
|
2110
2117
|
|
|
2111
|
-
type TaskOptions = {
|
|
2118
|
+
type TaskOptions = Partial<{
|
|
2112
2119
|
taskId: number;
|
|
2113
2120
|
/**
|
|
2114
2121
|
* 每帧最大执行时间(ms),默认16ms (60fps) 帧预算
|
|
@@ -2122,6 +2129,8 @@ declare namespace FW {
|
|
|
2122
2129
|
* 是否打印日志
|
|
2123
2130
|
*/
|
|
2124
2131
|
log: boolean;
|
|
2132
|
+
}> & {
|
|
2133
|
+
taskId: number;
|
|
2125
2134
|
};
|
|
2126
2135
|
|
|
2127
2136
|
type TaskEvent = {
|
|
@@ -2280,13 +2289,13 @@ declare namespace FW {
|
|
|
2280
2289
|
reason?: any,
|
|
2281
2290
|
) => void;
|
|
2282
2291
|
|
|
2283
|
-
type PromiseExecuteOptions = {
|
|
2284
|
-
reason
|
|
2285
|
-
timeout
|
|
2286
|
-
retryCount
|
|
2287
|
-
retryInterval
|
|
2288
|
-
retryCondition
|
|
2289
|
-
}
|
|
2292
|
+
type PromiseExecuteOptions = Partial<{
|
|
2293
|
+
reason: any;
|
|
2294
|
+
timeout: number;
|
|
2295
|
+
retryCount: number;
|
|
2296
|
+
retryInterval: number;
|
|
2297
|
+
retryCondition: (error: any, retryCount: number) => boolean;
|
|
2298
|
+
}>;
|
|
2290
2299
|
|
|
2291
2300
|
type PromiseAllResult<T = any> = {
|
|
2292
2301
|
success: Array<{ id: number; value: T }>;
|
|
@@ -2299,16 +2308,16 @@ declare namespace FW {
|
|
|
2299
2308
|
/**
|
|
2300
2309
|
* 性能管理器配置
|
|
2301
2310
|
*/
|
|
2302
|
-
type PerformanceModuleOptions = {
|
|
2311
|
+
type PerformanceModuleOptions = Partial<{
|
|
2303
2312
|
/** 是否自动收集性能数据 */
|
|
2304
|
-
autoCollect
|
|
2313
|
+
autoCollect: boolean;
|
|
2305
2314
|
/** 性能数据保留时间(毫秒) */
|
|
2306
|
-
dataRetentionTime
|
|
2315
|
+
dataRetentionTime: number;
|
|
2307
2316
|
/** 采样率(0-1) */
|
|
2308
|
-
samplingRate
|
|
2317
|
+
samplingRate: number;
|
|
2309
2318
|
/** 性能警告阈值(毫秒) */
|
|
2310
|
-
warningThreshold
|
|
2311
|
-
}
|
|
2319
|
+
warningThreshold: number;
|
|
2320
|
+
}>;
|
|
2312
2321
|
|
|
2313
2322
|
/**
|
|
2314
2323
|
* 性能统计报告
|
|
@@ -2332,12 +2341,12 @@ declare namespace FW {
|
|
|
2332
2341
|
timestamp: number;
|
|
2333
2342
|
};
|
|
2334
2343
|
|
|
2335
|
-
type ManagerOptions = {
|
|
2344
|
+
type ManagerOptions = Partial<{
|
|
2336
2345
|
/** 是否启用调试日志 */
|
|
2337
|
-
debug
|
|
2346
|
+
debug: boolean;
|
|
2338
2347
|
/** 管理器名称(默认使用类名) */
|
|
2339
|
-
name
|
|
2340
|
-
}
|
|
2348
|
+
name: string;
|
|
2349
|
+
}>;
|
|
2341
2350
|
|
|
2342
2351
|
type PropertyDecorator = (
|
|
2343
2352
|
$class: Record<string, any>,
|
|
@@ -2395,11 +2404,6 @@ declare namespace FW {
|
|
|
2395
2404
|
declare namespace FW {
|
|
2396
2405
|
export abstract class FrameworkBase {
|
|
2397
2406
|
public readonly entry: FW.Entry = FW.Entry;
|
|
2398
|
-
public logic?: FW.Logic;
|
|
2399
|
-
public data?: FW.Data;
|
|
2400
|
-
public config?: FW.AssetConfig;
|
|
2401
|
-
public sender?: FW.Sender;
|
|
2402
|
-
public handle?: FW.Handle;
|
|
2403
2407
|
|
|
2404
2408
|
/**
|
|
2405
2409
|
* 调用Promise函数 并捕获性能数据
|
package/types/Global.d.ts
CHANGED
|
@@ -11,12 +11,12 @@ declare namespace globalThis {
|
|
|
11
11
|
export function FWPropertyNode($opt?: ParamType): FW.PropertyDecorator;
|
|
12
12
|
export function FWPropertyNodes(...paths: string[]): FW.PropertyDecorator;
|
|
13
13
|
export function FWPropertyComponent(
|
|
14
|
-
$componentClass:
|
|
14
|
+
$componentClass: FW.Newable<cc.Component>,
|
|
15
15
|
$childName?: string,
|
|
16
16
|
$mute = false,
|
|
17
17
|
): FW.PropertyDecorator;
|
|
18
18
|
export function FWPropertyComponents(
|
|
19
|
-
$componentClass:
|
|
19
|
+
$componentClass: FW.Newable<cc.Component>,
|
|
20
20
|
$childName?: string,
|
|
21
21
|
): FW.PropertyDecorator;
|
|
22
22
|
}
|