/// <summary> /// Setups the single player modals. /// </summary> private void SetupSinglePlayerModals() { //Cache the offline rules processor OfflineRulesProcessor offlineRulesProcessor = m_RulesProcessor as OfflineRulesProcessor; //Get the end game modal EndGameModal endGame = offlineRulesProcessor.endGameModal; //If an end game modal is not specified then use the default if (endGame == null) { endGame = m_DefaultSinglePlayerModal; } InstantiateEndGameModal(endGame); if (m_EndGameModal != null) { m_EndGameModal.SetRulesProcessor(m_RulesProcessor); } //Handle start game modal if (offlineRulesProcessor.startGameModal != null) { m_StartGameModal = Instantiate(offlineRulesProcessor.startGameModal); m_StartGameModal.transform.SetParent(m_EndGameUiParent, false); m_StartGameModal.gameObject.SetActive(false); m_StartGameModal.Setup(offlineRulesProcessor); m_StartGameModal.Show(); LazyLoadLoadingPanel(); //The loading screen must always be the last sibling m_LoadingScreen.transform.SetAsLastSibling(); } }
// Setups the single player modals. private void SetupSinglePlayerModals() { OfflineRulesProcessor offlineRulesProcessor = m_RulesProcessor as OfflineRulesProcessor; EndGameModal endGame = offlineRulesProcessor.endGameModal; if (endGame == null) { endGame = m_DefaultSinglePlayerModal; } InstantiateEndGameModal(endGame); if (m_EndGameModal != null) { m_EndGameModal.SetRulesProcessor(m_RulesProcessor); } // Handle start game modal if (offlineRulesProcessor.startGameModal != null) { m_StartGameModal = Instantiate(offlineRulesProcessor.startGameModal); m_StartGameModal.transform.SetParent(m_EndGameUiParent, false); m_StartGameModal.gameObject.SetActive(false); m_StartGameModal.Setup(offlineRulesProcessor); m_StartGameModal.Show(); LazyLoadLoadingPanel(); m_LoadingScreen.transform.SetAsLastSibling(); } }
/// <summary> /// Instantiates the end game modal. /// </summary> /// <param name="endGame">End game.</param> private void InstantiateEndGameModal(EndGameModal endGame) { if (endGame == null) { return; } if (m_EndGameModal != null) { Destroy(m_EndGameModal); m_EndGameModal = null; } m_EndGameModal = Instantiate <EndGameModal>(endGame); m_EndGameModal.transform.SetParent(m_EndGameUiParent, false); m_EndGameModal.gameObject.SetActive(false); }
public override void OnNotify(string p_event, params object[] p_objects) { base.OnNotify(p_event, p_objects); switch (p_event) { case EventFlag.Game.SetUp: { Debug.Log("Game Start"); //PreparePhrase(); view = MainApp.Instance.view; _mosquitoHandler = view.GetViewObject <MosquitoHandler>(); _background = view.GetViewObject <BackgroundView>(); _gameModel = MainApp.Instance.model.FindModel <GameModel>(); _soundModel = MainApp.Instance.model.FindModel <SoundModel>(); _camera = Camera.main.transform.GetComponent <CameraHandler>(); _gameUIController = GetComponentInChildren <GameUIController>(); _gameUIController._modalView.CloseAll(); GameStart(); } break; case EventFlag.Game.GameEnd: { Debug.Log("Game end"); //Call end game modal EndGameModal endGameModal = _gameUIController._modalView.GetModal <EndGameModal>(); _gameUIController.OpenModal(endGameModal, p_objects); } break; case EventFlag.Game.Restart: { CleanUp(); _mosquitoHandler.Init(); } break; } }