//---------------------------------------------------------------------- public void Draw() { MenuScreen.Draw(); if (mPopupStack.Count > 0) { PopupScreen.Draw(); } }
public void AddPopupScreen(string text, Texture2D texture, PopupType type, bool pause) { var pup = new PopupScreen(text, texture, type); pup.ParentScreen = this; pup.ScreenManager = ScreenManager; pup.Load(); Popups.Add(pup); PauseScreen(); }
//---------------------------------------------------------------------- public virtual void Update(float _fElapsedTime) { MenuScreen.IsActive = Game.IsActive && (Game.GameStateMgr == null || !Game.GameStateMgr.IsSwitching) && mPopupStack.Count == 0; PopupScreen.IsActive = Game.IsActive && (Game.GameStateMgr == null || !Game.GameStateMgr.IsSwitching) && mPopupStack.Count > 0; MenuScreen.HandleInput(); if (mPopupStack.Count > 0) { PopupScreen.HandleInput(); } MenuScreen.Update(_fElapsedTime); if (mPopupStack.Count > 0) { PopupScreen.Update(_fElapsedTime); } }
//---------------------------------------------------------------------- // NOTE: This method takes the removed popup as an argument to help ensure consistency public void PopPopup(Panel _popup) { if (mPopupStack.Count == 0 || mPopupStack.Peek() != _popup) { throw new InvalidOperationException("Cannot pop a popup if it isn't at the top of the stack"); } mPopupStack.Pop(); PopupScreen.Root.Clear(); if (mPopupStack.Count > 0) { PopupScreen.Root.AddChild(mPopupFade); var panel = (Panel)mPopupStack.Peek(); PopupScreen.Root.AddChild(panel); PopupScreen.Focus(panel); } }
public static TMP_InputField GetTMP_InputField(this PopupScreen popupScreen) { return(popupScreen.GetFirstActivePopup()?.GetComponentInChildren <TMP_InputField>()); }