public void PushScreen(GameScreen gs)
        {
            //add gs to relevant data structures
            theGame.Components.Add(gs);
            screens.Push(gs);
            OnScreenChange += gs.ScreenChange;

            //ScreenManager fires the event
            ScreenEventArgs e = new ScreenEventArgs(gs);
            if (OnScreenChange != null)     //the list is not empty
                OnScreenChange(this, e);    //fire event
        }
        public GameScreen PopScreen()
        {
            //remove gs from relevant data structures
            GameScreen gs = screens.Pop();
            theGame.Components.Remove(gs);
            OnScreenChange -= gs.ScreenChange;

            //ScreenManager fires the event
            ScreenEventArgs e = new ScreenEventArgs(screens.Peek());
            if (OnScreenChange != null)     //the list is not empty
                OnScreenChange(this, e);    //fire event

            return gs;
        }
Exemple #3
0
 internal void ScreenChange(object sender, ScreenEventArgs e)
 {
     if (e.GS == this)
         ShowMe();
     else
         HideMe();
 }