예제 #1
0
        private static void NewGameDialog()
        {
            Console.WriteLine("What's the name of your farm?");
              string name = Console.ReadLine();
              Enumerations.Difficulty difficulty;

              while (true)
              {
            Console.Clear();
            Console.WriteLine("On what difficulty do you want to play? [easy; medium; hard]");
            string diff = Console.ReadLine();
            try
            {
              difficulty = (Enumerations.Difficulty)Enum.Parse(typeof(Enumerations.Difficulty), diff);
              break;
            }
            catch (Exception ex)
            {
              //Dont use PrintInfoMessage here because _game is not yet initialized.
              Console.Clear();
              Console.WriteLine("Thats not a valid difficulty!");
              Console.ReadKey();
            }
              }

              Game = new Game(name, difficulty);
              Console.WriteLine("Alright, all set up! Enjoy your farm!");
              Console.ReadKey();
              Console.Clear();
        }
예제 #2
0
 private static void LoadGame()
 {
     _game = (Game)_serializer.Deserialize("polenter.xml");
 }