示例#1
0
        /// <summary>
        /// Adds a new screen to the screen manager.
        /// </summary>
        /// <param name="screen">Screen to add</param>
        public void AddScreen(GameScreen screen)
        {
            screen.ScreenManager = this;
            screen.InputManager = this.InputManager;

            screen.Initialize();

            // If we have a graphics device, tell the screen to load content.
            if (_graphicsDeviceService != null && _graphicsDeviceService.GraphicsDevice != null)
                screen.LoadContent(new ContentManager(Game.Services, "Content"));

            lock (_screens)
                _screens.Add(screen);

            // Process post actions
            screen.AfterScreenIsAdded();
        }