virtual protected void OnUnRegister() { StrangeRoot strangeRoot = GameApplication.Instance.ModuleContainer.Get <StrangeRoot>(); GameRoot gameRoot = strangeRoot.GameRoot; gameRoot.context.RemoveView(this); RemoveListeners(); }
void InitBackButtonService() { //TODO: Move back button binding elsewhere (needs to be under a gameobject because of its update function) StrangeRoot strangeRoot = GameApplication.Instance.ModuleContainer.Get <StrangeRoot>(); BackButtonService backButtonService = strangeRoot.GameRoot.gameObject.AddComponent <BackButtonService>(); IInjector injector = strangeRoot.MainContext.injectionBinder.injector; injector.binder.Bind <IBackButtonService>().ToValue(backButtonService).CrossContext(); }
virtual protected void RegisterWithContextType(ViewType viewType) { if (!registeredWithContext && GameApplication.Instance != null) { StrangeRoot strangeRoot = GameApplication.Instance.ModuleContainer.Get <StrangeRoot>(); MonoBehaviour view = this; if (viewType == ViewType.GameView) { GameRoot gameRoot = strangeRoot.GameRoot; if (gameRoot == null) { Debug.LogError("Error loading game context, Game Root (the bootstrap) is null"); return; } gameRoot.context.AddView(view); } else if (viewType == ViewType.MainView) { strangeRoot.context.AddView(view); } } }