public void InitModule() { monoManager = ModuleManagementConfig.Container.GetModule<IMonoManager>(); playerRG = GameObject.FindGameObjectWithTag("Player").GetComponent<Rigidbody>(); monoManager.AddUpdateAction(PlayerInputUpdate); monoManager.AddFixedUpdateAction(PlayerMoveFixedUpdate); Debug.Log("PlayerInputManager初始化成功"); }
private static void Config() { var baseType = typeof(IModule); var cache = new DefaultModuleCache(); var factory = new DefaultModuleFactory(baseType.Assembly, baseType); Container = new ModuleContainer(cache, factory); IPoolManager poolManager = Container.GetModule <IPoolManager>(); IPlayerInputManager playerInputManager = Container.GetModule <IPlayerInputManager>(); IUIManager uIManager = Container.GetModule <IUIManager>(); IMonoManager monoManager = Container.GetModule <IMonoManager>(); IEnumerable <IModule> modules = Container.GetAllModules <IModule>(); foreach (var module in modules) { //通过父类接口调用到它的实现类的具体方法 module.InitModule(); } }