static void Main(string[] args) { const string defaultGameFilename = "Zork.json"; string gameFilename = (args.Length > 0 ? args[(int)CommandLineArguments.GameFilename] : defaultGameFilename); ConsoleOutputService output = new ConsoleOutputService(); ConsoleInputService input = new ConsoleInputService(); Game.StartFromFile(gameFilename, input, output); Game.Instance.CommandManager.PerformCommand(Game.Instance, "LOOK"); while (Game.Instance.IsRunning) { output.Write("\n> "); input.GetInput(); } output.WriteLine("Thank you for playing!"); }
static void Main(string[] args) { const string defaultGameFilename = "Zork.json"; string gameFilename = (args.Length > 0 ? args[(int)CommandLineArguments.GameFilename] : defaultGameFilename); ConsoleOutputService output = new ConsoleOutputService(); ConsoleInputService input = new ConsoleInputService(); Common.Game game = Common.Game.LoadFromFile(gameFilename, output, input); while (game.IsRunning) { output.Write("\n> "); input.ProcessInput(); } output.WriteLine("Thank you for playing!"); }
static void Main(string[] args) { const string defaultGameFilename = "Zork.json"; string gameFilename = (args.Length > 0 ? args[(int)CommandLineArguments.GameFilename] : defaultGameFilename); ConsoleOutputService output = new ConsoleOutputService(); ConsoleInputService input = new ConsoleInputService(); Game game = JsonConvert.DeserializeObject <Game>(File.ReadAllText(gameFilename)); game.Initialize(input, output); while (game.IsRunning) { output.Write("\n>"); input.ProcessInput(); } game.Shutdown(); }