Exemplo n.º 1
0
        private static void PrintLastLine()
        {
            ConsoleOutput.PrintLine(string.Format(
                "\nExcellent! You suceeded to end your game for the given {0} moves.",
                givenMaximumAllowedTurns));
            ConsoleOutput.PrintField(bombArea);
            ConsoleOutput.PrintLine("Please write your nickname: ");

            string imeee = Console.ReadLine();
            Highscore highscoresList = new Highscore(imeee, counter);
            highscoreList.Add(highscoresList);
            HighscoresList(highscoreList);

            InputValues();
        }
Exemplo n.º 2
0
        private static void EndCurrentGame()
        {
            ConsoleOutput.PrintField(bombArea);
            ConsoleOutput.Print(string.Format(
                "\nYou ended the game with {0} points. Please give your nickname: ",
                counter));

            string inputName = Console.ReadLine();

            Highscore currentPlayer = new Highscore(inputName, counter);

            if (highscoreList.Count < 5)
            {
                highscoreList.Add(currentPlayer);
            }
            else
            {
                for (int i = 0; i < highscoreList.Count; i++)
                {
                    if (highscoreList[i].Points < currentPlayer.Points)
                    {
                        highscoreList.Insert(i, currentPlayer);
                        highscoreList.RemoveAt(highscoreList.Count - 1);

                        break;
                    }
                }
            }

            highscoreList.Sort((Highscore r1, Highscore r2) => r2.Name.CompareTo(r1.Name));
            highscoreList.Sort((Highscore r1, Highscore r2) => r2.Points.CompareTo(r1.Points));

            HighscoresList(highscoreList);

            InputValues();
        }