public void ChangeScreen(GameScreen NewScreen)
        {
            // We are changing screens, so pop everything off.
            // If we want to just modify screens, we should
            // use PushScreen and PopScreen.
            while (screenStack.Count > 0)
            {
                RemoveScreen();
            }

            // Changing screen, reset our draw order.
            NewScreen.DrawOrder = drawOrder = baseDrawOrder;
            AddScreen(NewScreen);

            // Inform everyone we just changed screens.
            if (OnScreenChange != null)
            {
                OnScreenChange(this, null);
            }
        }
        public void PushScreen(GameScreen NewScreen)
        {
            drawOrder += 1;
            NewScreen.DrawOrder = drawOrder;

            AddScreen(NewScreen);

            // Inform everyone we just changed screens.
            if (OnScreenChange != null)
            {
                OnScreenChange(this, null);
            }
        }
 public bool ContainsScreen(GameScreen Screen)
 {
     return (screenStack.Contains(Screen));
 }
        private void AddScreen(GameScreen Screen)
        {
            screenStack.Push(Screen);

            Game.Components.Add(Screen);

            // Register the event for this screen.
            OnScreenChange += Screen.ScreenChanged;
        }