Esempio n. 1
0
        }//SetValueFromCell

        public void SetCellFromValue()
        {
            int x = Value / Board.GetColumns();

            PositionCell.X = (byte)x;
            int y = Value % Board.GetRows();

            PositionCell.Y = (byte)y;
        } //SetCellFromValue
Esempio n. 2
0
        }//PrintVerticalLine

        private static void PrintAllVerticalLines(char sign, Point point)
        {
            int columns = Board.GetColumns();
            int j       = point.X;

            for (int i = 0; i <= columns; i++, j += 6)
            {
                point.X = j;
                PrintVerticalLine(sign, point);
            }
        }//PrintAllVerticalLines
Esempio n. 3
0
        }//PrintValue

        private static void PrintGorizontLine(char sign, Point point)
        {
            int columns = Board.GetColumns();

            Console.CursorLeft = point.X + 1;
            Console.CursorTop  = point.Y;
            for (int i = 0; i < columns * 6 - 1; i++)
            {
                Console.Write(sign);
            }
        }//PrintGorizontLine
Esempio n. 4
0
        }//PrintAllGorizontLines

        #endregion

        #region Select Options
        /// <summary>
        /// Select with whom to play in a new battle.
        /// </summary>
        /// <returns>BattleType</returns>
        public static BattleType SelectBattleType()
        {
            PrintHeader();
            PrintMenu(new string[] { "One pleyer ", "Two pleyers", "Exit       " }, ConsoleColor.Gray);
            byte selection = 0;

            do
            {
                Console.WriteLine();
                Console.CursorLeft = 10;
                Console.Write("Please select the option: ");
                try
                {
                    selection = byte.Parse(Console.ReadLine());
                }
                catch (Exception)
                {
                    Console.CursorLeft = 10;
                    Console.WriteLine("Incorrect input. ");
                    continue;
                }
                Console.CursorLeft = 10;
                switch (selection)
                {
                case 1:
                    if (Board.GetColumns() > 3 && Board.GetRows() > 3)
                    {
                        Console.WriteLine("The board is too big to play. Change the settings of the board. ");
                        break;
                    }
                    else
                    {
                        return(BattleType.ONEPLAYER);
                    }

                //  Console.WriteLine("Not implemented yet. ");
                // Environment.Exit(0);
                //  break;
                case 2:
                    return(BattleType.TWOPLAYERS);

                case 3:
                    Console.WriteLine("May be next time... Bay bay! ;-)");
                    Environment.Exit(0);
                    break;

                default:
                    Console.WriteLine("Invalid selection. ");
                    break;
                }
            } while (selection != 3);
            return(BattleType.ONEPLAYER);
        }//SelectBattleType
Esempio n. 5
0
 public static int ConsoleCursorLeft()
 {
     return((Console.WindowWidth / 2) - (Board.GetColumns() * 6) - 5);
 }//ConsoleCursorLef
Esempio n. 6
0
        }//IsOpen

        public void SetValueFromCell()
        {
            int value = PositionCell.X * (Board.GetColumns()) + PositionCell.Y;

            Value = (byte)value;
        }//SetValueFromCell
Esempio n. 7
0
        }//c-tor

        #endregion

        public bool IsValid()
        {
            return(PositionCell.X < Board.GetColumns() && PositionCell.Y < Board.GetRows());
        }//IsValid