Ejemplo n.º 1
0
        public override void Update(GameTime gameTime)
        {
            GameScreen screen = null;

            try
            {
                var flag1 = usingGamePad;
                usingGamePad = false;
                for (var index = 0; index < input.CurrentGamePadStates.Length; ++index)
                {
                    if (input.CurrentGamePadStates[index].IsConnected)
                    {
                        usingGamePad = true;
                    }
                }
                input.Update();
                screensToUpdate.Clear();
                foreach (var gameScreen in screens)
                {
                    screensToUpdate.Add(gameScreen);
                }
                if (screensToUpdate.Count == 0)
                {
                    foreach (var gameScreen in screens)
                    {
                        screensToUpdate.Add(gameScreen);
                    }
                }
                var otherScreenHasFocus  = !Game.IsActive;
                var coveredByOtherScreen = false;
                var flag2 = false;
                while (screensToUpdate.Count > 0)
                {
                    screen = screensToUpdate[screensToUpdate.Count - 1];
                    screensToUpdate.RemoveAt(screensToUpdate.Count - 1);
                    if (!otherScreenHasFocus &&
                        (screen.ScreenState == ScreenState.TransitionOn || screen.ScreenState == ScreenState.Active))
                    {
                        if (flag1 != usingGamePad)
                        {
                            screen.inputMethodChanged(usingGamePad);
                        }
                        screen.HandleInput(input);
                        flag2 = true;
                    }
                    screen.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
                    if (flag2)
                    {
                        otherScreenHasFocus = true;
                    }
                    if ((screen.ScreenState == ScreenState.TransitionOn || screen.ScreenState == ScreenState.Active) &&
                        !screen.IsPopup)
                    {
                        coveredByOtherScreen = true;
                    }
                }
                if (!TraceEnabled)
                {
                    return;
                }
                TraceScreens();
            }
            catch (Exception ex)
            {
                if (screen == null)
                {
                    return;
                }
                RemoveScreen(screen);
            }
        }
Ejemplo n.º 2
0
        public override void Update(GameTime gameTime)
        {
            GameScreen screen1 = (GameScreen)null;

            try
            {
                bool usingGamePad = this.usingGamePad;
                this.usingGamePad = false;
                for (int index = 0; index < this.input.CurrentGamePadStates.Length; ++index)
                {
                    if (this.input.CurrentGamePadStates[index].IsConnected)
                    {
                        this.usingGamePad = true;
                    }
                }
                this.input.Update();
                this.screensToUpdate.Clear();
                foreach (GameScreen screen2 in this.screens)
                {
                    this.screensToUpdate.Add(screen2);
                }
                if (this.screensToUpdate.Count == 0)
                {
                    foreach (GameScreen screen2 in this.screens)
                    {
                        this.screensToUpdate.Add(screen2);
                    }
                }
                bool otherScreenHasFocus  = !this.Game.IsActive;
                bool coveredByOtherScreen = false;
                bool flag = false;
                while (this.screensToUpdate.Count > 0)
                {
                    screen1 = this.screensToUpdate[this.screensToUpdate.Count - 1];
                    this.screensToUpdate.RemoveAt(this.screensToUpdate.Count - 1);
                    if (!otherScreenHasFocus && (screen1.ScreenState == ScreenState.TransitionOn || screen1.ScreenState == ScreenState.Active))
                    {
                        if (usingGamePad != this.usingGamePad)
                        {
                            screen1.inputMethodChanged(this.usingGamePad);
                        }
                        screen1.HandleInput(this.input);
                        flag = true;
                    }
                    screen1.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
                    if (flag)
                    {
                        otherScreenHasFocus = true;
                    }
                    if ((screen1.ScreenState == ScreenState.TransitionOn || screen1.ScreenState == ScreenState.Active) && !screen1.IsPopup)
                    {
                        coveredByOtherScreen = true;
                    }
                }
                if (!this.traceEnabled)
                {
                    return;
                }
                this.TraceScreens();
            }
            catch (Exception ex)
            {
                if (screen1 == null)
                {
                    return;
                }
                this.RemoveScreen(screen1);
            }
        }