Пример #1
0
        private void MenuAction(int choice, Player customer)
        {
            Console.ForegroundColor = ConsoleColor.Yellow;

            switch (choice)
            {
                case 1:
                    WeaponAvailableForSell(customer);
                    break;
                case 2:
                    ArmorsAvaliableForSell(customer);
                    break;
                case 3:
                    SpecialItemsAvaliableForSell(customer);
                    break;
                case 4:
                    SellItems(customer);
                    break;
                case 5:
                    Console.Clear();
                    PrintDesign.WriteLineInYellow("Thank you for visiting the shop! Welcome back anytime.");
                    break;
                default:
                    break;
            }
        }
Пример #2
0
        public void ShopMenu(Player customer)
        {
            int choice;
            bool parseSuccessfull;
            Console.Clear();
            PrintDesign.WriteLineInYellow("Welcome to the shop!");
            do
            {

                PrintDesign.WriteLineInYellow("1. Show weapons for sale");
                PrintDesign.WriteLineInYellow("2. Show armor for sale");
                PrintDesign.WriteLineInYellow("3. Show special items for sale");
                PrintDesign.WriteLineInYellow("4. Sell items");
                PrintDesign.WriteLineInYellow("5. Back to main menu");
                parseSuccessfull = int.TryParse(Console.ReadLine(), out choice);

                if (parseSuccessfull == false)
                {
                    Console.Clear();
                    PrintDesign.WriteLineInRed("Something went wrong! Try again.");
                }

                if (choice > 5)
                {
                    Console.Clear();
                    PrintDesign.WriteLineInRed("Number to high, choose a number between 1 and 5.");
                }
                else if (choice <= 0)
                {
                    Console.Clear();
                    PrintDesign.WriteLineInRed("Number to low, choose a number between 1 and 5.");
                }

                MenuAction(choice, customer);

            } while (choice != 5);

            Console.ForegroundColor = ConsoleColor.White;


        }