示例#1
0
        static void Main(string[] args)
        {
            GameState game = new GameState();

            player.SetName();
            game.Run();
            while (true)
            {
                player.Draw();
                ConsoleKeyInfo consoleKeyInfo = Console.ReadKey();
                if (consoleKeyInfo.Key == ConsoleKey.F2)
                {
                    Serialize(game);
                }
                else if (consoleKeyInfo.Key == ConsoleKey.F3)
                {
                    game.Stop();
                    game = Deserialize();
                    game.Run();
                }
                else
                {
                    game.ProcessKeyEvent(consoleKeyInfo);
                }
            }
        }
示例#2
0
 public GameState()
 {
     Console.SetWindowSize(40, 42);
     Console.SetBufferSize(40, 42);
     Console.CursorVisible = false;
     player.SetName();
 }