예제 #1
0
        public void MainMenu()
        {
            HashSet <string> flowNum = new HashSet <string> {
                "1", "2", "3", "4", "5"
            };

            Console.WriteLine(" ========== ");
            Console.WriteLine("What would you like to do?");
            Console.WriteLine("1 = show current status  /  2 = show inventory again  /  3 = equip weapon  /  4 = equip armor  /  5 = everything's done");
            string choice = ChooseNext(flowNum);

            while (!flowNum.Contains(choice))
            {
                Console.WriteLine("Choose the right number and press ENTER.");
                Console.WriteLine("");
                choice = ChooseNext(flowNum);
            }

            while (choice != "5" && flowNum.Contains(choice))
            {
                switch (choice)
                {
                case "1":
                    Hero.ShowStats();
                    break;

                case "2":
                    Hero.ShowInventory();
                    break;

                case "3":
                    Hero.EquipWeapon();
                    break;

                case "4":
                    Hero.EquipArmor();
                    break;
                }

                Console.WriteLine("");
                Console.WriteLine(" ========== ");
                Console.WriteLine("What would you like to do?");
                Console.WriteLine("1 = show current status  /  2 = show inventory again  /  3 = equip weapon  /  4 = equip armor  /  5 = everything's done");
                choice = ChooseNext(flowNum);
            }

            if (choice == "5")
            {
                if (Hero.EquippedWeapon == null || Hero.EquippedArmor == null)
                {
                    if (Hero.EquippedWeapon == null && Hero.EquippedArmor == null)
                    {
                        Console.WriteLine("You're bare naked with no weapons!!");
                        Hero.EquipWeapon();
                        Hero.EquipArmor();
                    }

                    if (Hero.EquippedWeapon == null)
                    {
                        Hero.EquipWeapon();
                    }

                    if (Hero.EquippedArmor == null)
                    {
                        Hero.EquipArmor();
                    }
                }
            }

            Console.WriteLine("");
            Console.WriteLine($"{ Hero.Name } - let's fight!!");
            Console.WriteLine("---------------------");
            Console.WriteLine("");
        }