Exemplo n.º 1
0
        public void Update(GameTime gameTime)
        {
            var gamepad = GamePad.GetState(PlayerIndex.One);

            buttonSettings.Update(gameTime);

            var state = Keyboard.GetState();

            if (state.IsKeyDown(Keys.Up) && oldState.IsKeyUp(Keys.Up) || gamepad.IsButtonDown(Buttons.LeftThumbstickUp) && oldGamepadState.IsButtonUp(Buttons.LeftThumbstickUp))
            {
                if ((SelectedOption - 1) >= 0)
                {
                    SelectedOption -= 1;
                }
            }
            else if (state.IsKeyDown(Keys.Down) && oldState.IsKeyUp(Keys.Down) || gamepad.IsButtonDown(Buttons.LeftThumbstickDown) && oldGamepadState.IsButtonUp(Buttons.LeftThumbstickDown))
            {
                if ((SelectedOption + 1) <= MenuItemsCount)
                {
                    SelectedOption += 1;
                }
            }


            if (state.IsKeyDown(Keys.Enter) && oldState.IsKeyUp(Keys.Enter) || gamepad.IsButtonDown(Buttons.B) && oldGamepadState.IsButtonUp(Buttons.B))
            {
                switch (SelectedOption)
                {
                case 0:
                    mgInstance.Volume = 0.25f;
                    GameManager.Game.ChangeScreen(new MainGameScreen());
                    break;

                case 1:
                    //mgInstance.Volume = 0.25f;
                    //GameManager.Game.ChangeScreen(new JoinCOOPGameScreen());
                    break;

                case 2:
                    Environment.Exit(0);
                    break;
                }
            }

            oldState        = state;
            oldGamepadState = gamepad;
        }