@ives_xxz/framework 1.6.6 → 2.0.1

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.
Files changed (58) hide show
  1. package/Framework.ts +9 -13
  2. package/FrameworkAutoInitialize.ts +58 -0
  3. package/{CC.d.ts.meta → FrameworkAutoInitialize.ts.meta} +1 -1
  4. package/FrameworkBase.ts +35 -36
  5. package/animation/FWSkeleton.ts +5 -6
  6. package/component/FWVirtualViewComponent.ts +42 -45
  7. package/config/FWAssetConfig.ts +2 -2
  8. package/controller/FWLayerController.ts +3 -7
  9. package/data/FWData.ts +2 -3
  10. package/define/FWEventDefine.ts +24 -21
  11. package/define/FWSystemDefine.ts +127 -132
  12. package/define/FWSystemDefine.ts.meta +1 -1
  13. package/entry/FWEntry.ts +2 -3
  14. package/expand/FWDecorator.ts +56 -114
  15. package/expand/FWRollingViewNesting.ts +3 -5
  16. package/item/FWVirtualListItem.ts +1 -1
  17. package/language/FWLanguage.ts +15 -19
  18. package/layer/FWLayer.ts +1 -1
  19. package/log/FWLog.ts +30 -35
  20. package/logic/FWLogic.ts +2 -4
  21. package/machine/FWStateMachine.ts +1 -2
  22. package/manager/FWAnimationManager.ts +6 -8
  23. package/manager/FWAssetManager.ts +22 -23
  24. package/manager/FWAudioManager.ts +30 -52
  25. package/manager/FWBundleManager.ts +2 -4
  26. package/manager/FWComponentManager.ts +0 -1
  27. package/manager/FWEngineManager.ts +9 -12
  28. package/manager/FWEventManager.ts +4 -7
  29. package/manager/FWHotUpdateManager.ts +32 -33
  30. package/manager/FWLanguageManager.ts +1 -2
  31. package/manager/FWLayerManager.ts +88 -138
  32. package/manager/FWManager.ts +1 -3
  33. package/manager/FWObjectManager.ts +7 -9
  34. package/manager/FWPerformanceManager.ts +2 -3
  35. package/manager/FWPromiseManager.ts +29 -28
  36. package/manager/FWResManager.ts +1 -3
  37. package/manager/FWSocketManager.ts +2 -5
  38. package/manager/FWStateManager.ts +2 -4
  39. package/manager/FWTimeManager.ts +14 -15
  40. package/manager/FWUiManager.ts +3 -4
  41. package/package.json +1 -1
  42. package/{register → registry}/FWRegistry.ts +8 -8
  43. package/service/http/FWHttp.ts +5 -7
  44. package/service/socket/FWSocket.ts +28 -43
  45. package/service/socket/FWSocketHandle.ts +3 -6
  46. package/service/socket/FWSocketSender.ts +5 -9
  47. package/types/Creator.d.ts.meta +6 -0
  48. package/{FW.d.ts → types/FW.d.ts} +407 -153
  49. package/types/Global.d.ts +21 -0
  50. package/{render/FWAssembler.ts.meta → types/Global.d.ts.meta} +1 -1
  51. package/types.meta +13 -0
  52. package/utils/FWObjectPool.ts +5 -7
  53. package/utils/FWTask.ts +18 -22
  54. package/render/FWAssembler.ts +0 -11
  55. /package/{register → registry}/FWRegistry.ts.meta +0 -0
  56. /package/{register.meta → registry.meta} +0 -0
  57. /package/{CC.d.ts → types/Creator.d.ts} +0 -0
  58. /package/{FW.d.ts.meta → types/FW.d.ts.meta} +0 -0
@@ -1,5 +1,4 @@
1
1
  import { FWSystemConfig } from '../config/FWSystemConfig';
2
- import FWLog from '../log/FWLog';
3
2
  import { FWManager } from './FWManager';
4
3
 
5
4
  /**
@@ -68,7 +67,7 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
68
67
  }, FWSystemConfig.PromiseConfig.loadAsset).promise,
69
68
  );
70
69
  } catch (e) {
71
- FWLog.error('从远程加载spine动画资源失败!');
70
+ FW.Log.error('从远程加载spine动画资源失败!');
72
71
  }
73
72
  }
74
73
 
@@ -93,7 +92,7 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
93
92
 
94
93
  async preLoad(assetProperty: FW.AssetProperty | FW.AssetProperty[]) {
95
94
  if (!assetProperty) {
96
- FWLog.error(`加载资源失败,请检查参数列表:${assetProperty}!`);
95
+ FW.Log.error(`加载资源失败,请检查参数列表:${assetProperty}!`);
97
96
  return undefined;
98
97
  }
99
98
 
@@ -107,19 +106,19 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
107
106
  const progress = property.progress;
108
107
 
109
108
  if (!bundleName || bundleName === '') {
110
- FWLog.error(`找不到bundle${bundleName},或者bundle未加载!`);
109
+ FW.Log.error(`找不到bundle${bundleName},或者bundle未加载!`);
111
110
  return undefined;
112
111
  }
113
112
 
114
113
  if (!path || path === '') {
115
- FWLog.error(`找不到资源路径${path},请检查!`);
114
+ FW.Log.error(`找不到资源路径${path},请检查!`);
116
115
  return undefined;
117
116
  }
118
117
 
119
118
  let bundle: cc.AssetManager.Bundle = await this.resMgr.loadBundle(bundleName);
120
119
 
121
120
  if (!bundle) {
122
- FWLog.error(`加载bundle失败,请检查!`);
121
+ FW.Log.error(`加载bundle失败,请检查!`);
123
122
  return undefined;
124
123
  }
125
124
 
@@ -152,7 +151,7 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
152
151
  */
153
152
  async load(assetProperty: FW.AssetProperty): Promise<FW.AssetData> {
154
153
  if (!assetProperty) {
155
- FWLog.error(`加载资源失败,请检查参数列表:${assetProperty}!`);
154
+ FW.Log.error(`加载资源失败,请检查参数列表:${assetProperty}!`);
156
155
  return undefined;
157
156
  }
158
157
  const bundleName = assetProperty.bundle || FW.Entry.bundleName;
@@ -163,19 +162,19 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
163
162
  const autoRelease = assetProperty.autoRelease;
164
163
 
165
164
  if (!bundleName || bundleName === '') {
166
- FWLog.error(`找不到bundle${bundleName},或者bundle未加载!`);
165
+ FW.Log.error(`找不到bundle${bundleName},或者bundle未加载!`);
167
166
  return undefined;
168
167
  }
169
168
 
170
169
  if (!path || path === '') {
171
- FWLog.error(`找不到资源路径${path},请检查!`);
170
+ FW.Log.error(`找不到资源路径${path},请检查!`);
172
171
  return undefined;
173
172
  }
174
173
 
175
174
  let bundle: cc.AssetManager.Bundle = await this.resMgr.loadBundle(bundleName);
176
175
 
177
176
  if (!bundle) {
178
- FWLog.error(`加载bundle失败,请检查!`);
177
+ FW.Log.error(`加载bundle失败,请检查!`);
179
178
  return undefined;
180
179
  }
181
180
  const key = this.createAssetMapKey(assetProperty);
@@ -230,7 +229,7 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
230
229
  */
231
230
  async loadDir(assetProperty: FW.AssetProperty): Promise<FW.AssetData[]> {
232
231
  if (!assetProperty) {
233
- FWLog.error(`加载资源失败,请检查参数列表:${assetProperty}!`);
232
+ FW.Log.error(`加载资源失败,请检查参数列表:${assetProperty}!`);
234
233
  return undefined;
235
234
  }
236
235
  const bundleName = assetProperty.bundle || FW.Entry.bundleName;
@@ -240,19 +239,19 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
240
239
  const autoRelease = assetProperty.autoRelease;
241
240
 
242
241
  if (!bundleName || bundleName === '') {
243
- FWLog.error(`找不到bundle${bundleName},或者bundle未加载!`);
242
+ FW.Log.error(`找不到bundle${bundleName},或者bundle未加载!`);
244
243
  return undefined;
245
244
  }
246
245
 
247
246
  if (!path || path === '') {
248
- FWLog.error(`找不到资源路径${path},请检查!`);
247
+ FW.Log.error(`找不到资源路径${path},请检查!`);
249
248
  return undefined;
250
249
  }
251
250
 
252
251
  const bundle: cc.AssetManager.Bundle = await this.resMgr.loadBundle(bundleName);
253
252
 
254
253
  if (!bundle) {
255
- FWLog.error(`加载bundle失败,请检查!`);
254
+ FW.Log.error(`加载bundle失败,请检查!`);
256
255
  return undefined;
257
256
  }
258
257
 
@@ -263,7 +262,7 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
263
262
  ) => {
264
263
  bundle.loadDir(path, type, (err: Error, assets: cc.Asset[]) => {
265
264
  if (err || assets.length === 0) {
266
- FWLog.error(`加载资源失败:${assets},请检查!`);
265
+ FW.Log.error(`加载资源失败:${assets},请检查!`);
267
266
  reject(err);
268
267
  }
269
268
 
@@ -303,24 +302,24 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
303
302
  */
304
303
  get(assetProperty: FW.AssetProperty): FW.AssetData {
305
304
  if (!assetProperty) {
306
- FWLog.error(`加载资源失败,请检查参数列表:${assetProperty}!`);
305
+ FW.Log.error(`加载资源失败,请检查参数列表:${assetProperty}!`);
307
306
  return undefined;
308
307
  }
309
308
  const bundleName = assetProperty.bundle || FW.Entry.bundleName;
310
309
  const path = assetProperty.path;
311
310
 
312
311
  if (!bundleName || bundleName === '') {
313
- FWLog.error(`找不到bundle${bundleName},或者bundle未加载!`);
312
+ FW.Log.error(`找不到bundle${bundleName},或者bundle未加载!`);
314
313
  return undefined;
315
314
  }
316
315
 
317
316
  if (!path || path === '') {
318
- FWLog.error(`找不到资源路径${path},请检查!`);
317
+ FW.Log.error(`找不到资源路径${path},请检查!`);
319
318
  return undefined;
320
319
  }
321
320
 
322
321
  if (!this.has(assetProperty)) {
323
- FWLog.error('获取资源失败,请先加载!');
322
+ FW.Log.error('获取资源失败,请先加载!');
324
323
  return undefined;
325
324
  }
326
325
 
@@ -337,7 +336,7 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
337
336
  */
338
337
  release(assetProperty: FW.AssetProperty): void {
339
338
  if (!assetProperty) {
340
- FWLog.error(`加载资源失败,请检查参数列表:${assetProperty}!`);
339
+ FW.Log.error(`加载资源失败,请检查参数列表:${assetProperty}!`);
341
340
  return undefined;
342
341
  }
343
342
  const bundleName = assetProperty.bundle || FW.Entry.bundleName;
@@ -345,12 +344,12 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
345
344
  const autoRelease = assetProperty.autoRelease;
346
345
 
347
346
  if (!bundleName || bundleName === '') {
348
- FWLog.error(`找不到bundle${bundleName},或者bundle未加载!`);
347
+ FW.Log.error(`找不到bundle${bundleName},或者bundle未加载!`);
349
348
  return undefined;
350
349
  }
351
350
 
352
351
  if (!path || path === '') {
353
- FWLog.error(`找不到资源路径${path},请检查!`);
352
+ FW.Log.error(`找不到资源路径${path},请检查!`);
354
353
  return undefined;
355
354
  }
356
355
 
@@ -384,7 +383,7 @@ export class FWAssetManager extends FWManager implements FW.AssetManager {
384
383
  */
385
384
  has(assetProperty: FW.AssetProperty) {
386
385
  if (!assetProperty) {
387
- FWLog.error(`判断资源是否存在失败,请检查参数列表:${assetProperty}!`);
386
+ FW.Log.error(`判断资源是否存在失败,请检查参数列表:${assetProperty}!`);
388
387
  return;
389
388
  }
390
389
 
@@ -1,6 +1,4 @@
1
- import { FWManager } from "./FWManager";
2
- import FWLog from "../log/FWLog";
3
- import { FWSystemDefine } from "../define/FWSystemDefine";
1
+ import { FWManager } from './FWManager';
4
2
 
5
3
  class FWAudioData {
6
4
  clip: cc.AudioClip;
@@ -11,17 +9,10 @@ class FWAudioData {
11
9
  }
12
10
 
13
11
  class FWAudioPoolItem {
14
- constructor(
15
- public audioId: number,
16
- public startTime: number,
17
- public tag?: string
18
- ) {}
12
+ constructor(public audioId: number, public startTime: number, public tag?: string) {}
19
13
  }
20
14
 
21
- export default class FWAudioManager
22
- extends FWManager
23
- implements FW.AudioManager
24
- {
15
+ export default class FWAudioManager extends FWManager implements FW.AudioManager {
25
16
  musicVolume: number = 1;
26
17
  effectsVolume: number = 1;
27
18
  soundVolume: number = 1;
@@ -38,21 +29,13 @@ export default class FWAudioManager
38
29
  * 播放背景音乐
39
30
  */
40
31
  async playMusic(path: string, volume?: number, loop?: boolean): Promise<void>;
41
- async playMusic(
42
- music: cc.AudioClip,
43
- volume?: number,
44
- loop?: boolean
45
- ): Promise<void>;
46
- async playMusic(
47
- assetProperty: FW.AssetProperty,
48
- volume?: number,
49
- loop?: boolean
50
- ): Promise<void>;
32
+ async playMusic(music: cc.AudioClip, volume?: number, loop?: boolean): Promise<void>;
33
+ async playMusic(assetProperty: FW.AssetProperty, volume?: number, loop?: boolean): Promise<void>;
51
34
  async playMusic(): Promise<void> {
52
35
  try {
53
36
  const audioData = await this.processAudioArguments(
54
37
  arguments,
55
- FWSystemDefine.FWAudioType.MUSIC
38
+ FW.SystemDefine.FWAudioType.MUSIC,
56
39
  );
57
40
  if (!audioData.clip) return;
58
41
 
@@ -63,9 +46,9 @@ export default class FWAudioManager
63
46
  const id = cc.audioEngine.playMusic(audioData.clip, loop);
64
47
  cc.audioEngine.setVolume(id, volume);
65
48
 
66
- FWLog.debug(`播放背景音乐: ${this.getAudioName(audioData.clip)}`);
49
+ FW.Log.debug(`播放背景音乐: ${this.getAudioName(audioData.clip)}`);
67
50
  } catch (e) {
68
- FWLog.error("播放音乐失败:", e);
51
+ FW.Log.error('播放音乐失败:', e);
69
52
  }
70
53
  }
71
54
 
@@ -95,40 +78,39 @@ export default class FWAudioManager
95
78
  cb?: (id: number) => void,
96
79
  volume?: number,
97
80
  loop?: boolean,
98
- tag?: string
81
+ tag?: string,
99
82
  ): Promise<number>;
100
83
  async play(
101
84
  audio: cc.AudioClip,
102
85
  cb?: (id: number) => void,
103
86
  volume?: number,
104
87
  loop?: boolean,
105
- tag?: string
88
+ tag?: string,
106
89
  ): Promise<number>;
107
90
  async play(
108
91
  assetProperty: FW.AssetProperty,
109
92
  cb?: (id: number) => void,
110
93
  volume?: number,
111
94
  loop?: boolean,
112
- tag?: string
95
+ tag?: string,
113
96
  ): Promise<number>;
114
97
  async play(): Promise<number> {
115
98
  try {
116
99
  if (this.audioPool.size >= this.maxConcurrentAudio) {
117
100
  this.clearFinishedAudio();
118
101
  if (this.audioPool.size >= this.maxConcurrentAudio) {
119
- FWLog.warn("音频池已满,无法播放新音频");
102
+ FW.Log.warn('音频池已满,无法播放新音频');
120
103
  return -1;
121
104
  }
122
105
  }
123
106
 
124
107
  const audioData = await this.processAudioArguments(
125
108
  arguments,
126
- FWSystemDefine.FWAudioType.SOUND
109
+ FW.SystemDefine.FWAudioType.SOUND,
127
110
  );
128
111
  if (!audioData.clip) return -1;
129
112
 
130
- const volume =
131
- (audioData.volume ?? this.soundVolume) * this.effectsVolume;
113
+ const volume = (audioData.volume ?? this.soundVolume) * this.effectsVolume;
132
114
  const loop = audioData.loop ?? false;
133
115
  const tag = audioData.tag;
134
116
 
@@ -143,7 +125,7 @@ export default class FWAudioManager
143
125
 
144
126
  return id;
145
127
  } catch (e) {
146
- FWLog.error("播放音效失败:", e);
128
+ FW.Log.error('播放音效失败:', e);
147
129
  return -1;
148
130
  }
149
131
  }
@@ -155,30 +137,30 @@ export default class FWAudioManager
155
137
  if (this.audioPool.has(id)) {
156
138
  cc.audioEngine.stop(id);
157
139
  this.audioPool.delete(id);
158
- FWLog.debug(`停止音效: ID ${id}`);
140
+ FW.Log.debug(`停止音效: ID ${id}`);
159
141
  }
160
142
  }
161
143
 
162
144
  pauseAll(): void {
163
145
  cc.audioEngine.pauseAll();
164
- FWLog.debug("暂停所有音效");
146
+ FW.Log.debug('暂停所有音效');
165
147
  }
166
148
 
167
149
  resumeAll(): void {
168
150
  cc.audioEngine.resumeAll();
169
- FWLog.debug("恢复所有音效");
151
+ FW.Log.debug('恢复所有音效');
170
152
  }
171
153
 
172
154
  stopAll(): void {
173
155
  cc.audioEngine.stopAll();
174
156
  this.audioPool.clear();
175
- FWLog.debug("停止所有音效");
157
+ FW.Log.debug('停止所有音效');
176
158
  }
177
159
 
178
160
  /** 设置播放音效是否静音 */
179
161
  setSoundMute(mute: boolean): void {
180
162
  this.soundVolume = mute ? 0 : 1;
181
- FWLog.debug(`音效${mute ? "静音" : "取消静音"}`);
163
+ FW.Log.debug(`音效${mute ? '静音' : '取消静音'}`);
182
164
  }
183
165
 
184
166
  /**
@@ -188,7 +170,7 @@ export default class FWAudioManager
188
170
  try {
189
171
  let clip: cc.AudioClip;
190
172
 
191
- if (typeof assetProperty === "string") {
173
+ if (typeof assetProperty === 'string') {
192
174
  clip = await FW.Entry.resMgr.loadAsset<cc.AudioClip>({
193
175
  path: assetProperty,
194
176
  bundle: FW.Entry.bundleName,
@@ -249,7 +231,7 @@ export default class FWAudioManager
249
231
  */
250
232
  private async processAudioArguments(
251
233
  args: IArguments,
252
- type: FWSystemDefine.FWAudioType
234
+ type: FW.SystemDefine.FWAudioType,
253
235
  ): Promise<FWAudioData> {
254
236
  const audioData = new FWAudioData();
255
237
  const argsArray = Array.from(args);
@@ -261,7 +243,7 @@ export default class FWAudioManager
261
243
  audioData.clip = await this.loadAudioClip(assetProperty);
262
244
  }
263
245
 
264
- if (type === FWSystemDefine.FWAudioType.MUSIC) {
246
+ if (type === FW.SystemDefine.FWAudioType.MUSIC) {
265
247
  audioData.volume = argsArray[1];
266
248
  audioData.loop = argsArray[2];
267
249
  } else {
@@ -278,7 +260,7 @@ export default class FWAudioManager
278
260
  * 标准化资源属性
279
261
  */
280
262
  private normalizeAssetProperty(input: any): FW.AssetProperty {
281
- if (typeof input === "string") {
263
+ if (typeof input === 'string') {
282
264
  return {
283
265
  path: input,
284
266
  bundle: FW.Entry.bundleName,
@@ -290,9 +272,7 @@ export default class FWAudioManager
290
272
  /**
291
273
  * 加载音频片段
292
274
  */
293
- private async loadAudioClip(
294
- assetProperty: FW.AssetProperty
295
- ): Promise<cc.AudioClip> {
275
+ private async loadAudioClip(assetProperty: FW.AssetProperty): Promise<cc.AudioClip> {
296
276
  try {
297
277
  return await FW.Entry.resMgr.loadAsset<cc.AudioClip>(assetProperty);
298
278
  } catch (e) {
@@ -304,19 +284,17 @@ export default class FWAudioManager
304
284
  * 生成缓存键
305
285
  */
306
286
  private getCacheKey(assetProperty: FW.AssetProperty): string {
307
- if (typeof assetProperty === "string") {
287
+ if (typeof assetProperty === 'string') {
308
288
  return `${FW.Entry.bundleName}_${assetProperty}`;
309
289
  }
310
- return `${assetProperty.bundle || FW.Entry.bundleName}_${
311
- assetProperty.path
312
- }`;
290
+ return `${assetProperty.bundle || FW.Entry.bundleName}_${assetProperty.path}`;
313
291
  }
314
292
 
315
293
  /**
316
294
  * 获取音频名称
317
295
  */
318
296
  private getAudioName(clip: cc.AudioClip): string {
319
- return clip.name || "未知音频";
297
+ return clip.name || '未知音频';
320
298
  }
321
299
 
322
300
  /**
@@ -330,7 +308,7 @@ export default class FWAudioManager
330
308
  if (!cc.audioEngine.getState(id)) {
331
309
  this.audioPool.delete(id);
332
310
  } else if (currentTime - item.startTime > maxAge) {
333
- FWLog.warn(`强制停止超时音频: ID ${id}`);
311
+ FW.Log.warn(`强制停止超时音频: ID ${id}`);
334
312
  this.stop(id);
335
313
  }
336
314
  });
@@ -344,7 +322,7 @@ export default class FWAudioManager
344
322
  this.clearFinishedAudio,
345
323
  this.cleanupInterval,
346
324
  cc.macro.REPEAT_FOREVER,
347
- this
325
+ this,
348
326
  );
349
327
  }
350
328
 
@@ -1,7 +1,5 @@
1
1
  import { FWManager } from './FWManager';
2
- import FWLog from '../log/FWLog';
3
2
  import { FWSystemConfig } from '../config/FWSystemConfig';
4
- import { FWLodash } from '../utils/FWLodash';
5
3
 
6
4
  export class FWBundleManager extends FWManager implements FW.BundleManager {
7
5
  bundleMap: Map<string, cc.AssetManager.Bundle>;
@@ -44,7 +42,7 @@ export class FWBundleManager extends FWManager implements FW.BundleManager {
44
42
  },
45
43
  async (err: Error, bundle: cc.AssetManager.Bundle) => {
46
44
  if (err || !bundle) {
47
- FWLog.error(`"加载bundle失败:"${bundleName}!`);
45
+ FW.Log.error(`"加载bundle失败:"${bundleName}!`);
48
46
  reject(err);
49
47
  }
50
48
 
@@ -67,7 +65,7 @@ export class FWBundleManager extends FWManager implements FW.BundleManager {
67
65
  */
68
66
  get(bundleName: string): cc.AssetManager.Bundle {
69
67
  if (!this.has(bundleName)) {
70
- FWLog.error('获取bundle失败,请先加载!');
68
+ FW.Log.error('获取bundle失败,请先加载!');
71
69
  return undefined;
72
70
  }
73
71
  return this.bundleMap.get(bundleName);
@@ -1,4 +1,3 @@
1
- import FWVirtualViewComponent from '../component/FWVirtualViewComponent';
2
1
  import { FWManager } from './FWManager';
3
2
 
4
3
  export default class FWComponentManager extends FWManager implements FW.ComponentManager {
@@ -1,6 +1,3 @@
1
- import { FWEventDefine } from '../define/FWEventDefine';
2
- import { FWSystemDefine } from '../define/FWSystemDefine';
3
- import FWLog from '../log/FWLog';
4
1
  import { FWManager } from './FWManager';
5
2
 
6
3
  export default class FWEngineManager extends FWManager implements FW.EngineManager {
@@ -16,7 +13,7 @@ export default class FWEngineManager extends FWManager implements FW.EngineManag
16
13
  }
17
14
 
18
15
  restart() {
19
- FW.Entry.evtMgr.dispatch(FWEventDefine.SystemEvent.SYSTEM_RESTART);
16
+ FW.Entry.evtMgr.dispatch(FW.EventDefine.SystemEvent.SYSTEM_RESTART);
20
17
  FW.Entry.initialize();
21
18
  FW.Framework.restart();
22
19
  cc.game.restart();
@@ -25,20 +22,20 @@ export default class FWEngineManager extends FWManager implements FW.EngineManag
25
22
  getMemory() {
26
23
  if (!this.debug) return;
27
24
  if (window.performance && window.performance['memory']) {
28
- FWLog.debug(
25
+ FW.Log.debug(
29
26
  '浏览器允许的最大内存:',
30
27
  this.formatBytes(window.performance['memory'].jsHeapSizeLimit),
31
28
  );
32
- FWLog.debug(
29
+ FW.Log.debug(
33
30
  '浏览器已分配内存:',
34
31
  this.formatBytes(window.performance['memory'].totalJSHeapSize),
35
32
  );
36
- FWLog.debug(
33
+ FW.Log.debug(
37
34
  '浏览器已使用内存:',
38
35
  this.formatBytes(window.performance['memory'].usedJSHeapSize),
39
36
  );
40
37
  } else {
41
- FWLog.debug('当前浏览器不支持 performance.memory');
38
+ FW.Log.debug('当前浏览器不支持 performance.memory');
42
39
  }
43
40
  }
44
41
  /**
@@ -50,14 +47,14 @@ export default class FWEngineManager extends FWManager implements FW.EngineManag
50
47
  }
51
48
  /** 应用切换到前台 */
52
49
  private onAppShow() {
53
- FWLog.debug('game on show!');
54
- FW.Entry.evtMgr?.dispatch(FWSystemDefine.CCEventType.ON_SHOW);
50
+ FW.Log.debug('game on show!');
51
+ FW.Entry.evtMgr?.dispatch(FW.EventDefine.CCEvent.ON_SHOW);
55
52
  }
56
53
 
57
54
  /** 应用切换到后台 */
58
55
  private onAppHide() {
59
- FWLog.debug('game on hide!');
60
- FW.Entry.evtMgr?.dispatch(FWSystemDefine.CCEventType.ON_HIDE);
56
+ FW.Log.debug('game on hide!');
57
+ FW.Entry.evtMgr?.dispatch(FW.EventDefine.CCEvent.ON_HIDE);
61
58
  }
62
59
 
63
60
  private formatBytes(bytes: number) {
@@ -1,6 +1,3 @@
1
- import { FWSystemDefine } from '../define/FWSystemDefine';
2
- import FWLog from '../log/FWLog';
3
-
4
1
  /**
5
2
  * 观察者
6
3
  */
@@ -166,13 +163,13 @@ export default class FWEventManager implements FW.EventManager {
166
163
  ) => void,
167
164
  target: FW.TargetType,
168
165
  options?: {
169
- priority?: FWSystemDefine.FWPriorityOrder;
166
+ priority?: number;
170
167
  intercept?: boolean;
171
168
  once?: boolean;
172
169
  },
173
170
  ) {
174
171
  const observers = this.listeners[eventName];
175
- const define = FWSystemDefine.FWPriorityOrder;
172
+ const define = FW.SystemDefine.FWPriorityOrder;
176
173
  const priority = options?.priority === undefined ? define.NORMAL : options.priority;
177
174
  const intercept = options?.intercept === undefined ? false : options.intercept;
178
175
  const once = options?.once === undefined ? false : options.once;
@@ -218,13 +215,13 @@ export default class FWEventManager implements FW.EventManager {
218
215
  ) => void,
219
216
  target: FW.TargetType,
220
217
  options?: {
221
- priority?: FWSystemDefine.FWPriorityOrder;
218
+ priority?: number;
222
219
  intercept?: boolean;
223
220
  },
224
221
  ) {
225
222
  this.register(eventName, cb, target, {
226
223
  ...options,
227
- once: true, // 强制设置为一次性事件
224
+ once: true,
228
225
  });
229
226
  }
230
227