Пример #1
0
        public static void Action_1(PokemonManager manager)
        {
            while (true)
            {
                Console.WriteLine("你选择:1.探索 2.查看图鉴");
                int n = InputKeyInfo_ToInt(Console.ReadKey());
                if (!(n == 1 || n == 2))
                {
                    continue;
                }
                switch (n)
                {
                case 1:
                    int r = Tool.random.Next(1, 3);
                    if (r == 1)
                    {
                        var pokemon = CreateRandomPokemon();
                        Console.WriteLine("你遇到了:等级{0} {1}", pokemon.Level, pokemon.Name);
                        Action_2(manager, pokemon);
                        continue;
                    }
                    Console.WriteLine("你什么都没遇到");
                    continue;

                case 2:

                    PokemonManager.PrintAllPokemon(manager.dictionary);
                    Action_3(manager);
                    continue;
                }
            }
        }
Пример #2
0
 public static void AddPokemon(PokemonManager manager, Pokemon pokemon)
 {
     while (manager.dictionary.ContainsKey(manager.Serial))
     {
         manager.Serial++;
     }
     pokemon.Serial = manager.Serial;
     manager.dictionary.Add(manager.Serial, pokemon);
     manager.Serial = 1;
 }
Пример #3
0
 public static void Action_3(PokemonManager manager)
 {
     while (true)
     {
         Console.WriteLine("你选择:1.按序号查找小精灵 2.按名字查找小精灵 3.按等级查找小精灵");
         int n = InputKeyInfo_ToInt(Console.ReadKey());
         if (!(n == 1 || n == 2 || n == 3))
         {
             continue;
         }
         if (n == 1)
         {
             Console.WriteLine("请输入小精灵的序号:");
             int input;
             if (int.TryParse(Console.ReadLine(), out input))
             {
                 PokemonManager.CheckPokemon_FromKey(manager.dictionary, input);
                 Action_4(manager);
                 return;
             }
             else
             {
                 Console.WriteLine("输入错误");
                 continue;
             }
         }
         else if (n == 3)
         {
             Console.WriteLine("请输入小精灵的等级:");
             if (int.TryParse(Console.ReadLine(), out int input))
             {
                 PokemonManager.CheckPokemon_FromValue(manager.dictionary, input);
                 Action_4(manager);
                 return;
             }
             Console.WriteLine("输入错误");
             continue;
         }
         else
         {
             Console.WriteLine("请输入小精灵的名字:");
             PokemonManager.CheckPokemon_FromValue(manager.dictionary, Console.ReadLine());
             Action_4(manager);
             return;
         }
     }
 }
Пример #4
0
        static void Main(string[] args)
        {
            var Initial_Pokemon = CreateRandomPokemon();
            var manager         = new PokemonManager();

            PokemonManager.AddPokemon(manager, Initial_Pokemon);
            Console.WriteLine("欢迎来到宠物小精灵世界,获得你的初始小精灵");
            Console.WriteLine("恭喜你获得了:等级{0} {1}", Initial_Pokemon.Level, Initial_Pokemon.Name);
            Console.WriteLine("-------------------------------------------------");
            Action_1(manager);


            //PokemonManager.PrintAllPokemon(manager.dictionary);


            Console.ReadKey();
        }
Пример #5
0
 public static void Action_2(PokemonManager manager, Pokemon pokemon)
 {
     while (true)
     {
         Console.WriteLine("你选择:1.收服 2.离开");
         int n = InputKeyInfo_ToInt(Console.ReadKey());
         if (!(n == 1 || n == 2))
         {
             continue;
         }
         if (n == 1)
         {
             PokemonManager.AddPokemon(manager, pokemon);
             Console.WriteLine("你成功收服了:等级{0} {1}", pokemon.Level, pokemon.Name);
             return;
         }
         Console.WriteLine("你嫌它太丑,离开了...");
         return;
     }
 }
Пример #6
0
 public static void Action_4(PokemonManager manager)
 {
     while (true)
     {
         Console.WriteLine("你选择:1.放生小精灵 2.离开");
         int n = InputKeyInfo_ToInt(Console.ReadKey());
         if (n == 1)
         {
             Console.WriteLine("请输入小精灵的序号:");
             if (int.TryParse(Console.ReadLine(), out int input))
             {
                 Console.WriteLine("你放生了:等级{0} {1}", manager.dictionary[input].Level, manager.dictionary[input].Name);
                 PokemonManager.RemovePokemon(manager.dictionary, input);
                 return;
             }
             Console.WriteLine("输入错误");
             continue;
         }
         return;
     }
 }