コード例 #1
0
 /// <summary>
 /// Constructs a new menu entry with the specified text and location.
 /// </summary>
 public MenuEntry(MenuScreen screen, string text, Vector2 position)
 {
     this.screen = screen;
     this.Text = text;
     this.position = position;
     this.font = screen.ScreenManager.GameContent.gameFont;
 }
コード例 #2
0
        /// <summary>
        /// The constructor is private: loading screens should
        /// be activated via the static Load method instead.
        /// </summary>
        private LoadingScreen(ScreenManager screenManager, bool loadingIsSlow,
            GameScreen[] screensToLoad)
        {
            this.loadingIsSlow = loadingIsSlow;
            this.screensToLoad = screensToLoad;

            TransitionOnTime = TimeSpan.FromSeconds(0.5);
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        public PauseMenuScreen(GameScreen screen)
            : base()
        {
            // Flag that there is no need for the game to transition
            // off when the pause menu is on top of it.
            IsPopup = true;

            this.screen = screen;
        }
コード例 #4
0
        /// <summary>
        /// The constructor is private: loading screens should
        /// be activated via the static Load method instead.
        /// </summary>
        private LoadingScreen(ScreenManager screenManager, bool loadingIsSlow,
            GameScreen[] screensToLoad)
        {
            this.loadingIsSlow = loadingIsSlow;
            this.screensToLoad = screensToLoad;

            if (loadingIsSlow)
            {
                TransitionOnTime = TimeSpan.FromSeconds(.1);
                TransitionOffTime = TimeSpan.FromSeconds(2);
            }
            else TransitionOnTime = TimeSpan.FromSeconds(.1);
        }
コード例 #5
0
        /// <summary>
        /// Adds a new screen to the screen manager.
        /// </summary>
        public void AddScreen(GameScreen screen, PlayerIndex? controllingPlayer)
        {
            screen.ControllingPlayer = controllingPlayer;
            screen.ScreenManager = this;
            screen.IsExiting = false;

            // If we have a graphics device, tell the screen to load content.
            if (isInitialized)
            {
                screen.LoadContent();
            }

            screens.Add(screen);
        }
コード例 #6
0
        /// <summary>
        /// Adds a new screen to the screen manager.
        /// </summary>
        public void AddScreen(GameScreen screen, PlayerIndex? controllingPlayer)
        {
            screen.ControllingPlayer = controllingPlayer;
            screen.ScreenManager = this;
            screen.IsExiting = false;

            // If we have a graphics device, tell the screen to load content.
            if (isInitialized)
            {
                screen.LoadContent();
            }

            screens.Add(screen);

            // update the TouchPanel to respond to gestures this screen is interested in
            TouchPanel.EnabledGestures = screen.EnabledGestures;
        }
コード例 #7
0
        /// <summary>
        /// Removes a screen from the screen manager. You should normally
        /// use GameScreen.ExitScreen instead of calling this directly, so
        /// the screen can gradually transition off rather than just being
        /// instantly removed.
        /// </summary>
        public void RemoveScreen(GameScreen screen)
        {
            // If we have a graphics device, tell the screen to unload content.
            if (isInitialized)
            {
                screen.UnloadContent();
            }

            screens.Remove(screen);
            screensToUpdate.Remove(screen);

            // if there is a screen still in the manager, update TouchPanel
            // to respond to gestures that screen is interested in.
            if (screens.Count > 0)
            {
                TouchPanel.EnabledGestures = screens[screens.Count - 1].EnabledGestures;
            }
        }
コード例 #8
0
 /// <summary>
 /// Constructs a new menu entry with the specified texture and location.
 /// </summary>
 public MenuEntry(Texture2D texture, Vector2 position, GameScreen screen)
     : this(string.Empty, position, screen)
 {
     this.texture = texture;
 }
コード例 #9
0
 /// <summary>
 /// Constructs a new menu entry with the specified text and location.
 /// </summary>
 public MenuEntry(string text, Vector2 position, GameScreen screen)
 {
     this.screen = screen;
     this.text = text;
     this.position = position;
 }
コード例 #10
0
        /// <summary>
        /// Removes a screen from the screen manager. You should normally
        /// use GameScreen.ExitScreen instead of calling this directly, so
        /// the screen can gradually transition off rather than just being
        /// instantly removed.
        /// </summary>
        public void RemoveScreen(GameScreen screen)
        {
            // If we have a graphics device, tell the screen to unload content.
            if (isInitialized)
            {
                screen.UnloadContent();
            }

            screens.Remove(screen);
            screensToUpdate.Remove(screen);
        }