コード例 #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!");
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: BrotherMutton/Zork
        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();
        }
コード例 #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!");
        }
コード例 #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!");
        }
コード例 #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();
        }