/// <summary> /// Find module installer components for auto install with settings from unity editor. /// </summary> /// <param name="_gamemanagerGO"></param> public void ModuleAutoInstallerOverride(GameObject _gamemanagerGO) { // DataModule if (_gamemanagerGO.GetComponentInChildren <ModuleInstaller <IDataModule> >()) { IDataModule dm = _gamemanagerGO.GetComponentInChildren <ModuleInstaller <IDataModule> >().InstallModule(); DataModule.SetupModule(dm, dm.Settings); //typeof(IMyInterface).IsAssignableFrom(typeof(MyType)) //typeof().GetInterfaces().Contains(typeof(IMyInterface)) } // LocalizationModule if (_gamemanagerGO.GetComponentInChildren <ModuleInstaller <ILocalizationModule> >()) { ILocalizationModule dm = _gamemanagerGO.GetComponentInChildren <ModuleInstaller <ILocalizationModule> >().InstallModule(); LocalizationModule.SetupModule(dm, dm.Settings); } // PlayerProfileModule Install if (_gamemanagerGO.GetComponentInChildren <ModuleInstaller <IPlayerProfileModule> >()) { IPlayerProfileModule moduleInstance = _gamemanagerGO.GetComponentInChildren <ModuleInstaller <IPlayerProfileModule> >().InstallModule(); PlayerProfile.SetupModule(moduleInstance, moduleInstance.Settings); } // UIModule Install if (_gamemanagerGO.GetComponentInChildren <ModuleInstaller <IUIModule> >()) { IUIModule moduleInstance = _gamemanagerGO.GetComponentInChildren <ModuleInstaller <IUIModule> >().InstallModule(); UIModule.SetupModule(moduleInstance, moduleInstance.Settings); } // SceneModule Install if (_gamemanagerGO.GetComponentInChildren <ModuleInstaller <ISceneModule> >()) { ISceneModule moduleInstance = _gamemanagerGO.GetComponentInChildren <ModuleInstaller <ISceneModule> >().InstallModule(); SceneModule.SetupModule(moduleInstance, moduleInstance.Settings); } }
/// <summary> /// Module Setup. /// </summary> /// <param name="_concreteModule">Concrete module implementation to set as active module behaviour.</param> /// <returns></returns> public IPlayerProfileModule SetupModule(IPlayerProfileModule _concreteModule, IModuleSettings _settings = null) { ConcreteModuleImplementation = _concreteModule.SetupModule(_concreteModule, _settings); if (ConcreteModuleImplementation == null) { OnSetupError(); } return(ConcreteModuleImplementation); }
public IPlayerProfileModule SetupModule(IPlayerProfileModule _concreteModule, IModuleSettings _settings = null) { Settings = _settings; // Add Here setup stuffs for this concrete implementation return(this); }