private Dictionary<string, Response> _responses; //responses to commands #endregion Fields #region Constructors /// Initialize the command response mapping public CommandMapper(Game game) { _responses = new Dictionary<string, Response>(); Response[] resp = { new QuitCommand(), new HelpCommand(_responses, this), new StatsCommand (game), new GearCommand (game), new PlayerCommand (game), new DiceCommand (), new DisplayCommand(game), new ChangeCommand(game), new ClearCommand(), new SaveCommand(game), new ResetCommand() }; AllCommands = ""; foreach (Response r in resp) { _responses[r.CommandName] = r; AllCommands += r.CommandName + " "; } }
public bool Execute(Command command) { Console.Clear(); Game game = new Game(); //creates and plays new game game.play(); return false; }
public PlayerCommand(Game game) { CommandName = "player"; this._game = game; }
public SaveCommand(Game game) { this._game = game; CommandName = "save"; }
public StatsCommand(Game game) { CommandName = "stats"; this._game = game; }
public ChangeCommand(Game game) { CommandName = "change"; this._game = game; }
public Loader(Game game) { this._game = game; }
static int Main() { Console.SetWindowSize(Console.LargestWindowWidth - 5, Console.LargestWindowHeight - 5); Console.ForegroundColor = ConsoleColor.Yellow; Game _game = new Game(); _game.play(); return 0; }
public DisplayCommand(Game game) { CommandName = "display"; this._game = game; }
public GearCommand(Game game) { CommandName = "gear"; this._game = game; }