public void SwitchScreens(EF_Base_Screen aScreen) { if (aScreen) { //Close the current Screen if (m_CurrentScreen) { m_CurrentScreen.CloseScreen(); m_PreviousScreen = m_CurrentScreen; if (!goingBack) { AddToBackStack(m_PreviousScreen); } goingBack = false; } //Start the Next Screen m_CurrentScreen = aScreen; aScreen.gameObject.SetActive(true); m_CurrentScreen.StartScreen(); currentScreenData = m_CurrentScreen.m_ScreenData; //Fire the Switched Screen Event if (OnSwitchedScreen != null) { OnSwitchedScreen.Invoke(m_CurrentScreen); } HandleBGImage(); } }
public void AddToBackStack(EF_Base_Screen aScreen) { if (aScreen && m_BackStack != null) { m_BackStack.Add(aScreen); } }
public void GoToPreviousScreen() { if (m_BackStack.Count > 0) { goingBack = true; EF_Base_Screen screen = m_BackStack[m_BackStack.Count - 1]; m_BackStack.RemoveAt(m_BackStack.Count - 1); SwitchScreens(screen); } }
public void HandleHeader(EF_Base_Screen aScreen) { if (aScreen) { //Check to see if we want the Header first gameObject.SetActive(aScreen.m_ScreenData.showHeader); if (!aScreen.m_ScreenData.showHeader) { return; } //Set the Title currentTitle = aScreen.m_ScreenData.screenTitle; if (m_TitleText && !string.IsNullOrEmpty(currentTitle)) { m_TitleText.text = currentTitle; } if (m_BackButton) { m_BackButton.gameObject.SetActive(aScreen.m_ScreenData.allowBackButton); } if (m_InfoButton) { m_InfoButton.gameObject.SetActive(aScreen.m_ScreenData.showInfoButton); } if (m_CloseButton) { m_CloseButton.gameObject.SetActive(aScreen.m_ScreenData.showCloseButton); } if (m_MenuButton) { m_MenuButton.gameObject.SetActive(aScreen.m_ScreenData.showMenuButton); } if (m_Logo) { m_Logo.gameObject.SetActive(aScreen.m_ScreenData.showLogo); } if (m_LogoutButton) { m_LogoutButton.gameObject.SetActive(aScreen.m_ScreenData.showLogoutButton); } } }