Exemplo n.º 1
0
        // STARTS THE HIGH SCORES BOARD
        public static void Initialize()
        {
            List <string> allScores = GetAllScores();

            string[] currentScoreAndName;

            DrawItem.Draw(10, 0, "\n" + "                         HIGH SCORES:" + "\n");
            DrawItem.Draw(10, 3, "*========================================*");

            int linesNumber = (allScores.Count > 30) ? 30 : allScores.Count;

            for (int index = 0; index < allScores.Count; index++)
            {
                currentScoreAndName = allScores[index].Split(new char[] { '|' });

                string scores = "";

                if (currentScoreAndName[0] != "0000")
                {
                    scores = currentScoreAndName[0].TrimStart('0');
                }
                else
                {
                    scores = "0";
                }

                string lineString = String.Format("* Player {0}: {1}", currentScoreAndName[1], scores);
                DrawItem.Draw(10, 4 + index, lineString);
                DrawItem.Draw(51, 4 + index, "*");
            }

            if (allScores.Count < 5)
            {
                int emptyRows = 5 - allScores.Count;
                while (emptyRows != 0)
                {
                    DrawItem.Draw(10, 4 + (5 - emptyRows), "*");
                    DrawItem.Draw(51, 4 + (5 - emptyRows), "*");
                    emptyRows--;
                }
            }

            Console.WriteLine("\n" + "          *========================================*");

            DrawItem.Draw(25, WindowsSettings.WIN_HEIGHT - 4, "Click ESC to return");

            bool commandCorrect = false;

            while (!commandCorrect)
            {
                ConsoleKeyInfo pressedKey = Console.ReadKey(true);

                if (pressedKey.Key == ConsoleKey.Escape)
                {
                    Console.Clear();
                    StartMenu.Initialize();
                    commandCorrect = true;
                }
            }
        }
Exemplo n.º 2
0
        // READS THE STATISTICS of the HIGH Scores
        public static void ShowHighScores(ConsoleColor textcolor = ConsoleColor.White)
        {
            try
            {
                List <string> fiveTopPlayers = GetHighScores();

                string[] currentScoreAndName;

                // PRINTS TOP 5 PLAYERS w. HIGH SCORES

                DrawItem.Draw(10, 0, "\n" + "                         HIGH SCORES:" + "\n", textcolor);
                DrawItem.Draw(10, 3, "*========================================*", textcolor);

                for (int index = 0; index < fiveTopPlayers.Count; index++)
                {
                    currentScoreAndName = fiveTopPlayers[index].Split(new char[] { '|' });

                    string scores = "";

                    if (currentScoreAndName[0] != "0000")
                    {
                        scores = currentScoreAndName[0].TrimStart('0');
                    }
                    else
                    {
                        scores = "0";
                    }

                    string lineString = String.Format("* Player {0}: {1}", currentScoreAndName[1], scores);
                    DrawItem.Draw(10, 4 + index, lineString, textcolor);
                    DrawItem.Draw(51, 4 + index, "*", textcolor);
                }

                if (fiveTopPlayers.Count < 5)
                {
                    int emptyRows = 5 - fiveTopPlayers.Count;
                    while (emptyRows != 0)
                    {
                        DrawItem.Draw(10, 4 + (5 - emptyRows), "*", textcolor);
                        DrawItem.Draw(51, 4 + (5 - emptyRows), "*", textcolor);
                        emptyRows--;
                    }
                }

                Console.WriteLine("\n" + "          *========================================*", textcolor);
            }
            catch (IOException IOError)
            {
                Console.WriteLine(IOError.Message);
            }
            catch (OutOfMemoryException memoryError)
            {
                Console.WriteLine(memoryError.Message);
            }
            catch (Exception another)
            {
                Console.WriteLine(another.Message);
            }
        }
Exemplo n.º 3
0
        public static void Initialize()
        {
            for (int row = 0; row < WindowsSettings.INFO_AREA_HEIGHT; row++)
            {
                DrawItem.Draw(WindowsSettings.INFO_AREA_WIDTH, row, SYMBOL);
            }

            DrawItem.Draw(WindowsSettings.INFO_AREA_WIDTH + 2, 4, "Press M to Mute!");
            DrawItem.Draw(WindowsSettings.INFO_AREA_WIDTH + 2, 6, "Press P for Pause!");
            DrawItem.Draw(WindowsSettings.INFO_AREA_WIDTH + 2, 8, "Press ESC to quit!");
            // DrawItem.Draw(WindowsSettings.INFO_AREA_WIDTH + 2, 44, "Time: " + StartGame.secondsToGameOver);
            DrawItem.Draw(WindowsSettings.INFO_AREA_WIDTH + 2, 21, "Scores: " + Scores.currentScores);
            // DrawItem.Draw(WindowsSettings.INFO_AREA_WIDTH + 2, 26, "Level: 1");

            //   DrawItem.Draw(WindowsSettings.INFO_AREA_WIDTH + 2, 20, "Life Points: " + IPlayer.playerLife);


            for (int col = 0; col < WindowsSettings.INFO_AREA_WIDTH; col++)
            {
                DrawItem.Draw(col, WindowsSettings.INFO_AREA_HEIGHT - 3, SYMBOL_QUESTION_AREA);
            }
            //  DrawItem.Draw(1,  WindowsSettings.INFO_AREA_HEIGHT-2, "Please answer the question: " + Questions.question);
        }