예제 #1
0
 public MenuScreen(GameScreen screen)
 {
     TransitionOnTime = TransitionOffTime = TimeSpan.FromSeconds(1.5);
     if (screen.ScreenState != ScreenState.Frozen)
         screen.ScreenState = ScreenState.Frozen;
     parent = screen;
 }
예제 #2
0
        /// <summary>
        /// Adds a screen to the manager
        /// </summary>
        /// <param name="screen">The screen to be added</param>
        public void AddScreen(GameScreen screen)
        {
            //Sets the reference to the screen manager on the screen
            screen.ScreenManager = this;

            //If the screen manager is initialized, perform initialize operations
            //for the screens.
            if (this.isInitialized)
            {
                screen.LoadContent();
                screen.Initialize();
            }

            //Finally, add the screen to the list.
            screens.Add(screen);
        }
예제 #3
0
        /// <summary>
        /// Removed the desired screen from the system
        /// </summary>
        /// <param name="screen">The screen we wish to remove</param>
        public void RemoveScreen(GameScreen screen)
        {
            //If the screen manager is initialized, unload the screen content.
            if (this.isInitialized)
            {
                screen.UnloadContent();
            }

            //Finally, remove the screen from both lists.
            screens.Remove(screen);
            screensToUpdate.Remove(screen);
        }