Example #1
0
        public static void HeroSelectMenu(List <string> playerNames)
        {
            var playerNamesAndHeroes = new Dictionary <string, string>();

            for (int i = 0; i < playerNames.Count; i++)
            {
                var title    = $"WHAT TYPE OF HERO WILL YOU CHOOSE FOR {playerNames[i]}?";
                var warrior  = "WARRIOR";
                var mage     = "MAGE";
                var priest   = "PRIEST";
                var heroType = MenuDrawer.DrawMenu(new List <string>()
                {
                    title, warrior, mage, priest
                });
                playerNamesAndHeroes[playerNames[i]] = heroType;
            }
            CharacterCreation.SelectHeroClass(playerNamesAndHeroes);
        }
Example #2
0
        public void DoAction(string action)
        {
            if (action == MenuActions.NEW.ToString())
            {
                TypesOfMenu.NewGameMenu();
            }
            else if (action == MenuActions.INSTRUCTIONS.ToString())
            {
                InstructionsWriter.WriteInstructions();
                TypesOfMenu.StartMenu();
            }

            else if (action == MenuActions.BEERS.ToString())
            {
                Console.Clear();
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("ENTER PLAYER'S NAME TO RECEIVE HIS BEER EARNINGS:");
                Battle4BeersDbContext db = new Battle4BeersDbContext();
                var nameReader           = Console.ReadLine();
                var player = db.Players.FirstOrDefault(p => p.Name == nameReader);
                var key    = new ConsoleKeyInfo();
                while (key.Key != ConsoleKey.Enter)
                {
                    if (player != null)
                    {
                        var namesWithBeers = new SortedDictionary <string, int>();
                        foreach (var beer in player.BeersToBeTaken)
                        {
                            var loserName = beer.Loser.Name;
                            if (!namesWithBeers.ContainsKey(loserName))
                            {
                                namesWithBeers[loserName] = 0;
                            }
                            namesWithBeers[loserName]++;
                        }
                        if (namesWithBeers.Count > 0)
                        {
                            foreach (var nameWithBeers in namesWithBeers.Reverse())
                            {
                                if (nameWithBeers.Value <= 1)
                                {
                                    Console.WriteLine($"-----   {nameWithBeers.Key} owns {nameWithBeers.Value} beer   -----");
                                }
                                else
                                {
                                    Console.WriteLine($"-----   {nameWithBeers.Key} owns {nameWithBeers.Value} beers   -----");
                                }
                            }
                        }
                        else
                        {
                            Console.WriteLine("Player has not earned any beers yet!");
                        }
                    }
                    else
                    {
                        Console.WriteLine("Player does not exist!");
                        Pause(3);
                    }
                    Console.WriteLine("...PRESS ENTER TO GO BACK TO MAIN MENU...");
                    key = Console.ReadKey();
                }
                TypesOfMenu.StartMenu();
            }

            //--> TERMINATES PROGRAM <--
            else if (action == MenuActions.QUIT.ToString())
            {
                Environment.Exit(0);
            }

            else if (action == MenuActions.DUEL.ToString() || action == MenuActions.ARENA.ToString())
            {
                CharacterCreation.TypeNames(action);
            }
        }