示例#1
0
        /*
         * Инициализация координат
         */
        private static void InitCoordinates()
        {
            var max = GetMaxStringLength();

            startX = (Measurements.GetWindowSizeX() / 2) - (max / 2);
            startY = (Measurements.GetWindowSizeY() / 2) - (length / 2);
        }
示例#2
0
        /*
         * Вывод поля на экран
         */
        public static void WriteTable()
        {
            Console.Clear();
            var startX = (Measurements.GetWindowSizeX() / 2) - (tableSizeX / 2);
            //var startY = (Measurements.windowSizeY / 2) - (tableSizeY / 2);
            var startY = 0;

            ConvertFromPlayerCodesToChar();

            Console.SetCursorPosition(startX, startY);
            Console.Write("   |   |   ");
            Console.SetCursorPosition(startX, startY + 1);
            Console.Write(" " + fielsChar[0, 0] + " | " + fielsChar[1, 0] + " | " + fielsChar[2, 0] + " ");
            Console.SetCursorPosition(startX, startY + 2);
            Console.Write("   |   |   ");
            Console.SetCursorPosition(startX, startY + 3);
            Console.Write("---+---+---");
            Console.SetCursorPosition(startX, startY + 4);
            Console.Write("   |   |   ");
            Console.SetCursorPosition(startX, startY + 5);
            Console.Write(" " + fielsChar[0, 1] + " | " + fielsChar[1, 1] + " | " + fielsChar[2, 1] + " ");
            Console.SetCursorPosition(startX, startY + 6);
            Console.Write("   |   |   ");
            Console.SetCursorPosition(startX, startY + 7);
            Console.Write("---+---+---");
            Console.SetCursorPosition(startX, startY + 8);
            Console.Write("   |   |   ");
            Console.SetCursorPosition(startX, startY + 9);
            Console.Write(" " + fielsChar[0, 2] + " | " + fielsChar[1, 2] + " | " + fielsChar[2, 2] + " ");
            Console.SetCursorPosition(startX, startY + 10);
            Console.Write("   |   |   ");

            ShowWhoseStep.WritePlayersName(isMultiplayer);
        }
        /*
         * Вывод подсказки с адресами ячеек
         */
        public static void WriteTable()
        {
            Console.Clear();
            var startX = (Measurements.GetWindowSizeX() / 2) - (Table.GetTableSizeX() / 2);
            //var startY = (Measurements.windowSizeY / 2) - (tableSizeY / 2);
            var startY = 0;

            Console.SetCursorPosition(startX, startY);
            Console.Write("   |   |   ");
            Console.SetCursorPosition(startX, startY + 1);
            Console.Write(" 7 | 8 | 9 ");
            Console.SetCursorPosition(startX, startY + 2);
            Console.Write("   |   |   ");
            Console.SetCursorPosition(startX, startY + 3);
            Console.Write("---+---+---");
            Console.SetCursorPosition(startX, startY + 4);
            Console.Write("   |   |   ");
            Console.SetCursorPosition(startX, startY + 5);
            Console.Write(" 4 | 5 | 6 ");
            Console.SetCursorPosition(startX, startY + 6);
            Console.Write("   |   |   ");
            Console.SetCursorPosition(startX, startY + 7);
            Console.Write("---+---+---");
            Console.SetCursorPosition(startX, startY + 8);
            Console.Write("   |   |   ");
            Console.SetCursorPosition(startX, startY + 9);
            Console.Write(" 1 | 2 | 3 ");
            Console.SetCursorPosition(startX, startY + 10);
            Console.Write("   |   |   ");
            WriteSuggestionToContinue();
        }
示例#4
0
        /*
         * Вывод предложения для продолжения
         */
        private static void WriteSuggstionForContinue()
        {
            var phrase = "Press any key for continue...";
            var start  = (Measurements.GetWindowSizeX() / 2) - (phrase.Length / 2);

            Console.SetCursorPosition(start, Measurements.GetWindowSizeY() - 3);
            Console.Write(phrase);
        }
        /*
         * Вывод предложения продолжить
         */
        private static void WriteSuggestionToContinue()
        {
            var phrase = "Press enter for continue...";

            Console.SetCursorPosition(
                (Measurements.GetWindowSizeX() / 2) - (phrase.Length / 2),
                (Measurements.GetWindowSizeY() - 1));
            Console.Write(phrase);

            Console.ReadKey();
        }
示例#6
0
 /*
  * Установка размеров окна
  *
  * NOTE: если убрать, две посление строчки,
  * то все будет не правильно отображаться
  */
 private static void SetWindowSize()
 {
     Console.WindowWidth  = Measurements.GetWindowSizeX();
     Console.WindowHeight = Measurements.GetWindowSizeY();
     Console.WindowTop    = 0;
     Console.WindowLeft   = 0;
     Console.BufferWidth  = Measurements.GetWindowSizeX();
     Console.BufferHeight = Measurements.GetWindowSizeY();
     Console.WindowWidth  = Measurements.GetWindowSizeX();
     Console.WindowHeight = Measurements.GetWindowSizeY();
 }
示例#7
0
        /*
         * Вывод поля на экран
         */
        private static void Write()
        {
            Console.Clear();

            for (int y = 0; y < Measurements.GetWindowSizeY(); y++)
            {
                for (int x = 0; x < Measurements.GetWindowSizeX(); x++)
                {
                    Console.BackgroundColor = field[x, y];
                    Console.SetCursorPosition(x, y);
                    Console.Write(" ");
                }
            }

            Console.BackgroundColor = ConsoleColor.Black;
        }
示例#8
0
        public static void WritePlayersName(bool isMultiplayer)
        {
            Console.SetCursorPosition(Measurements.GetWindowSizeX() - 1 - player.Length, 1);
            Console.Write(player);

            if (isMultiplayer)
            {
                Console.SetCursorPosition(1, 1);
                Console.Write(player);
            }
            else
            {
                Console.SetCursorPosition(1, 1);
                Console.Write(computer);
            }

            Console.SetCursorPosition(Measurements.GetWindowSizeX() / 2, Measurements.GetWindowSizeY() - 2);
        }