public static void Open() { var editorPlatform = GetWindow <EditorModulizationPlatformEditor>(); editorPlatform.position = new Rect( Screen.width / 2, Screen.height * 2 / 3, 600, 500 ); // 组装 Container // var cache = new EditorPlatformModuleCache(); // var factory = new EditorPlatformModuleFactory(); var moduleType = typeof(IEditorPlatformModule); var cache = new DefaultModuleCache(); var factory = new AssemblyModuleFactory(moduleType.Assembly, moduleType); editorPlatform.mModuleContainer = new ModuleContainer(cache, factory); editorPlatform.Show(); }
void Awake() { var baseType = typeof(IModule); var cache = new DefaultModuleCache(); var factory = new AssemblyModuleFactory(baseType.Assembly, baseType); Container = new ModuleContainer(cache, factory); // 主动去创建对象 var poolManager = Container.GetModule <IPoolManager>(); var fsm = Container.GetModule <IFSM>(); var resManager = Container.GetModule <IResManager>(); var eventManager = Container.GetModule <IEventManager>(); var uiManager = Container.GetModule <IUIManager>(); var modules = Container.GetAllModules <IModule>(); // 初始化模块 foreach (var module in modules) { module.InitModule(); } }