@ives_xxz/framework 2.0.4 → 2.0.6

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/FrameworkBase.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { injectable } from 'inversify';
1
+ import { injectable } from "inversify";
2
2
 
3
3
  @injectable()
4
4
  export abstract class FrameworkBase {
@@ -18,7 +18,11 @@ export abstract class FrameworkBase {
18
18
 
19
19
  constructor() {
20
20
  this.initialize?.();
21
- // this.entry.evtMgr.register(FW.EventDefine.SystemEvent.SYSTEM_RESTART, this.onRestart, this);
21
+ this.entry.evtMgr.register(
22
+ FW.EventDefine.SystemEvent.SYSTEM_RESTART,
23
+ this.onRestart,
24
+ this
25
+ );
22
26
  }
23
27
 
24
28
  protected get moduleName(): string {
@@ -58,36 +62,39 @@ export abstract class FrameworkBase {
58
62
 
59
63
  if (tag !== FW.SystemDefine.FWBindTag.LOGIC) {
60
64
  this.logic = FW.Framework.getComponent<FW.Logic>(
61
- `${bundleName}${FW.SystemDefine.FWBindTag.LOGIC}`,
65
+ `${bundleName}${FW.SystemDefine.FWBindTag.LOGIC}`
62
66
  );
63
67
  }
64
68
 
65
69
  if (tag !== FW.SystemDefine.FWBindTag.DATA) {
66
70
  this.data = FW.Framework.getComponent<FW.Data>(
67
- `${bundleName}${FW.SystemDefine.FWBindTag.DATA}`,
71
+ `${bundleName}${FW.SystemDefine.FWBindTag.DATA}`
68
72
  );
69
73
  }
70
74
 
71
75
  if (tag !== FW.SystemDefine.FWBindTag.CONFIG) {
72
76
  this.config = FW.Framework.getComponent<FW.AssetConfig>(
73
- `${bundleName}${FW.SystemDefine.FWBindTag.CONFIG}`,
77
+ `${bundleName}${FW.SystemDefine.FWBindTag.CONFIG}`
74
78
  );
75
79
  }
76
80
 
77
81
  if (tag !== FW.SystemDefine.FWBindTag.SENDER) {
78
82
  this.sender = FW.Framework.getComponent<FW.Sender>(
79
- `${bundleName}${FW.SystemDefine.FWBindTag.SENDER}`,
83
+ `${bundleName}${FW.SystemDefine.FWBindTag.SENDER}`
80
84
  );
81
85
  }
82
86
 
83
87
  if (tag !== FW.SystemDefine.FWBindTag.HANDLE) {
84
88
  this.handle = FW.Framework.getComponent<FW.Handle>(
85
- `${bundleName}${FW.SystemDefine.FWBindTag.HANDLE}`,
89
+ `${bundleName}${FW.SystemDefine.FWBindTag.HANDLE}`
86
90
  );
87
91
  }
88
92
  }
89
93
 
90
- protected async invoke<T>(operation: Promise<T>, operationName: string = 'unknown'): Promise<T> {
94
+ protected async invoke<T>(
95
+ operation: Promise<T>,
96
+ operationName: string = "unknown"
97
+ ): Promise<T> {
91
98
  const startTime = this.getCurrentTime();
92
99
 
93
100
  try {
@@ -101,16 +108,25 @@ export abstract class FrameworkBase {
101
108
  }
102
109
  }
103
110
 
104
- private recordPerformanceMetric(operationName: string, duration: number): void {
111
+ private recordPerformanceMetric(
112
+ operationName: string,
113
+ duration: number
114
+ ): void {
105
115
  if (FW.Entry.performanceMgr) {
106
- FW.Entry.performanceMgr.recordOperationMetric(this.moduleName, operationName, duration);
116
+ FW.Entry.performanceMgr.recordOperationMetric(
117
+ this.moduleName,
118
+ operationName,
119
+ duration
120
+ );
107
121
  }
108
122
 
109
123
  const shouldWarn = duration > 1000;
110
124
 
111
125
  if (FW.Entry.engineMgr.debug || shouldWarn) {
112
126
  const log = shouldWarn ? FW.Log.warn : FW.Log.debug;
113
- log(`[${this.moduleName?.toUpperCase()}] Operation ${operationName} took ${duration}ms`);
127
+ log(
128
+ `[${this.moduleName?.toUpperCase()}] Operation ${operationName} took ${duration}ms`
129
+ );
114
130
  }
115
131
  }
116
132
 
@@ -143,7 +159,10 @@ export abstract class FrameworkBase {
143
159
  return undefined;
144
160
  }
145
161
 
146
- private doesClassNameContainBundleName(className: string, bundleName: string): boolean {
162
+ private doesClassNameContainBundleName(
163
+ className: string,
164
+ bundleName: string
165
+ ): boolean {
147
166
  const bundleNameLower = bundleName.toLowerCase();
148
167
  const classNameLower = className.toLowerCase();
149
168
  return classNameLower.includes(bundleNameLower);
@@ -151,13 +170,13 @@ export abstract class FrameworkBase {
151
170
 
152
171
  private getClassTag(): FW.SystemDefine.FWBindTag {
153
172
  const className = this.moduleName;
154
- if (className.endsWith('Logic')) return FW.SystemDefine.FWBindTag.LOGIC;
155
- if (className.endsWith('Data')) return FW.SystemDefine.FWBindTag.DATA;
156
- if (className.endsWith('Config') || className.endsWith('AssetConfig'))
173
+ if (className.endsWith("Logic")) return FW.SystemDefine.FWBindTag.LOGIC;
174
+ if (className.endsWith("Data")) return FW.SystemDefine.FWBindTag.DATA;
175
+ if (className.endsWith("Config") || className.endsWith("AssetConfig"))
157
176
  return FW.SystemDefine.FWBindTag.CONFIG;
158
- if (className.endsWith('Sender') || className.endsWith('SocketSender'))
177
+ if (className.endsWith("Sender") || className.endsWith("SocketSender"))
159
178
  return FW.SystemDefine.FWBindTag.SENDER;
160
- if (className.endsWith('Handle') || className.endsWith('SocketHandle'))
179
+ if (className.endsWith("Handle") || className.endsWith("SocketHandle"))
161
180
  return FW.SystemDefine.FWBindTag.HANDLE;
162
181
  return;
163
182
  }
package/entry/FWEntry.ts CHANGED
@@ -1,22 +1,21 @@
1
- import FWUiManager from '../manager/FWUiManager';
2
- import FWAnimationManager from '../manager/FWAnimationManager';
3
- import FWAudioManager from '../manager/FWAudioManager';
4
- import FWComponentManager from '../manager/FWComponentManager';
5
- import FWEventManager from '../manager/FWEventManager';
6
- import FWLanguageManager from '../manager/FWLanguageManager';
7
- import { FWLayerManager } from '../manager/FWLayerManager';
8
- import FWObjectManager from '../manager/FWObjectManager';
9
- import { FWResManager } from '../manager/FWResManager';
10
- import FWSocketManager from '../manager/FWSocketManager';
11
- import { FWStateManager } from '../manager/FWStateManager';
12
- import { FWTimeManager } from '../manager/FWTimeManager';
13
- import FWScene from '../scene/FWScene';
14
- import { FWSocketAutoProcessPause } from '../expand/FWDecorator';
15
- import FWTaskManager from '../manager/FWTaskManager';
16
- import FWEngineManager from '../manager/FWEngineManager';
17
- import FWHotUpdateManager from '../manager/FWHotUpdateManager';
18
- import FWPromiseManager from '../manager/FWPromiseManager';
19
- import { FWPerformanceManager } from '../manager/FWPerformanceManager';
1
+ import FWUiManager from "../manager/FWUiManager";
2
+ import FWAnimationManager from "../manager/FWAnimationManager";
3
+ import FWAudioManager from "../manager/FWAudioManager";
4
+ import FWComponentManager from "../manager/FWComponentManager";
5
+ import FWEventManager from "../manager/FWEventManager";
6
+ import FWLanguageManager from "../manager/FWLanguageManager";
7
+ import { FWLayerManager } from "../manager/FWLayerManager";
8
+ import FWObjectManager from "../manager/FWObjectManager";
9
+ import { FWResManager } from "../manager/FWResManager";
10
+ import FWSocketManager from "../manager/FWSocketManager";
11
+ import { FWStateManager } from "../manager/FWStateManager";
12
+ import { FWTimeManager } from "../manager/FWTimeManager";
13
+ import { FWSocketAutoProcessPause } from "../expand/FWDecorator";
14
+ import FWTaskManager from "../manager/FWTaskManager";
15
+ import FWEngineManager from "../manager/FWEngineManager";
16
+ import FWHotUpdateManager from "../manager/FWHotUpdateManager";
17
+ import FWPromiseManager from "../manager/FWPromiseManager";
18
+ import { FWPerformanceManager } from "../manager/FWPerformanceManager";
20
19
 
21
20
  /**
22
21
  * 入口脚本
@@ -94,7 +93,7 @@ export class FWEntry implements FW.Entry {
94
93
  /**
95
94
  * 当前Scene
96
95
  */
97
- scene: FWScene;
96
+ scene: FW.Scene;
98
97
  /**
99
98
  * bundle名字
100
99
  */
@@ -140,10 +139,10 @@ export class FWEntry implements FW.Entry {
140
139
  if (!this.hasSceneName(name)) {
141
140
  try {
142
141
  cc.director.loadScene(name);
143
- this.bundleName = '';
142
+ this.bundleName = "";
144
143
  return;
145
144
  } catch (e) {
146
- FW.Log.error('launchScene failed:', name);
145
+ FW.Log.error("launchScene failed:", name);
147
146
  }
148
147
  }
149
148
 
@@ -202,11 +201,13 @@ export class FWEntry implements FW.Entry {
202
201
  return this.map.get(this.bundleName)?.sceneName || undefined;
203
202
  }
204
203
 
205
- getComponent: <T>(serviceIdentifier: FW.ServiceIdentifier<T>) => T = (serviceIdentifier) =>
206
- FW.Framework.getComponent(serviceIdentifier);
204
+ getComponent: <T>(serviceIdentifier: FW.ServiceIdentifier<T>) => T = (
205
+ serviceIdentifier
206
+ ) => FW.Framework.getComponent(serviceIdentifier);
207
207
 
208
- getComponents: <T>(serviceIdentifier?: FW.ServiceIdentifier<T>) => T[] = (serviceIdentifier) =>
209
- FW.Framework.getComponents(serviceIdentifier);
208
+ getComponents: <T>(serviceIdentifier?: FW.ServiceIdentifier<T>) => T[] = (
209
+ serviceIdentifier
210
+ ) => FW.Framework.getComponents(serviceIdentifier);
210
211
 
211
212
  update(dt: number) {
212
213
  this.timeMgr?.onUpdate(dt);
@@ -1,5 +1,5 @@
1
- import { FWSystemConfig } from '../config/FWSystemConfig';
2
- import { FWManager } from './FWManager';
1
+ import { FWSystemConfig } from "../config/FWSystemConfig";
2
+ import { FWManager } from "./FWManager";
3
3
 
4
4
  /**
5
5
  * 资源数据
@@ -47,7 +47,7 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
47
47
  const img = data.img;
48
48
  const ske = data.ske;
49
49
  const atlas = data.atlas;
50
- const type = bin ? '.bin' : '.txt';
50
+ const type = bin ? ".bin" : ".txt";
51
51
  cc.assetManager.loadAny(
52
52
  [
53
53
  { url: atlas, ext: type },
@@ -59,34 +59,38 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
59
59
  asset.skeletonJson = assets[1];
60
60
  asset.atlasText = assets[0];
61
61
  asset.textures.push(texture);
62
- asset['textureNames'] = [`${img}.png`];
63
- asset['_uuid'] = ske;
62
+ asset["textureNames"] = [`${img}.png`];
63
+ asset["_uuid"] = ske;
64
64
  resolve(asset);
65
- },
65
+ }
66
66
  );
67
- }, FWSystemConfig.PromiseConfig.loadAsset).promise,
67
+ }, FWSystemConfig.PromiseConfig.loadAsset).promise
68
68
  );
69
69
  } catch (e) {
70
- FW.Log.error('从远程加载spine动画资源失败!');
70
+ FW.Log.error("从远程加载spine动画资源失败!");
71
71
  }
72
72
  }
73
73
 
74
74
  /** 加载远程资源 */
75
75
  async loadRemote<T extends cc.Asset = cc.Asset>(
76
76
  url?: string,
77
- cb?: (asset: cc.Asset) => void,
77
+ cb?: (asset: cc.Asset) => void
78
78
  ): Promise<T> {
79
79
  return await this.invoke(
80
80
  FW.Entry.promiseMgr.execute((resolve, reject, signal) => {
81
- cc.assetManager.loadRemote(url, { cacheEnabled: true, maxRetryCount: 3 }, (err, asset) => {
82
- if (err || !asset) {
83
- reject(err);
81
+ cc.assetManager.loadRemote(
82
+ url,
83
+ { cacheEnabled: true, maxRetryCount: 3 },
84
+ (err, asset) => {
85
+ if (err || !asset) {
86
+ reject(err);
87
+ }
88
+ cb?.(asset as T);
89
+ resolve(asset as T);
84
90
  }
85
- cb?.(asset as T);
86
- resolve(asset as T);
87
- });
91
+ );
88
92
  }, FWSystemConfig.PromiseConfig.loadAsset).promise,
89
- `loadAssets -> ${url}`,
93
+ `loadAssets -> ${url}`
90
94
  );
91
95
  }
92
96
 
@@ -96,7 +100,9 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
96
100
  return undefined;
97
101
  }
98
102
 
99
- const propertys = Array.isArray(assetProperty) ? assetProperty : [assetProperty];
103
+ const propertys = Array.isArray(assetProperty)
104
+ ? assetProperty
105
+ : [assetProperty];
100
106
 
101
107
  await Promise.all(
102
108
  propertys.map(async (property) => {
@@ -105,17 +111,19 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
105
111
  const path = property.path;
106
112
  const progress = property.progress;
107
113
 
108
- if (!bundleName || bundleName === '') {
114
+ if (!bundleName || bundleName === "") {
109
115
  FW.Log.error(`找不到bundle${bundleName},或者bundle未加载!`);
110
116
  return undefined;
111
117
  }
112
118
 
113
- if (!path || path === '') {
119
+ if (!path || path === "") {
114
120
  FW.Log.error(`找不到资源路径${path},请检查!`);
115
121
  return undefined;
116
122
  }
117
123
 
118
- let bundle: cc.AssetManager.Bundle = await this.resMgr.loadBundle(bundleName);
124
+ let bundle: cc.AssetManager.Bundle = await this.resMgr.loadBundle(
125
+ bundleName
126
+ );
119
127
 
120
128
  if (!bundle) {
121
129
  FW.Log.error(`加载bundle失败,请检查!`);
@@ -127,20 +135,24 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
127
135
  bundle.preload(
128
136
  path,
129
137
  type,
130
- (finish: number, total: number, item: cc.AssetManager.RequestItem) => {
138
+ (
139
+ finish: number,
140
+ total: number,
141
+ item: cc.AssetManager.RequestItem
142
+ ) => {
131
143
  progress?.(finish, total, item);
132
144
  },
133
145
  (err: Error, item: cc.AssetManager.RequestItem[]) => {
134
146
  if (err || !item || item?.length == 0) {
135
- reject(err || 'preload failed!');
147
+ reject(err || "preload failed!");
136
148
  }
137
149
  resolve(item);
138
- },
150
+ }
139
151
  );
140
152
  }, FWSystemConfig.PromiseConfig.loadAsset).promise,
141
- `preLoadAssets -> ${property.path}`,
153
+ `preLoadAssets -> ${property.path}`
142
154
  );
143
- }),
155
+ })
144
156
  );
145
157
  }
146
158
 
@@ -161,17 +173,19 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
161
173
  const progress = assetProperty.progress;
162
174
  const autoRelease = assetProperty.autoRelease;
163
175
 
164
- if (!bundleName || bundleName === '') {
176
+ if (!bundleName || bundleName === "") {
165
177
  FW.Log.error(`找不到bundle${bundleName},或者bundle未加载!`);
166
178
  return undefined;
167
179
  }
168
180
 
169
- if (!path || path === '') {
181
+ if (!path || path === "") {
170
182
  FW.Log.error(`找不到资源路径${path},请检查!`);
171
183
  return undefined;
172
184
  }
173
185
 
174
- let bundle: cc.AssetManager.Bundle = await this.resMgr.loadBundle(bundleName);
186
+ let bundle: cc.AssetManager.Bundle = await this.resMgr.loadBundle(
187
+ bundleName
188
+ );
175
189
 
176
190
  if (!bundle) {
177
191
  FW.Log.error(`加载bundle失败,请检查!`);
@@ -195,7 +209,11 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
195
209
  bundle.load(
196
210
  path,
197
211
  type,
198
- (finish: number, total: number, item: cc.AssetManager.RequestItem) => {
212
+ (
213
+ finish: number,
214
+ total: number,
215
+ item: cc.AssetManager.RequestItem
216
+ ) => {
199
217
  progress?.(finish, total, item);
200
218
  },
201
219
  (err: Error, asset: cc.Asset) => {
@@ -205,7 +223,7 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
205
223
  }
206
224
  assetData.loaded = true;
207
225
  assetData.dependentBundle = bundleName;
208
- assetData.uuid = asset['_uuid'];
226
+ assetData.uuid = asset["_uuid"];
209
227
  assetData.autoRelease = autoRelease;
210
228
  assetData.asset = asset;
211
229
  assetData.user = assetProperty.user;
@@ -216,10 +234,10 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
216
234
 
217
235
  cb?.(assetData);
218
236
  resolve(assetData);
219
- },
237
+ }
220
238
  );
221
239
  }, FWSystemConfig.PromiseConfig.loadAsset).promise,
222
- `loadAssets -> ${assetProperty.path}`,
240
+ `loadAssets -> ${assetProperty.path}`
223
241
  );
224
242
  }
225
243
  /**
@@ -238,17 +256,19 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
238
256
  const cb = assetProperty.cb;
239
257
  const autoRelease = assetProperty.autoRelease;
240
258
 
241
- if (!bundleName || bundleName === '') {
259
+ if (!bundleName || bundleName === "") {
242
260
  FW.Log.error(`找不到bundle${bundleName},或者bundle未加载!`);
243
261
  return undefined;
244
262
  }
245
263
 
246
- if (!path || path === '') {
264
+ if (!path || path === "") {
247
265
  FW.Log.error(`找不到资源路径${path},请检查!`);
248
266
  return undefined;
249
267
  }
250
268
 
251
- const bundle: cc.AssetManager.Bundle = await this.resMgr.loadBundle(bundleName);
269
+ const bundle: cc.AssetManager.Bundle = await this.resMgr.loadBundle(
270
+ bundleName
271
+ );
252
272
 
253
273
  if (!bundle) {
254
274
  FW.Log.error(`加载bundle失败,请检查!`);
@@ -258,7 +278,7 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
258
278
  return new Promise(
259
279
  (
260
280
  resolve: (value: FW.AssetData[] | PromiseLike<FW.AssetData[]>) => void,
261
- reject: (reason?: any) => void,
281
+ reject: (reason?: any) => void
262
282
  ) => {
263
283
  bundle.loadDir(path, type, (err: Error, assets: cc.Asset[]) => {
264
284
  if (err || assets.length === 0) {
@@ -272,7 +292,7 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
272
292
  const assetData = new FWAssetData();
273
293
  assetData.loaded = true;
274
294
  assetData.dependentBundle = bundleName;
275
- assetData.uuid = asset['_uuid'];
295
+ assetData.uuid = asset["_uuid"];
276
296
  assetData.autoRelease = autoRelease;
277
297
  assetData.asset = asset;
278
298
  assetData.type = type;
@@ -281,7 +301,7 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
281
301
  const key = `${this.createAssetMapKey({
282
302
  bundle: bundleName,
283
303
  path: path,
284
- })}/${asset.name}${type ? `_${type?.name}` : ''}`;
304
+ })}/${asset.name}${type ? `_${type?.name}` : ""}`;
285
305
 
286
306
  this.assetsMap.set(key, assetData);
287
307
 
@@ -291,7 +311,7 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
291
311
  cb?.(assetDataList);
292
312
  resolve(assetDataList);
293
313
  });
294
- },
314
+ }
295
315
  );
296
316
  }
297
317
 
@@ -308,18 +328,18 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
308
328
  const bundleName = assetProperty.bundle || FW.Entry.bundleName;
309
329
  const path = assetProperty.path;
310
330
 
311
- if (!bundleName || bundleName === '') {
331
+ if (!bundleName || bundleName === "") {
312
332
  FW.Log.error(`找不到bundle${bundleName},或者bundle未加载!`);
313
333
  return undefined;
314
334
  }
315
335
 
316
- if (!path || path === '') {
336
+ if (!path || path === "") {
317
337
  FW.Log.error(`找不到资源路径${path},请检查!`);
318
338
  return undefined;
319
339
  }
320
340
 
321
341
  if (!this.has(assetProperty)) {
322
- FW.Log.error('获取资源失败,请先加载!');
342
+ FW.Log.error("获取资源失败,请先加载!");
323
343
  return undefined;
324
344
  }
325
345
 
@@ -343,12 +363,12 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
343
363
  const path = assetProperty.path;
344
364
  const autoRelease = assetProperty.autoRelease;
345
365
 
346
- if (!bundleName || bundleName === '') {
366
+ if (!bundleName || bundleName === "") {
347
367
  FW.Log.error(`找不到bundle${bundleName},或者bundle未加载!`);
348
368
  return undefined;
349
369
  }
350
370
 
351
- if (!path || path === '') {
371
+ if (!path || path === "") {
352
372
  FW.Log.error(`找不到资源路径${path},请检查!`);
353
373
  return undefined;
354
374
  }
@@ -401,9 +421,6 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
401
421
  }
402
422
 
403
423
  public onDestroy(): void {
404
- this.assetsMap.forEach((v) => {
405
- this.release(v.assetProperty);
406
- });
407
424
  this.assetsMap.clear();
408
425
  }
409
426
  }
@@ -1,5 +1,5 @@
1
- import { FWManager } from './FWManager';
2
- import { FWSystemConfig } from '../config/FWSystemConfig';
1
+ import { FWManager } from "./FWManager";
2
+ import { FWSystemConfig } from "../config/FWSystemConfig";
3
3
 
4
4
  export class FWBundleManager extends FWManager implements FW.BundleManager {
5
5
  bundleMap: Map<string, cc.AssetManager.Bundle>;
@@ -33,12 +33,12 @@ export class FWBundleManager extends FWManager implements FW.BundleManager {
33
33
  return await this.invoke(
34
34
  FW.Entry.promiseMgr.execute((resolve, reject, signal) => {
35
35
  const remote = this.remoteBundleConfigMap.get(bundleName);
36
- const url = remote ? remote.url : '';
36
+ const url = remote ? remote.url : "";
37
37
  const path = `${url}${bundleName}`;
38
38
  cc.assetManager.loadBundle(
39
39
  path,
40
40
  {
41
- version: this.remoteBundleConfigMap.get(bundleName)?.version || '',
41
+ version: this.remoteBundleConfigMap.get(bundleName)?.version || "",
42
42
  },
43
43
  async (err: Error, bundle: cc.AssetManager.Bundle) => {
44
44
  if (err || !bundle) {
@@ -51,10 +51,10 @@ export class FWBundleManager extends FWManager implements FW.BundleManager {
51
51
  this.bundleMap.set(bundleName, bundle);
52
52
 
53
53
  resolve(bundle);
54
- },
54
+ }
55
55
  );
56
56
  }, FWSystemConfig.PromiseConfig.loadBundle).promise,
57
- `loadBundle -> ${bundleName}`,
57
+ `loadBundle -> ${bundleName}`
58
58
  );
59
59
  }
60
60
 
@@ -65,7 +65,7 @@ export class FWBundleManager extends FWManager implements FW.BundleManager {
65
65
  */
66
66
  get(bundleName: string): cc.AssetManager.Bundle {
67
67
  if (!this.has(bundleName)) {
68
- FW.Log.error('获取bundle失败,请先加载!');
68
+ FW.Log.error("获取bundle失败,请先加载!");
69
69
  return undefined;
70
70
  }
71
71
  return this.bundleMap.get(bundleName);
@@ -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,9 +1,8 @@
1
- import FWAssetConfig from '../config/FWAssetConfig';
2
- import { FWSystemConfig } from '../config/FWSystemConfig';
3
- import { FWLodash } from '../utils/FWLodash';
4
- import { FWAssetManager } from './FWAssetManager';
5
- import { FWBundleManager } from './FWBundleManager';
6
- import { FWManager } from './FWManager';
1
+ import { FWSystemConfig } from "../config/FWSystemConfig";
2
+ import { FWLodash } from "../utils/FWLodash";
3
+ import { FWAssetManager } from "./FWAssetManager";
4
+ import { FWBundleManager } from "./FWBundleManager";
5
+ import { FWManager } from "./FWManager";
7
6
 
8
7
  export class FWResManager extends FWManager implements FW.ResManager {
9
8
  private bundleMgr: FW.BundleManager;
@@ -31,8 +30,8 @@ export class FWResManager extends FWManager implements FW.ResManager {
31
30
 
32
31
  await this.loadBundle(depend);
33
32
 
34
- const config = FW.Entry.getComponent<FWAssetConfig>(
35
- `${depend}${FW.SystemDefine.FWBindTag.CONFIG}`,
33
+ const config = FW.Entry.getComponent<FW.AssetConfig>(
34
+ `${depend}${FW.SystemDefine.FWBindTag.CONFIG}`
36
35
  );
37
36
  if (!config) continue;
38
37
  const preLoad = config.preLoad;
@@ -68,7 +67,7 @@ export class FWResManager extends FWManager implements FW.ResManager {
68
67
  reject(e);
69
68
  }
70
69
  }, FWSystemConfig.PromiseConfig.loadBundle).promise,
71
- `loadBundle -> ${bundleName}`,
70
+ `loadBundle -> ${bundleName}`
72
71
  );
73
72
  }
74
73
  /**
@@ -85,7 +84,10 @@ export class FWResManager extends FWManager implements FW.ResManager {
85
84
  return await this.assetMgr.loadSpineDataFromRemote(data);
86
85
  }
87
86
 
88
- async loadRemote<T extends cc.Asset = cc.Asset>(url: string, cb: (asset: any) => T): Promise<T> {
87
+ async loadRemote<T extends cc.Asset = cc.Asset>(
88
+ url: string,
89
+ cb: (asset: any) => T
90
+ ): Promise<T> {
89
91
  const asset = await this.assetMgr.loadRemote(url);
90
92
  if (asset instanceof cc.Texture2D) {
91
93
  return new cc.SpriteFrame(asset) as unknown as T;
@@ -132,7 +134,9 @@ export class FWResManager extends FWManager implements FW.ResManager {
132
134
  * @param assetProperty
133
135
  * @returns
134
136
  */
135
- async loadAsset<T extends cc.Asset>(assetProperty: FW.AssetProperty): Promise<T> {
137
+ async loadAsset<T extends cc.Asset>(
138
+ assetProperty: FW.AssetProperty
139
+ ): Promise<T> {
136
140
  const res = await this.assetMgr.load(assetProperty);
137
141
  return this.process<T>(res).asset as T;
138
142
  }
@@ -222,5 +226,6 @@ export class FWResManager extends FWManager implements FW.ResManager {
222
226
  public onDestroy(): void {
223
227
  this.assetMgr.onDestroy();
224
228
  this.bundleMgr.onDestroy();
229
+ cc.assetManager.releaseAll();
225
230
  }
226
231
  }
package/package.json CHANGED
@@ -1,9 +1,11 @@
1
1
  {
2
2
  "name": "@ives_xxz/framework",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "description": "cocoscreator 2.x mvc framework",
5
5
  "main": "index.js",
6
- "keywords": ["123456"],
6
+ "keywords": [
7
+ "123456"
8
+ ],
7
9
  "author": "ives",
8
10
  "license": "ISC"
9
11
  }
package/types/FW.d.ts CHANGED
@@ -8,13 +8,18 @@ declare namespace FW {
8
8
  prototype: T;
9
9
  };
10
10
 
11
- type ServiceIdentifierData<TInstance = unknown> = string | symbol | Newable<TInstance> | Function;
12
-
13
- type CommonNewable<TInstance = unknown, TArgs extends unknown[] = any[]> = Newable<
14
- TInstance,
15
- TArgs
16
- >;
17
- type CommonServiceIdentifier<TInstance = unknown> = ServiceIdentifierData<TInstance>;
11
+ type ServiceIdentifierData<TInstance = unknown> =
12
+ | string
13
+ | symbol
14
+ | Newable<TInstance>
15
+ | Function;
16
+
17
+ type CommonNewable<
18
+ TInstance = unknown,
19
+ TArgs extends unknown[] = any[]
20
+ > = Newable<TInstance, TArgs>;
21
+ type CommonServiceIdentifier<TInstance = unknown> =
22
+ ServiceIdentifierData<TInstance>;
18
23
 
19
24
  type ServiceIdentifier<T = unknown> = CommonServiceIdentifier<T>;
20
25
  /**
@@ -60,13 +65,13 @@ declare namespace FW {
60
65
  resolve: (value: T | PromiseLike<T>) => void,
61
66
  reject: (reason?: any) => void,
62
67
  signal?: AbortSignal,
63
- reason?: any,
68
+ reason?: any
64
69
  ) => void = PromiseExcutor,
65
- options: PromiseExecuteOptions = {},
70
+ options: PromiseExecuteOptions = {}
66
71
  ): PromiseProxy<T>;
67
72
  all<T = any>(
68
73
  promises: FW.PromiseProxy<T>[],
69
- options: FW.PromiseExecuteOptions = {},
74
+ options: FW.PromiseExecuteOptions = {}
70
75
  ): FW.PromiseProxy<FW.PromiseResult<T>>;
71
76
  };
72
77
 
@@ -74,18 +79,22 @@ declare namespace FW {
74
79
  registerLanguagePackageEnum(
75
80
  bundleName: string,
76
81
  language: any,
77
- getter: (key: string, language?: string) => string,
82
+ getter: (key: string, language?: string) => string
78
83
  ): void;
79
84
  getSupportedLanguages(): string[];
80
85
  setSupportedLanguages(languages: string[]): void;
81
86
  getBundles(): string[];
82
87
  getLanguage(): string;
83
88
  getLanguageIndex(): number;
84
- getLanguagePackageValue(bundleName: string, key: string, language?: string): string;
89
+ getLanguagePackageValue(
90
+ bundleName: string,
91
+ key: string,
92
+ language?: string
93
+ ): string;
85
94
  getLanguagePackageEnumKeys(bundleName: string): string[];
86
95
  getLanguagePackageEnumValues(bundleName: string): string[];
87
96
  getLanguagePackageEnum<K extends keyof ILanguageBundleAccessor>(
88
- bundleName: K,
97
+ bundleName: K
89
98
  ): ILanguageBundleAccessor[K];
90
99
  initializeLanguage(language: string);
91
100
  };
@@ -103,32 +112,32 @@ declare namespace FW {
103
112
  createObjectPool<T extends FWObject = FWObject>(
104
113
  node: cc.Node,
105
114
  parent: cc.Node,
106
- tag?: string,
115
+ tag?: string
107
116
  ): Promise<ObjectPool<T>>;
108
117
  createObjectPool<T extends FWObject = FWObject>(
109
118
  prefab: cc.Prefab,
110
119
  parent: cc.Node,
111
- tag?: string,
120
+ tag?: string
112
121
  ): Promise<ObjectPool<T>>;
113
122
  createObjectPool<T extends FWObject = FWObject>(
114
123
  assetProperty: FW.AssetProperty,
115
124
  parent: cc.Node,
116
- tag?: string,
125
+ tag?: string
117
126
  ): Promise<ObjectPool<T>>;
118
127
  createObjectPool<T extends FWObject = FWObject>(
119
128
  node: cc.Node,
120
129
  parent: cc.Node,
121
- type?: number,
130
+ type?: number
122
131
  ): Promise<ObjectPool<T>>;
123
132
  createObjectPool<T extends FWObject = FWObject>(
124
133
  prefab: cc.Prefab,
125
134
  parent: cc.Node,
126
- type?: number,
135
+ type?: number
127
136
  ): Promise<ObjectPool<T>>;
128
137
  createObjectPool<T extends FWObject = FWObject>(
129
138
  assetProperty: FW.AssetProperty,
130
139
  parent: cc.Node,
131
- type?: number,
140
+ type?: number
132
141
  ): Promise<ObjectPool<T>>;
133
142
  /** 获取已经创建的对象池 */
134
143
  getObjectPool(tag: string): ObjectPool;
@@ -161,7 +170,7 @@ declare namespace FW {
161
170
  address: string,
162
171
  sender: Sender,
163
172
  handle: Handle,
164
- config: SocketConfig,
173
+ config: SocketConfig
165
174
  ): Promise<Socket>;
166
175
  /**
167
176
  * 获取socket
@@ -257,7 +266,7 @@ declare namespace FW {
257
266
  tag: string,
258
267
  sender: Sender,
259
268
  handle: SocketHandle,
260
- config: SocketConfig,
269
+ config: SocketConfig
261
270
  ): SocketPromiseProxy;
262
271
  };
263
272
 
@@ -292,7 +301,7 @@ declare namespace FW {
292
301
  args7?: FW.EventManagerArgs,
293
302
  args8?: FW.EventManagerArgs,
294
303
  args9?: FW.EventManagerArgs,
295
- args10?: FW.EventManagerArgs,
304
+ args10?: FW.EventManagerArgs
296
305
  );
297
306
  /**
298
307
  * 比较目标
@@ -353,19 +362,35 @@ declare namespace FW {
353
362
  /**
354
363
  * 一次性调度器
355
364
  */
356
- scheduleOnce(cb?: () => void, time?: number, tag?: string): FW.TimerSchedule;
365
+ scheduleOnce(
366
+ cb?: () => void,
367
+ time?: number,
368
+ tag?: string
369
+ ): FW.TimerSchedule;
357
370
  /**
358
371
  * 一次性调度器
359
372
  */
360
- scheduleOnce(time?: number, cb?: () => void, tag?: string): FW.TimerSchedule;
373
+ scheduleOnce(
374
+ time?: number,
375
+ cb?: () => void,
376
+ tag?: string
377
+ ): FW.TimerSchedule;
361
378
  /**
362
379
  * 一次性调度器
363
380
  */
364
- scheduleOnce(time?: number, cb?: () => void, target?: any): FW.TimerSchedule;
381
+ scheduleOnce(
382
+ time?: number,
383
+ cb?: () => void,
384
+ target?: any
385
+ ): FW.TimerSchedule;
365
386
  /**
366
387
  * 一次性调度器
367
388
  */
368
- scheduleOnce(cb?: () => void, time?: number, target?: any): FW.TimerSchedule;
389
+ scheduleOnce(
390
+ cb?: () => void,
391
+ time?: number,
392
+ target?: any
393
+ ): FW.TimerSchedule;
369
394
  /**
370
395
  * 自定义调度器
371
396
  * */
@@ -374,7 +399,7 @@ declare namespace FW {
374
399
  time?: number,
375
400
  repeat?: number,
376
401
  target?: TargetType,
377
- tag?: string,
402
+ tag?: string
378
403
  ): TimerSchedule;
379
404
  /** 暂停调度器 */
380
405
  pauseSchedule(tag: string): void;
@@ -425,13 +450,13 @@ declare namespace FW {
425
450
  args7?: EventManagerArgs,
426
451
  args8?: EventManagerArgs,
427
452
  args9?: EventManagerArgs,
428
- args10?: EventManagerArgs,
453
+ args10?: EventManagerArgs
429
454
  ) => void,
430
455
  target: TargetType,
431
456
  options?: {
432
457
  priority?: FW.SystemDefine.FWPriorityOrder;
433
458
  intercept?: boolean;
434
- },
459
+ }
435
460
  );
436
461
 
437
462
  registerOnce(
@@ -446,13 +471,13 @@ declare namespace FW {
446
471
  args7?: EventManagerArgs,
447
472
  args8?: EventManagerArgs,
448
473
  args9?: EventManagerArgs,
449
- args10?: EventManagerArgs,
474
+ args10?: EventManagerArgs
450
475
  ) => void,
451
476
  target: TargetType,
452
477
  options?: {
453
478
  priority?: number;
454
479
  intercept?: boolean;
455
- },
480
+ }
456
481
  ): void;
457
482
 
458
483
  /**
@@ -486,7 +511,7 @@ declare namespace FW {
486
511
  args7?: FW.EventManagerArgs,
487
512
  args8?: FW.EventManagerArgs,
488
513
  args9?: FW.EventManagerArgs,
489
- args10?: FW.EventManagerArgs,
514
+ args10?: FW.EventManagerArgs
490
515
  ): void;
491
516
  /**
492
517
  * 注销事件
@@ -632,29 +657,37 @@ declare namespace FW {
632
657
  * @param data
633
658
  */
634
659
  openAsync<Ctr extends FW.LayerController = FWLayerController>(
635
- data: LayerOpenArgs<Ctr>,
660
+ data: LayerOpenArgs<Ctr>
636
661
  ): Promise<Ctr>;
637
662
 
638
663
  /**
639
664
  * 同步打开layer
640
665
  * @param data
641
666
  */
642
- openSync<Ctr extends FW.LayerController = FWLayerController>(data: LayerOpenArgs<Ctr>): Ctr;
667
+ openSync<Ctr extends FW.LayerController = FWLayerController>(
668
+ data: LayerOpenArgs<Ctr>
669
+ ): Ctr;
643
670
  /**
644
671
  * 显示常驻layer
645
672
  * @param layer
646
673
  */
647
- displayLayer<Ctr extends FW.LayerController = FWLayerController>(ctr: Ctr): Ctr;
674
+ displayLayer<Ctr extends FW.LayerController = FWLayerController>(
675
+ ctr: Ctr
676
+ ): Ctr;
648
677
  /**
649
678
  * 隐藏常驻layer
650
679
  * @param layer
651
680
  */
652
- hideLayer<Ctr extends FW.LayerController = FWLayerController>(ctr: Ctr): Ctr;
681
+ hideLayer<Ctr extends FW.LayerController = FWLayerController>(
682
+ ctr: Ctr
683
+ ): Ctr;
653
684
  /**
654
685
  * 关闭layer
655
686
  * @param layer
656
687
  */
657
- close<Ctr extends FW.LayerController = FWLayerController>(ctr: Ctr): FWLayerController;
688
+ close<Ctr extends FW.LayerController = FWLayerController>(
689
+ ctr: Ctr
690
+ ): FWLayerController;
658
691
 
659
692
  /**
660
693
  * 从栈关闭
@@ -760,7 +793,10 @@ declare namespace FW {
760
793
  * @param url
761
794
  * @param cb
762
795
  */
763
- loadRemote<T extends cc.Asset = cc.Asset>(url: string, cb?: (asset: cc.Asset) => T): Promise<T>;
796
+ loadRemote<T extends cc.Asset = cc.Asset>(
797
+ url: string,
798
+ cb?: (asset: cc.Asset) => T
799
+ ): Promise<T>;
764
800
  /**
765
801
  * 从远程加载spine动画
766
802
  * @param data
@@ -776,13 +812,18 @@ declare namespace FW {
776
812
  * 加载资源返回数据
777
813
  * @param assetProperty
778
814
  */
779
- loadAssetData<T extends cc.Asset>(assetProperty: AssetProperty): Promise<AssetData>;
815
+ loadAssetData<T extends cc.Asset>(
816
+ assetProperty: AssetProperty
817
+ ): Promise<AssetData>;
780
818
 
781
819
  /**
782
820
  * 加载资源
783
821
  * @param assetProperty
784
822
  */
785
- loadAsset<T extends cc.Asset>(assetProperty: AssetProperty, cb?: () => void): Promise<T>;
823
+ loadAsset<T extends cc.Asset>(
824
+ assetProperty: AssetProperty,
825
+ cb?: () => void
826
+ ): Promise<T>;
786
827
 
787
828
  /**
788
829
  * 获取资源
@@ -930,7 +971,10 @@ declare namespace FW {
930
971
  * @param url
931
972
  * @param cb
932
973
  */
933
- loadRemote<T extends cc.Asset = cc.Asset>(url: string, cb?: (asset: cc.Asset) => T): Promise<T>;
974
+ loadRemote<T extends cc.Asset = cc.Asset>(
975
+ url: string,
976
+ cb?: (asset: cc.Asset) => T
977
+ ): Promise<T>;
934
978
  /**
935
979
  * 从远程加载spine动画
936
980
  * @param data
@@ -1133,7 +1177,7 @@ declare namespace FW {
1133
1177
  */
1134
1178
  register(
1135
1179
  state: FW.StateMachineRegisterArgs | FW.StateMachineRegisterArgs[],
1136
- stateMachineName?: string,
1180
+ stateMachineName?: string
1137
1181
  );
1138
1182
  /**
1139
1183
  * 注销指定状态机的某个状态
@@ -1189,22 +1233,22 @@ declare namespace FW {
1189
1233
  progress: Function;
1190
1234
  easing: Function | String;
1191
1235
  onUpdate: Function;
1192
- }>,
1236
+ }>
1193
1237
  >(
1194
1238
  duration: number,
1195
1239
  props: ConstructorType<T>,
1196
- opts?: OPTS,
1240
+ opts?: OPTS
1197
1241
  ): FW.Tween;
1198
1242
  by<
1199
1243
  OPTS extends Partial<{
1200
1244
  progress: Function;
1201
1245
  easing: Function | String;
1202
1246
  onUpdate: Function;
1203
- }>,
1247
+ }>
1204
1248
  >(
1205
1249
  duration: number,
1206
1250
  props: ConstructorType<T>,
1207
- opts?: OPTS,
1251
+ opts?: OPTS
1208
1252
  ): FW.Tween;
1209
1253
  set(props: ConstructorType<T>): FW.Tween;
1210
1254
  };
@@ -1444,7 +1488,11 @@ declare namespace FW {
1444
1488
  * @param volume
1445
1489
  * @param loop
1446
1490
  */
1447
- playMusic(assetProperty: AssetProperty, volume?: number, loop?: boolean): void;
1491
+ playMusic(
1492
+ assetProperty: AssetProperty,
1493
+ volume?: number,
1494
+ loop?: boolean
1495
+ ): void;
1448
1496
  /**
1449
1497
  * 停止背景音乐
1450
1498
  */
@@ -1473,21 +1521,36 @@ declare namespace FW {
1473
1521
  * @param volume
1474
1522
  * @param loop
1475
1523
  */
1476
- play(path: string, cb?: (id: number) => void, volume?: number, loop?: boolean);
1524
+ play(
1525
+ path: string,
1526
+ cb?: (id: number) => void,
1527
+ volume?: number,
1528
+ loop?: boolean
1529
+ );
1477
1530
  /**
1478
1531
  * 播放音效
1479
1532
  * @param audio
1480
1533
  * @param volume
1481
1534
  * @param loop
1482
1535
  */
1483
- play(audio: cc.AudioClip, cb?: (id: number) => void, volume?: number, loop?: boolean);
1536
+ play(
1537
+ audio: cc.AudioClip,
1538
+ cb?: (id: number) => void,
1539
+ volume?: number,
1540
+ loop?: boolean
1541
+ );
1484
1542
  /**
1485
1543
  * 播放音效
1486
1544
  * @param assetProperty
1487
1545
  * @param volume
1488
1546
  * @param loop
1489
1547
  */
1490
- play(assetProperty: AssetProperty, cb?: (id: number) => void, volume?: number, loop?: boolean);
1548
+ play(
1549
+ assetProperty: AssetProperty,
1550
+ cb?: (id: number) => void,
1551
+ volume?: number,
1552
+ loop?: boolean
1553
+ );
1491
1554
  /**
1492
1555
  * 暂停所有
1493
1556
  */
@@ -1508,7 +1571,11 @@ declare namespace FW {
1508
1571
  };
1509
1572
 
1510
1573
  type PerformanceManager = {
1511
- recordOperationMetric(manager: string, operation: string, duration: number): void;
1574
+ recordOperationMetric(
1575
+ manager: string,
1576
+ operation: string,
1577
+ duration: number
1578
+ ): void;
1512
1579
  getModuleReport(manager: string): PerformanceReport;
1513
1580
  getAllReports(): Map<string, FW.PerformanceReport>;
1514
1581
  };
@@ -1807,7 +1874,7 @@ declare namespace FW {
1807
1874
  abort?: (reason?: any) => void;
1808
1875
  addAbortEventListener?: (
1809
1876
  listener: (this: AbortSignal, ev: Event) => any,
1810
- options?: boolean | AddEventListenerOptions,
1877
+ options?: boolean | AddEventListenerOptions
1811
1878
  ) => void;
1812
1879
  };
1813
1880
 
@@ -1815,7 +1882,7 @@ declare namespace FW {
1815
1882
  resolve: (value: T | PromiseLike<T>) => void,
1816
1883
  reject: (reason?: any) => void,
1817
1884
  signal: AbortSignal,
1818
- reason?: any,
1885
+ reason?: any
1819
1886
  ) => void;
1820
1887
 
1821
1888
  type PromiseExecuteOptions = {
@@ -1826,7 +1893,10 @@ declare namespace FW {
1826
1893
  retryCondition?: (error: any, retryCount: number) => boolean;
1827
1894
  };
1828
1895
 
1829
- type Promise = (resolve: (value: any) => void, reject: (reason?: any) => void) => void;
1896
+ type Promise = (
1897
+ resolve: (value: any) => void,
1898
+ reject: (reason?: any) => void
1899
+ ) => void;
1830
1900
 
1831
1901
  type PromiseResult<T = any> = {
1832
1902
  success: PromiseProxy<T>[];
@@ -1834,7 +1904,7 @@ declare namespace FW {
1834
1904
  cancelled: number[];
1835
1905
  };
1836
1906
 
1837
- type PromiseStatus = 'pending' | 'fulfilled' | 'rejected' | 'cancelled';
1907
+ type PromiseStatus = "pending" | "fulfilled" | "rejected" | "cancelled";
1838
1908
 
1839
1909
  /**
1840
1910
  * 性能管理器配置
@@ -1882,7 +1952,7 @@ declare namespace FW {
1882
1952
  type PropertyDecorator = (
1883
1953
  $class: Record<string, any>,
1884
1954
  $propertyKey: string | symbol,
1885
- $descriptorOrInitializer?: any,
1955
+ $descriptorOrInitializer?: any
1886
1956
  ) => void;
1887
1957
 
1888
1958
  declare function timeScale(scale: number);
@@ -1930,7 +2000,10 @@ declare namespace FW {
1930
2000
  public config?: FW.AssetConfig;
1931
2001
  public sender?: FW.Sender;
1932
2002
  public handle?: FW.Handle;
1933
- public invoke<T>(operation: Promise<T>, operationName: string = 'unknown'): Promise<T>;
2003
+ public invoke<T>(
2004
+ operation: Promise<T>,
2005
+ operationName: string = "unknown"
2006
+ ): Promise<T>;
1934
2007
  public getLogic<T extends FW.Logic = FWLogic>();
1935
2008
  public getData<T extends FW.Data = FWData>();
1936
2009
  public getSender<T extends FW.Sender>();
@@ -1988,10 +2061,10 @@ declare namespace FW {
1988
2061
  }
1989
2062
 
1990
2063
  export class FWTaskStatus {
1991
- static IDLE = 'IDLE';
1992
- static RUNNING = 'RUNNING';
1993
- static PAUSED = 'PAUSED';
1994
- static COMPLETED = 'COMPLETED';
2064
+ static IDLE = "IDLE";
2065
+ static RUNNING = "RUNNING";
2066
+ static PAUSED = "PAUSED";
2067
+ static COMPLETED = "COMPLETED";
1995
2068
  }
1996
2069
 
1997
2070
  export class FWPriorityOrder {
@@ -2035,17 +2108,17 @@ declare namespace FW {
2035
2108
  * HTTP请求类型
2036
2109
  */
2037
2110
  export class FWHttpRequestType {
2038
- static GET = 'GET';
2039
- static POST = 'POST';
2111
+ static GET = "GET";
2112
+ static POST = "POST";
2040
2113
  }
2041
2114
 
2042
2115
  /**
2043
2116
  * 动画机类型
2044
2117
  */
2045
2118
  export class FWAnimationMachineType {
2046
- static TWEEN = 'TWEEN';
2047
- static SKELETON = 'SKELETON';
2048
- static ANIMATION = 'ANIMATION';
2119
+ static TWEEN = "TWEEN";
2120
+ static SKELETON = "SKELETON";
2121
+ static ANIMATION = "ANIMATION";
2049
2122
  }
2050
2123
 
2051
2124
  export class FWScrollViewTemplateType {
@@ -2066,23 +2139,23 @@ declare namespace FW {
2066
2139
  }
2067
2140
 
2068
2141
  export class FWLanguageAssetType {
2069
- static LABEL = 'label';
2070
- static SPRITE = 'sprite';
2071
- static SKELETON = 'skeleton';
2142
+ static LABEL = "label";
2143
+ static SPRITE = "sprite";
2144
+ static SKELETON = "skeleton";
2072
2145
  }
2073
2146
 
2074
2147
  export class FWPromiseStatus {
2075
- static PENDING = 'pending';
2076
- static FULFILLED = 'fulfilled';
2077
- static REJECTED = 'rejected';
2078
- static CANCELLED = 'cancelled';
2148
+ static PENDING = "pending";
2149
+ static FULFILLED = "fulfilled";
2150
+ static REJECTED = "rejected";
2151
+ static CANCELLED = "cancelled";
2079
2152
  }
2080
2153
 
2081
2154
  export class FWLayerState {
2082
- static CLOSED = 'closed';
2083
- static OPENING = 'opening';
2084
- static OPENED = 'opened';
2085
- static CLOSING = 'closing';
2155
+ static CLOSED = "closed";
2156
+ static OPENING = "opening";
2157
+ static OPENED = "opened";
2158
+ static CLOSING = "closing";
2086
2159
  }
2087
2160
 
2088
2161
  export class FWAudioType {
@@ -2093,21 +2166,21 @@ declare namespace FW {
2093
2166
  namespace EventDefine {
2094
2167
  export class LanguageEvent {
2095
2168
  /** 语言变更 */
2096
- static LANGUAGE_CHANGE = 'LANGUAGE_CHANGE';
2169
+ static LANGUAGE_CHANGE = "LANGUAGE_CHANGE";
2097
2170
  }
2098
2171
 
2099
2172
  export class TaskEvent {
2100
- static START = 'START';
2101
- static PROGRESS = 'PROGRESS';
2102
- static COMPLETE = 'COMPLETE';
2103
- static YIELDED = 'YIELDED';
2104
- static PAUSE = 'PAUSE';
2105
- static RESUME = 'RESUME';
2106
- static FRAME_START = 'FRAME_START';
2107
- static FRAME_END = 'FRAME_END';
2108
- static QUEUE = 'QUEUE';
2109
- static ALL_COMPLETE = 'ALL_COMPLETE';
2110
- static ERROR = 'ERROR';
2173
+ static START = "START";
2174
+ static PROGRESS = "PROGRESS";
2175
+ static COMPLETE = "COMPLETE";
2176
+ static YIELDED = "YIELDED";
2177
+ static PAUSE = "PAUSE";
2178
+ static RESUME = "RESUME";
2179
+ static FRAME_START = "FRAME_START";
2180
+ static FRAME_END = "FRAME_END";
2181
+ static QUEUE = "QUEUE";
2182
+ static ALL_COMPLETE = "ALL_COMPLETE";
2183
+ static ERROR = "ERROR";
2111
2184
  }
2112
2185
 
2113
2186
  export class SystemEvent {
@@ -2115,8 +2188,8 @@ declare namespace FW {
2115
2188
  }
2116
2189
 
2117
2190
  export class CCEvent {
2118
- static ON_SHOW = 'ON_SHOW';
2119
- static ON_HIDE = 'ON_HIDE';
2191
+ static ON_SHOW = "ON_SHOW";
2192
+ static ON_HIDE = "ON_HIDE";
2120
2193
  }
2121
2194
  }
2122
2195
  export const SystemDefine: SystemDefine;
@@ -2170,6 +2243,19 @@ declare namespace FW {
2170
2243
  onDisable?();
2171
2244
  onDestroy?();
2172
2245
  onClose?();
2246
+ cc(
2247
+ target: cc.Node,
2248
+ cb: (event: cc.Event) => void,
2249
+ responseInterval?: number,
2250
+ eventName?: string
2251
+ ): this;
2252
+
2253
+ fw(
2254
+ eventName: string,
2255
+ cb: (event: cc.Event) => void,
2256
+ target?: cc.Node,
2257
+ responseInterval?: number
2258
+ ): this;
2173
2259
 
2174
2260
  /**
2175
2261
  * 查找节点
@@ -2190,7 +2276,7 @@ declare namespace FW {
2190
2276
  referenceNode: cc.Node,
2191
2277
  type?: {
2192
2278
  prototype: T;
2193
- },
2279
+ }
2194
2280
  ): T;
2195
2281
  registerEvent(args: RegisterArgs): void;
2196
2282
  unRegisterEvent(args: RegisterArgs);