示例#1
0
        public override void HandleInput(InputState inputState)
        {
            base.HandleInput(inputState);
            if (inputState.IsKeyNewPressed(Keys.Up))
            {
                _mainMenu.GoUp();
            }
            else if (inputState.IsKeyNewPressed(Keys.Down))
            {
                _mainMenu.GoDown();
            }
            else if (inputState.IsKeyNewPressed(Keys.Enter))
            {
                _mainMenu.PressItem();
            }
            else if (inputState.IsKeyNewPressed(Keys.T))
            {
                screenManager.AddScreen(new MapGeneratorTestScreen());
            }

            for (int i = 0; i < 4; i++)
            {
                inputState.ActivePlayerIndex = (PlayerIndex)i;
                if (inputState.GetLeftStickPosition().Y == 1)
                {
                    _mainMenu.GoUp();
                }
                else if (inputState.GetLeftStickPosition().Y < -0.5f)
                {
                    _mainMenu.GoDown();
                }
                else if (inputState.IsButtonNewPressed(Buttons.Start))
                {
                    _mainMenu.PressItem();
                }
            }

            if (_mainMenu.PressedItem.text == "Play Local Multiplayer")
            {
                screenManager.AddScreen(new PlayerSelectScreen());
            }
            else if (_mainMenu.PressedItem.text == "Quit Game")
            {
                screenManager.Game.Exit();
            }
        }