public override void Awake() { m_ScreenStack = new Stack <ScreenId>(); m_PopupStack = new Stack <UIPopupData>(); m_CurrentScreen = null; m_CurrentPopup = null; Debug.AssertFormat(ValidateManager() != false, "{0} : Failed to validate, please ensure that all required components are set and not null.", UIManager.Identifier); m_Prompts = m_PromptsCanvas.GetComponent <UIPrompts>(); base.Awake(); }
/// <summary> /// /// </summary> /// <param name="popup"></param> public void ShowNextPopup() { // Close any existing popups. ClosePopup(); if (m_PopupStack.Count > 0) { InputManager.Instance.SetInputType("UI"); UIPopupData nextPopup = m_PopupStack.Pop(); m_CurrentPopup = GameObject.Instantiate <UIBasePopup>(m_GenericPopupPrefab, m_PopupCanvas.transform); m_CurrentPopup.SetData(nextPopup); m_CurrentPopup.Initialize(); m_PopupLayer.SetActive(true); } }
/// <summary> /// /// </summary> public void ClosePopup() { if (m_CurrentPopup != null) { m_CurrentPopup.Shutdown(); GameObject.Destroy(m_CurrentPopup.gameObject); m_CurrentPopup = null; // Show the next popop if (m_PopupStack.Count > 0) { ShowNextPopup(); } else { InputManager.Instance.SetInputType("Default"); m_PopupLayer.SetActive(false); } } }