예제 #1
0
        public override void ProcessInput(float elapsedTime, InputManager input)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            int i, j = (int)gameManager.GameMode;

            for (i = 0; i < j; i++)
            {
                // select
                if (input.IsKeyPressed(i, Keys.Enter) || input.IsButtonPressedA(i))
                {
                    gameManager.SetLevel(levels[selection]);
                    screenManager.SetNextScreen(ScreenType.ScreenGame);
                    gameManager.PlaySound("menu_select");
                }

                // cancel
                if (input.IsKeyPressed(i, Keys.Escape) || input.IsButtonPressedB(i))
                {
                    gameManager.SetLevel(null);
                    screenManager.SetNextScreen(ScreenType.ScreenPlayer);
                    gameManager.PlaySound("menu_cancel");
                }

                // change selection (previous)
                if (input.IsKeyPressed(i, Keys.Left) ||
                    input.IsButtonPressedDPadLeft(i) ||
                    input.IsButtonPressedLeftStickLeft(i))
                {
                    if (selection == 0)
                    {
                        selection = levels.GetLength(0) - 1;
                    }
                    else
                    {
                        selection = selection - 1;
                    }
                    gameManager.PlaySound("menu_change");
                }

                // change selection (next)
                if (input.IsKeyPressed(i, Keys.Right) ||
                    input.IsButtonPressedDPadRight(i) ||
                    input.IsButtonPressedLeftStickRight(i))
                {
                    selection = (selection + 1) % levels.GetLength(0);
                    gameManager.PlaySound("menu_change");
                }
            }
        }
예제 #2
0
        public override void ProcessInput(float elapsedTime, InputManager input)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            int i, j = (int)gameManager.GameMode;
            for (i = 0; i < j; i++)
            {
                // select
                if (input.IsKeyPressed(i, Keys.Enter) || input.IsButtonPressedA(i))
                {
                    gameManager.SetLevel(levels[selection]);
                    screenManager.SetNextScreen(ScreenType.ScreenGame);
                    gameManager.PlaySound("menu_select");
                }

                // cancel
                if (input.IsKeyPressed(i, Keys.Escape) || input.IsButtonPressedB(i))
                {
                    gameManager.SetLevel(null);
                    screenManager.SetNextScreen(ScreenType.ScreenPlayer);
                    gameManager.PlaySound("menu_cancel");
                }

                // change selection (previous)
                if (input.IsKeyPressed(i, Keys.Left) ||
                    input.IsButtonPressedDPadLeft(i) ||
                    input.IsButtonPressedLeftStickLeft(i))
                {
                    if (selection == 0)
                        selection = levels.GetLength(0) - 1;
                    else
                        selection = selection - 1;
                    gameManager.PlaySound("menu_change");
                }

                // change selection (next)
                if (input.IsKeyPressed(i, Keys.Right) ||
                    input.IsButtonPressedDPadRight(i) ||
                    input.IsButtonPressedLeftStickRight(i))
                {
                    selection = (selection + 1) % levels.GetLength(0);
                    gameManager.PlaySound("menu_change");
                }
            }
        }