Пример #1
0
        /// <summary>
        /// Updates the screens managed by the screenManager.
        /// </summary>
        /// <param name="gameTime">Represents the time of the game.</param>
        public override void Update(GameTime gameTime)
        {
            screensToUpdate.Clear();
            foreach (GameScreen screen in screens)
            {
                if (!screen.IsFrozen)
                {
                    screensToUpdate.Add(screen);
                }
            }

            if (screensToUpdate.Count == 0)
            {
                GameScreen screen = screens.FindLast(delegate(GameScreen g) { return(g.IsFrozen); });
                if (screen != null)
                {
                    screen.UnfreezeScreen();
                }
                screensToUpdate.Add(screen);
            }
            else
            {
                while (screensToUpdate.Count > 0)
                {
                    GameScreen screen = screensToUpdate[screensToUpdate.Count - 1];
                    screensToUpdate.RemoveAt(screensToUpdate.Count - 1);
                    screen.Update(gameTime);
                }
            }
        }