@ives_xxz/framework 2.1.40 → 2.3.0

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/Framework.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import "reflect-metadata";
2
- import { Container, interfaces } from "inversify";
2
+ import { Container, interfaces, injectable } from "inversify";
3
3
 
4
+ @injectable()
4
5
  export class Framework implements FW.Framework {
5
6
  private container: Container;
6
7
  private registry: Map<string, new () => FW.Registry>;
@@ -58,24 +59,44 @@ export class Framework implements FW.Framework {
58
59
 
59
60
  /** 获取所有组件 */
60
61
  public getComponents<T>(serviceIdentifier: FW.ServiceIdentifier<T>): T[] {
61
- const binder = (this.container as any)._bindingDictionary;
62
- const map = binder._map;
63
- const childBindings: interfaces.Binding<T>[] = [];
64
- for (const [key, bindings] of map.entries()) {
65
- for (const binding of bindings) {
66
- if (this.isSubclassOf(binding.implementationType, serviceIdentifier)) {
67
- childBindings.push(binding);
68
- }
62
+ const instances: T[] = [];
63
+
64
+ if (typeof serviceIdentifier === "string") {
65
+ if (this.container.isBound(serviceIdentifier)) {
66
+ instances.push(this.container.get<T>(serviceIdentifier));
69
67
  }
68
+ return instances;
70
69
  }
71
70
 
72
- const instances: T[] = [];
73
- for (const binding of childBindings) {
74
- try {
75
- const instance = this.getComponent<T>(binding.serviceIdentifier as any);
76
- instances.push(instance);
77
- } catch (e) {
78
- throw new Error(e);
71
+ if (typeof serviceIdentifier === "function") {
72
+ for (const registrations of this.registeredComponents.values()) {
73
+ for (const data of registrations) {
74
+ const classes = [
75
+ data.logic,
76
+ data.data,
77
+ data.config,
78
+ data.sender,
79
+ data.handle,
80
+ ];
81
+
82
+ for (const cls of classes) {
83
+ if (!cls) continue;
84
+
85
+ if (!this.isSubclassOf(cls, serviceIdentifier)) continue;
86
+
87
+ try {
88
+ const instance = this.getComponent<T>(cls as any);
89
+ if (instance && !instances.includes(instance)) {
90
+ instances.push(instance);
91
+ }
92
+ } catch (e) {
93
+ FW.Log.warn(
94
+ `Error getting component instance for ${cls.name}:`,
95
+ e,
96
+ );
97
+ }
98
+ }
99
+ }
79
100
  }
80
101
  }
81
102
 
package/FrameworkBase.ts CHANGED
@@ -2,7 +2,7 @@ import { injectable } from "inversify";
2
2
 
3
3
  @injectable()
4
4
  export abstract class FrameworkBase {
5
- public _logic?: FW.Logic;
5
+ public logic?: FW.Logic;
6
6
  public data?: FW.Data;
7
7
  public config?: FW.AssetConfig;
8
8
  public sender?: FW.Sender;
@@ -16,13 +16,6 @@ export abstract class FrameworkBase {
16
16
  return FW.Entry;
17
17
  }
18
18
 
19
- get logic() {
20
- return this._logic;
21
- }
22
-
23
- set logic(value: FW.Logic) {
24
- this._logic = value;
25
- }
26
19
 
27
20
  constructor() {
28
21
  this.initialize?.();
@@ -60,13 +53,29 @@ export abstract class FrameworkBase {
60
53
  public initializeDependencies(): void {
61
54
  if (this.dependenciesInjected || this.isInitialized) return;
62
55
 
63
- this.dependenciesInjected = true;
64
- this.isInitialized = true;
65
-
66
56
  const bundleName = this.findBundleNameByClassName();
67
- if (!bundleName) return;
57
+ if (!bundleName) {
58
+ if (FW.Entry?.engineMgr?.debug) {
59
+ FW.Log.warn(
60
+ `[FrameworkBase] 未能根据类名 "${this.moduleName}" 推断出 bundleName,跳过依赖注入`,
61
+ );
62
+ }
63
+ return;
64
+ }
68
65
 
69
66
  const tag = this.getClassTag();
67
+ if (tag === undefined) {
68
+ if (FW.Entry?.engineMgr?.debug) {
69
+ FW.Log.warn(
70
+ `[FrameworkBase] 未能根据类名 "${this.moduleName}" 推断出绑定类型(Logic/Data/Config/Sender/Handle),跳过依赖注入`,
71
+ );
72
+ }
73
+ return;
74
+ }
75
+
76
+ // 只有在 bundleName / tag 均解析成功时,才标记为已初始化,避免无效的“锁死”状态
77
+ this.dependenciesInjected = true;
78
+ this.isInitialized = true;
70
79
 
71
80
  if (tag !== FW.SystemDefine.FWBindTag.LOGIC) {
72
81
  this.logic = FW.Entry.getComponent<FW.Logic>(
@@ -1,23 +1,39 @@
1
+ import { FW_TYPES } from "./define/FWTypes";
2
+ import { Container } from "inversify";
3
+
1
4
  export function initializeFramework() {
2
5
  const WD = window as any;
3
- const SD = require('./define/FWSystemDefine');
4
- const ED = require('./define/FWEventDefine');
6
+ const SD = require("./define/FWSystemDefine");
7
+ const ED = require("./define/FWEventDefine");
8
+
9
+ // 防止重复初始化导致状态错乱(例如热重载或多次调用)
10
+ if (WD.FW && WD.FW.Framework && WD.FW.Entry) {
11
+ return;
12
+ }
13
+
5
14
  WD.FW = {};
6
15
 
7
- globalThis.FWPropertyNode = require('./expand/FWDecorator').FWPropertyNode;
8
- globalThis.searchChild = require('./expand/FWDecorator').searchChild;
9
- globalThis.FWPropertyNode = require('./expand/FWDecorator').FWPropertyNode;
10
- globalThis.FWPropertyNodes = require('./expand/FWDecorator').FWPropertyNodes;
11
- globalThis.FWPropertyComponent = require('./expand/FWDecorator').FWPropertyComponent;
12
- globalThis.FWPropertyComponents = require('./expand/FWDecorator').FWPropertyComponents;
13
- globalThis.PerformanceMonitor = require('./expand/FWDecorator').PerformanceMonitor;
14
- globalThis.FWDeprecated = require('./expand/FWDecorator').FWDeprecated;
15
- globalThis.FWSocketAutoProcessPause = require('./expand/FWDecorator').FWSocketAutoProcessPause;
16
- globalThis.FWSocketAutoProcessResume = require('./expand/FWDecorator').FWSocketAutoProcessResume;
17
- globalThis.RegisterEvents = require('./expand/FWDecorator').RegisterEvents;
18
- globalThis.AutoRegisterCCEvent = require('./expand/FWDecorator').AutoRegisterCCEvent;
19
- globalThis.AutoRegisterFWEvent = require('./expand/FWDecorator').AutoRegisterFWEvent;
20
- globalThis.launchScene = '';
16
+ globalThis.FWPropertyNode = require("./expand/FWDecorator").FWPropertyNode;
17
+ globalThis.searchChild = require("./expand/FWDecorator").searchChild;
18
+ globalThis.FWPropertyNode = require("./expand/FWDecorator").FWPropertyNode;
19
+ globalThis.FWPropertyNodes = require("./expand/FWDecorator").FWPropertyNodes;
20
+ globalThis.FWPropertyComponent =
21
+ require("./expand/FWDecorator").FWPropertyComponent;
22
+ globalThis.FWPropertyComponents =
23
+ require("./expand/FWDecorator").FWPropertyComponents;
24
+ globalThis.PerformanceMonitor =
25
+ require("./expand/FWDecorator").PerformanceMonitor;
26
+ globalThis.FWDeprecated = require("./expand/FWDecorator").FWDeprecated;
27
+ globalThis.FWSocketAutoProcessPause =
28
+ require("./expand/FWDecorator").FWSocketAutoProcessPause;
29
+ globalThis.FWSocketAutoProcessResume =
30
+ require("./expand/FWDecorator").FWSocketAutoProcessResume;
31
+ globalThis.RegisterEvents = require("./expand/FWDecorator").RegisterEvents;
32
+ globalThis.AutoRegisterCCEvent =
33
+ require("./expand/FWDecorator").AutoRegisterCCEvent;
34
+ globalThis.AutoRegisterFWEvent =
35
+ require("./expand/FWDecorator").AutoRegisterFWEvent;
36
+ globalThis.launchScene = "";
21
37
 
22
38
  (FW.SystemDefine as any) = {};
23
39
  (FW.EventDefine as any) = {};
@@ -42,23 +58,89 @@ export function initializeFramework() {
42
58
  FW.SystemDefine.FWPromiseStatus = new SD.FWPromiseStatus();
43
59
  FW.SystemDefine.FWLayerState = new SD.FWLayerState();
44
60
  FW.SystemDefine.FWAudioType = new SD.FWAudioType();
45
- FW.Service = require('./service/FWService').FWService;
46
- FW.Http = require('./service/http/FWHttp').FWHttp;
47
- FW.Registry = require('./registry/FWRegistry').FWRegistry;
48
- FW.Framework = new (require('./Framework').Framework)();
49
- FW.FrameworkBase = require('./FrameworkBase').FrameworkBase;
50
- FW.Object = require('./utils/FWObject').FWObject;
51
- FW.Entry = new (require('./entry/FWEntry').FWEntry)();
52
- FW.Scene = require('./scene/FWScene').FWScene;
53
- FW.Logic = require('./logic/FWLogic').FWLogic;
54
- FW.Data = require('./data/FWData').FWData;
55
- FW.Sender = require('./service/socket/FWSocketSender').FWSocketSender;
56
- FW.Handle = require('./service/socket/FWSocketHandle').FWSocketHandle;
57
- FW.AssetConfig = require('./config/FWAssetConfig').FWAssetConfig;
58
- FW.Log = new (require('./log/FWLog').FWLog)();
59
- FW.Layer = require('./layer/FWLayer').FWLayer;
60
- FW.LayerController = require('./controller/FWLayerController').FWLayerController;
61
- FW.SocketMock = new (require('./service/socket/mock/FWSocketMock').FWSocketMock)();
61
+ FW.Service = require("./service/FWService").FWService;
62
+ FW.Http = require("./service/http/FWHttp").FWHttp;
63
+ FW.Registry = require("./registry/FWRegistry").FWRegistry;
64
+ FW.FrameworkBase = require("./FrameworkBase").FrameworkBase;
65
+ FW.Object = require("./utils/FWObject").FWObject;
66
+ FW.Scene = require("./scene/FWScene").FWScene;
67
+ FW.Logic = require("./logic/FWLogic").FWLogic;
68
+ FW.Data = require("./data/FWData").FWData;
69
+ FW.Sender = require("./service/socket/FWSocketSender").FWSocketSender;
70
+ FW.Handle = require("./service/socket/FWSocketHandle").FWSocketHandle;
71
+ FW.AssetConfig = require("./config/FWAssetConfig").FWAssetConfig;
72
+ FW.Layer = require("./layer/FWLayer").FWLayer;
73
+ FW.LayerController =
74
+ require("./controller/FWLayerController").FWLayerController;
75
+ FW.SocketMock =
76
+ new (require("./service/socket/mock/FWSocketMock").FWSocketMock)();
77
+
78
+ const container = initializeContainer();
79
+
80
+ FW.Framework = container.get<FW.Framework>(FW_TYPES.Framework);
81
+ FW.Entry = container.get<FW.Entry>(FW_TYPES.Entry);
82
+ FW.Log = container.get<FW.Log>(FW_TYPES.Log);
83
+
62
84
  FW.Framework.initialize();
63
85
  FW.Entry.initialize();
64
86
  }
87
+
88
+
89
+ function initializeContainer(): Container {
90
+ const container = new Container({
91
+ defaultScope: "Singleton",
92
+ autoBindInjectable: true,
93
+ });
94
+
95
+ const { Framework } = require("./Framework");
96
+ const { FWEntry } = require("./entry/FWEntry");
97
+ const { FWLog } = require("./log/FWLog");
98
+
99
+ container.bind<FW.Framework>(FW_TYPES.Framework).to(Framework).inSingletonScope();
100
+ container.bind<FW.Entry>(FW_TYPES.Entry).to(FWEntry).inSingletonScope();
101
+ container.bind<FW.Log>(FW_TYPES.Log).to(FWLog).inSingletonScope();
102
+
103
+ const FWTimeManager = require("./manager/FWTimeManager").default;
104
+ const { FWLayerManager } = require("./manager/FWLayerManager");
105
+ const { FWResManager } = require("./manager/FWResManager");
106
+ const { FWAssetManager } = require("./manager/FWAssetManager");
107
+ const FWBundleManager = require("./manager/FWBundleManager").default;
108
+ const FWEventManager = require("./manager/FWEventManager").default;
109
+ const FWAudioManager = require("./manager/FWAudioManager").default;
110
+ const FWSocketManager = require("./manager/FWSocketManager").default;
111
+ const FWAnimationManager = require("./manager/FWAnimationManager").default;
112
+ const { FWStateManager } = require("./manager/FWStateManager");
113
+ const FWObjectManager = require("./manager/FWObjectManager").default;
114
+ const FWUiManager = require("./manager/FWUiManager").default;
115
+ const FWTaskManager = require("./manager/FWTaskManager").default;
116
+ const FWComponentManager = require("./manager/FWComponentManager").default;
117
+ const FWLanguageManager = require("./manager/FWLanguageManager").default;
118
+ const FWEngineManager = require("./manager/FWEngineManager").default;
119
+ const FWHotUpdateManager = require("./manager/FWHotUpdateManager").default;
120
+ const FWPromiseManager = require("./manager/FWPromiseManager").default;
121
+ const { FWPerformanceManager } = require("./manager/FWPerformanceManager");
122
+ const FWUtils = require("./utils/FWUtils").default;
123
+
124
+ container.bind<FW.TimeManager>(FW_TYPES.TimeManager).to(FWTimeManager).inSingletonScope();
125
+ container.bind<FW.LayerManager>(FW_TYPES.LayerManager).to(FWLayerManager).inSingletonScope();
126
+ container.bind<FW.ResManager>(FW_TYPES.ResManager).to(FWResManager).inSingletonScope();
127
+ container.bind<FW.AssetManager>(FW_TYPES.AssetManager).to(FWAssetManager).inSingletonScope();
128
+ container.bind<FW.BundleManager>(FW_TYPES.BundleManager).to(FWBundleManager).inSingletonScope();
129
+ container.bind<FW.EventManager>(FW_TYPES.EventManager).to(FWEventManager).inSingletonScope();
130
+ container.bind<FW.AudioManager>(FW_TYPES.AudioManager).to(FWAudioManager).inSingletonScope();
131
+ container.bind<FW.SocketManager>(FW_TYPES.SocketManager).to(FWSocketManager).inSingletonScope();
132
+ container.bind<FW.AnimationManager>(FW_TYPES.AnimationManager).to(FWAnimationManager).inSingletonScope();
133
+ container.bind<FW.StateManager>(FW_TYPES.StateManager).to(FWStateManager).inSingletonScope();
134
+ container.bind<FW.ObjectManager>(FW_TYPES.ObjectManager).to(FWObjectManager).inSingletonScope();
135
+ container.bind<FW.UiManager>(FW_TYPES.UiManager).to(FWUiManager).inSingletonScope();
136
+ container.bind<FW.TaskManager>(FW_TYPES.TaskManager).to(FWTaskManager).inSingletonScope();
137
+ container.bind<FW.ComponentManager>(FW_TYPES.ComponentManager).to(FWComponentManager).inSingletonScope();
138
+ container.bind<FW.LanguageManager>(FW_TYPES.LanguageManager).to(FWLanguageManager).inSingletonScope();
139
+ container.bind<FW.EngineManager>(FW_TYPES.EngineManager).to(FWEngineManager).inSingletonScope();
140
+ container.bind<FW.HotUpdateManager>(FW_TYPES.HotUpdateManager).to(FWHotUpdateManager).inSingletonScope();
141
+ container.bind<FW.PromiseManager>(FW_TYPES.PromiseManager).to(FWPromiseManager).inSingletonScope();
142
+ container.bind<FW.PerformanceManager>(FW_TYPES.PerformanceManager).to(FWPerformanceManager).inSingletonScope();
143
+ container.bind<FW.Utils>(FW_TYPES.Utils).to(FWUtils).inSingletonScope();
144
+
145
+ return container;
146
+ }
@@ -6,24 +6,24 @@ export namespace FWSystemConfig {
6
6
  maxReconnectTimes: 10,
7
7
  reconnectInternal: 3000,
8
8
  protocolSymbol: null,
9
- protocolPollingTime: 10,
9
+ protocolPollingTime: 10000,
10
10
  };
11
11
 
12
12
  export const PromiseConfig = {
13
13
  loadAsset: {
14
14
  retryCount: 0,
15
15
  retryInterval: 0,
16
- timeout: 10,
16
+ timeout: 10000,
17
17
  },
18
18
  loadBundle: {
19
19
  retryCount: 0,
20
20
  retryInterval: 0,
21
- timeout: 10,
21
+ timeout: 10000,
22
22
  },
23
23
  http: {
24
24
  retryCount: 3,
25
25
  retryInterval: 5,
26
- timeout: 10,
26
+ timeout: 10000,
27
27
  },
28
28
  };
29
29
  }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * IoC 容器类型标识符
3
+ */
4
+ export const FW_TYPES = {
5
+ Entry: Symbol.for("Entry"),
6
+ Framework: Symbol.for("Framework"),
7
+
8
+ TimeManager: Symbol.for("TimeManager"),
9
+ LayerManager: Symbol.for("LayerManager"),
10
+ ResManager: Symbol.for("ResManager"),
11
+ AssetManager: Symbol.for("AssetManager"),
12
+ BundleManager: Symbol.for("BundleManager"),
13
+ EventManager: Symbol.for("EventManager"),
14
+ AudioManager: Symbol.for("AudioManager"),
15
+ SocketManager: Symbol.for("SocketManager"),
16
+ AnimationManager: Symbol.for("AnimationManager"),
17
+ StateManager: Symbol.for("StateManager"),
18
+ ObjectManager: Symbol.for("ObjectManager"),
19
+ UiManager: Symbol.for("UiManager"),
20
+ TaskManager: Symbol.for("TaskManager"),
21
+ ComponentManager: Symbol.for("ComponentManager"),
22
+ LanguageManager: Symbol.for("LanguageManager"),
23
+ EngineManager: Symbol.for("EngineManager"),
24
+ HotUpdateManager: Symbol.for("HotUpdateManager"),
25
+ PromiseManager: Symbol.for("PromiseManager"),
26
+ PerformanceManager: Symbol.for("PerformanceManager"),
27
+
28
+ Utils: Symbol.for("Utils"),
29
+ Log: Symbol.for("Log"),
30
+ };
@@ -0,0 +1,9 @@
1
+ {
2
+ "ver": "1.0.8",
3
+ "uuid": "fw-types-ioc-container-symbols",
4
+ "isPlugin": false,
5
+ "loadPluginInWeb": true,
6
+ "loadPluginInNative": true,
7
+ "loadPluginInEditor": false,
8
+ "subMetas": {}
9
+ }
package/entry/FWEntry.ts CHANGED
@@ -1,98 +1,16 @@
1
- import FWUiManager from '../manager/FWUiManager';
2
- import FWAnimationManager from '../manager/FWAnimationManager';
3
- import FWAudioManager from '../manager/FWAudioManager';
1
+ import { injectable, inject } from 'inversify';
2
+ import { FW_TYPES } from '../define/FWTypes';
4
3
  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
4
  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';
19
- import FWUtils from '../utils/FWUtils';
20
5
 
21
6
  /**
22
7
  * 入口脚本
8
+ * 使用依赖注入管理所有管理器实例
23
9
  */
10
+ @injectable()
24
11
  export class FWEntry implements FW.Entry {
25
12
  map: Map<string, FW.RegisterBundle> = new Map<string, FW.RegisterBundle>();
26
- /**
27
- * 事件管理器
28
- */
29
- timeMgr: FW.TimeManager;
30
- /**
31
- * 层级管理器
32
- */
33
- layerMgr: FW.LayerManager;
34
- /**
35
- * 资源管理器
36
- */
37
- resMgr: FW.ResManager;
38
- /**
39
- * 动画管理器
40
- */
41
- animationMgr: FW.AnimationManager;
42
- /**
43
- * 状态管理器
44
- */
45
- stateMgr: FW.StateManager;
46
- /**
47
- * 音效管理器
48
- */
49
- audioMgr: FW.AudioManager;
50
- /**
51
- * socket管理器
52
- */
53
- socketMgr: FW.SocketManager;
54
- /**
55
- * 对象管理器
56
- */
57
- objectMgr: FW.ObjectManager;
58
- /**
59
- * 事件管理器
60
- */
61
- evtMgr: FW.EventManager;
62
- /**
63
- * UI管理器
64
- */
65
- uiMgr: FW.UiManager;
66
- /**
67
- * 任务管理器
68
- */
69
- taskMgr: FW.TaskManager;
70
- /**
71
- * 组件管理器
72
- */
73
- componentMgr: FWComponentManager;
74
- /**
75
- * 多语言管理器
76
- */
77
- languageMgr: FW.LanguageManager;
78
- /**
79
- * 引擎管理器
80
- */
81
- engineMgr: FW.EngineManager;
82
- /**
83
- * 热更新管理器
84
- */
85
- hotUpdateMgr: FW.HotUpdateManager;
86
- /**
87
- * promise管理器
88
- */
89
- promiseMgr: FW.PromiseManager;
90
- /**
91
- * 性能管理器
92
- */
93
- performanceMgr: FW.PerformanceManager;
94
-
95
- utils: FW.Utils;
13
+
96
14
  /**
97
15
  * 当前Scene
98
16
  */
@@ -101,28 +19,30 @@ export class FWEntry implements FW.Entry {
101
19
  * bundle名字
102
20
  */
103
21
  bundleName: string;
104
- /**
105
- * 初始化
106
- * */
22
+
23
+ constructor(
24
+ @inject(FW_TYPES.TimeManager) public timeMgr: FW.TimeManager,
25
+ @inject(FW_TYPES.LayerManager) public layerMgr: FW.LayerManager,
26
+ @inject(FW_TYPES.ResManager) public resMgr: FW.ResManager,
27
+ @inject(FW_TYPES.AnimationManager) public animationMgr: FW.AnimationManager,
28
+ @inject(FW_TYPES.StateManager) public stateMgr: FW.StateManager,
29
+ @inject(FW_TYPES.AudioManager) public audioMgr: FW.AudioManager,
30
+ @inject(FW_TYPES.SocketManager) public socketMgr: FW.SocketManager,
31
+ @inject(FW_TYPES.ObjectManager) public objectMgr: FW.ObjectManager,
32
+ @inject(FW_TYPES.EventManager) public evtMgr: FW.EventManager,
33
+ @inject(FW_TYPES.UiManager) public uiMgr: FW.UiManager,
34
+ @inject(FW_TYPES.TaskManager) public taskMgr: FW.TaskManager,
35
+ @inject(FW_TYPES.ComponentManager) public componentMgr: FWComponentManager,
36
+ @inject(FW_TYPES.LanguageManager) public languageMgr: FW.LanguageManager,
37
+ @inject(FW_TYPES.EngineManager) public engineMgr: FW.EngineManager,
38
+ @inject(FW_TYPES.HotUpdateManager) public hotUpdateMgr: FW.HotUpdateManager,
39
+ @inject(FW_TYPES.PromiseManager) public promiseMgr: FW.PromiseManager,
40
+ @inject(FW_TYPES.PerformanceManager) public performanceMgr: FW.PerformanceManager,
41
+ @inject(FW_TYPES.Utils) public utils: FW.Utils,
42
+ ) {}
43
+
44
+
107
45
  initialize() {
108
- this.evtMgr = new FWEventManager();
109
- this.timeMgr = new FWTimeManager();
110
- this.engineMgr = new FWEngineManager();
111
- this.taskMgr = new FWTaskManager();
112
- this.resMgr = new FWResManager();
113
- this.layerMgr = new FWLayerManager();
114
- this.uiMgr = new FWUiManager();
115
- this.animationMgr = new FWAnimationManager();
116
- this.stateMgr = new FWStateManager();
117
- this.audioMgr = new FWAudioManager();
118
- this.objectMgr = new FWObjectManager();
119
- this.socketMgr = new FWSocketManager();
120
- this.componentMgr = new FWComponentManager();
121
- this.languageMgr = new FWLanguageManager();
122
- this.hotUpdateMgr = new FWHotUpdateManager();
123
- this.promiseMgr = new FWPromiseManager();
124
- this.performanceMgr = new FWPerformanceManager();
125
- this.utils = new FWUtils();
126
46
  }
127
47
 
128
48
  /**
package/log/FWLog.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import { injectable } from 'inversify';
2
+
3
+ @injectable()
1
4
  export class FWLog {
2
5
  FWLogColorMap: Map<FW.SystemDefine.FWLogType, string> = new Map<
3
6
  FW.SystemDefine.FWLogType,
@@ -12,15 +15,8 @@ export class FWLog {
12
15
  [FW.SystemDefine.FWLogType.ERROR, '#DC3545'],
13
16
  [FW.SystemDefine.FWLogType.SYSTEM, '#9b1eeeff'],
14
17
  ]);
15
- private static instance: FWLog;
16
- public static getInstance() {
17
- if (!this.instance) {
18
- this.instance = new FWLog();
19
- }
20
- return this.instance;
21
- }
22
18
 
23
- private constructor() {}
19
+ constructor() {}
24
20
 
25
21
  public get debug() {
26
22
  if (cc.sys.isBrowser)
@@ -1,8 +1,10 @@
1
+ import { injectable } from 'inversify';
1
2
  import { FWSkeleton } from '../animation/FWSkeleton';
2
3
  import { FWTween } from '../animation/FWTween';
3
4
  import { FWManager } from './FWManager';
4
5
  import { FWAnimationMachine } from '../machine/FWAnimationMachine';
5
6
 
7
+ @injectable()
6
8
  export default class FWAnimationManager extends FWManager {
7
9
  private animationMachineMap: Map<string, FWAnimationMachine>;
8
10
  public initialize(): void {