Ejemplo n.º 1
0
        private static void GameOver(Player p1, Player p2)
        {
            /*********************************************************/
            bool winP1 = p2.Loose(p1.piece.positionsOnBoard);
            bool winP2 = p1.Loose(p2.piece.positionsOnBoard);

            if (winP1 || winP2)
            {
                Console.Clear();
                Console.SetCursorPosition(0, 0);
                Console.ForegroundColor = ConsoleColor.Yellow;
                PrintTextFileToConsole(WinMsg);
                if (winP1)
                {
                    Console.ForegroundColor = p1.piece.PiecesColor;
                    Console.SetCursorPosition((WindowWidth - p1.Name.Length) / 2, 0);
                    Console.Write("{0} wins!", p1.Name);
                }

                if (winP2)
                {
                    Console.ForegroundColor = p2.piece.PiecesColor;
                    Console.SetCursorPosition((WindowWidth - p2.Name.Length) / 2, 0);
                    Console.Write("{0} wins!", p2.Name);
                }

                PlaySound(WinSound, false, soundON, 1350);
                Console.ReadLine();
                Console.Clear();
                cursorCurrentRow = defaultCursorStartRow;
                option           = 1;
                StartMenu();
                // да се измисли нещо за изход
            }
            /*********************************************************/
        }
Ejemplo n.º 2
0
        private static void GameOver(Player p1, Player p2)
        {
            /*********************************************************/
            bool winP1 = p2.Loose(p1.piece.positionsOnBoard);
            bool winP2 = p1.Loose(p2.piece.positionsOnBoard);
            if (winP1 || winP2)
            {
                Console.Clear();
                Console.SetCursorPosition(0, 0);
                Console.ForegroundColor = ConsoleColor.Yellow;
                PrintTextFileToConsole(WinMsg);
                if (winP1)
                {
                    Console.ForegroundColor = p1.piece.PiecesColor;
                    Console.SetCursorPosition((WindowWidth - p1.Name.Length) / 2, 0);
                    Console.Write("{0} wins!", p1.Name);
                }

                if (winP2)
                {
                    Console.ForegroundColor = p2.piece.PiecesColor;
                    Console.SetCursorPosition((WindowWidth - p2.Name.Length) / 2, 0);
                    Console.Write("{0} wins!", p2.Name);
                }

                PlaySound(WinSound, false, soundON, 1350);
                Console.ReadLine();
                Console.Clear();
                cursorCurrentRow = defaultCursorStartRow;
                option = 1;
                StartMenu();
                // да се измисли нещо за изход
            }
            /*********************************************************/
        }