コード例 #1
0
        private Dictionary <Type, ICommand> GetButtonMappings(IGameState gameState)
        {
            OptionGameState gameStateCast = (OptionGameState)gameState;

            return(new Dictionary <Type, ICommand>
            {
                { typeof(AcceptButton), new StartGameCommand(gameState) },
                { typeof(SinglePlayerButton), new ToggleButtonCommand(gameStateCast.OptionMenu, typeof(SinglePlayerButton)) },
                { typeof(TwoPlayerButton), new ToggleButtonCommand(gameStateCast.OptionMenu, typeof(TwoPlayerButton)) },
                { typeof(JojoButton), new ToggleButtonCommand(gameStateCast.OptionMenu, typeof(JojoButton)) },
                { typeof(YakuzaButton), new ToggleButtonCommand(gameStateCast.OptionMenu, typeof(YakuzaButton)) },
                { typeof(PokemonButton), new ToggleButtonCommand(gameStateCast.OptionMenu, typeof(PokemonButton)) },
                { typeof(NormalButton), new ToggleButtonCommand(gameStateCast.OptionMenu, typeof(NormalButton)) },
                { typeof(BackButton), new MainMenuCommand(gameState) }
            });
        }
コード例 #2
0
        private Dictionary <Buttons, ICommand> GetGamepadMappings(IGameState gameState)
        {
            OptionGameState gameStateCast = (OptionGameState)gameState;

            return(new Dictionary <Buttons, ICommand>
            {
                { Buttons.LeftThumbstickUp, new MoveSelectorCommand(gameStateCast.OptionMenu, Constants.Direction.Up) },
                { Buttons.LeftThumbstickRight, new MoveSelectorCommand(gameStateCast.OptionMenu, Constants.Direction.Right) },
                { Buttons.LeftThumbstickDown, new MoveSelectorCommand(gameStateCast.OptionMenu, Constants.Direction.Down) },
                { Buttons.LeftThumbstickLeft, new MoveSelectorCommand(gameStateCast.OptionMenu, Constants.Direction.Left) },
                { Buttons.DPadUp, new MoveSelectorCommand(gameStateCast.OptionMenu, Constants.Direction.Up) },
                { Buttons.DPadRight, new MoveSelectorCommand(gameStateCast.OptionMenu, Constants.Direction.Right) },
                { Buttons.DPadDown, new MoveSelectorCommand(gameStateCast.OptionMenu, Constants.Direction.Down) },
                { Buttons.DPadLeft, new MoveSelectorCommand(gameStateCast.OptionMenu, Constants.Direction.Left) },
                { Buttons.A, new SelectButtonCommand(gameStateCast.OptionMenu.ButtonSelector, GetButtonMappings(gameState)) }
            });
        }
コード例 #3
0
        public Dictionary <Keys, ICommand> GetKeyboardMappings(IGameState gameState)
        {
            OptionGameState gameStateCast = (OptionGameState)gameState;

            return(new Dictionary <Keys, ICommand>
            {
                { Keys.Escape, new MainMenuCommand(gameState) },
                { Keys.W, new MoveSelectorCommand(gameStateCast.OptionMenu, Constants.Direction.Up) },
                { Keys.D, new MoveSelectorCommand(gameStateCast.OptionMenu, Constants.Direction.Right) },
                { Keys.S, new MoveSelectorCommand(gameStateCast.OptionMenu, Constants.Direction.Down) },
                { Keys.A, new MoveSelectorCommand(gameStateCast.OptionMenu, Constants.Direction.Left) },
                { Keys.I, new MoveSelectorCommand(gameStateCast.OptionMenu, Constants.Direction.Up) },
                { Keys.L, new MoveSelectorCommand(gameStateCast.OptionMenu, Constants.Direction.Right) },
                { Keys.K, new MoveSelectorCommand(gameStateCast.OptionMenu, Constants.Direction.Down) },
                { Keys.J, new MoveSelectorCommand(gameStateCast.OptionMenu, Constants.Direction.Left) },
                { Keys.Enter, new SelectButtonCommand(gameStateCast.OptionMenu.ButtonSelector, GetButtonMappings(gameState)) },
                { Keys.Space, new SelectButtonCommand(gameStateCast.OptionMenu.ButtonSelector, GetButtonMappings(gameState)) }
            });
        }