Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            const string defaultGameFilename = "Zork.json";
            string       gameFilename        = (args.Length > 0 ? args[(int)CommandLineArguments.GameFilename] : defaultGameFilename);

            ConsoleOutputService output = new ConsoleOutputService();

            Game.StartFromFile(gameFilename, output);
            Console.WriteLine("Thank you for playing!");
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            const string defaultGameFilename = "Zork.json";
            string       gameFilename        = (args.Length > 0 ? args[(int)CommandLineArguments.GameFilename] : defaultGameFilename);

            ConsoleOutputService outputService = new ConsoleOutputService();
            Game game = JsonConvert.DeserializeObject <Game>(File.ReadAllText(gameFilename));

            game.Output = outputService;
            game.Run();
        }
Ejemplo n.º 3
0
        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!");
        }
Ejemplo n.º 4
0
        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!");
        }
Ejemplo n.º 5
0
        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();
        }