AddScreen() public méthode

Adds a new screen to the screen manager.
public AddScreen ( GameScreen screen, System controllingPlayer ) : void
screen GameScreen
controllingPlayer System
Résultat void
Exemple #1
0
        public Game1()
            : base()
        {
            Content.RootDirectory = "Content";

             graphics = new GraphicsDeviceManager(this);
             graphics.PreferredBackBufferWidth = 640;
             graphics.PreferredBackBufferHeight = 480;
             graphics.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8;
             graphics.IsFullScreen = false;

             screenManager = new ScreenManager(this);
             Components.Add(screenManager);
             screenManager.AddScreen(new BackgroundScreen(), null);
             screenManager.AddScreen(new MainMenuScreen(), null);
        }
        /// <summary>
        /// Activates the loading screen.
        /// </summary>
        public static void Load(ScreenManager screenManager, bool loadingIsSlow, System.Nullable<PlayerIndex> controllingPlayer, params GameScreen[] screensToLoad)
        {
            // Tell all the current screens to transition off.
            foreach (GameScreen screen in screenManager.GetScreens())
            {
                screen.ExitScreen();
            }

            // Create and activate the loading screen.
            LoadingScreen loadingScreen = new LoadingScreen(screenManager, loadingIsSlow, screensToLoad);

            screenManager.AddScreen(loadingScreen, controllingPlayer);
        }
 /// <summary>
 /// Event handler for when the Options menu entry is selected.
 /// </summary>
 private void OptionsMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     ScreenManager.AddScreen(new OptionsMenuScreen(), e.PlayerIndex);
 }