public Square(int i_squareLine, int i_squareColumm)
 {
     m_SquarePosition = new SquarePosition(i_squareLine, i_squareColumm);
     if ((m_SquarePosition.x + m_SquarePosition.y) % 2 == 0)
     {
         m_SquareColor = eSquareColor.White;
     }
     else
     {
         m_SquareColor = eSquareColor.Black;
     }
 }
Пример #2
0
        private static eSquareColor parseStringToColor(Char i_StringToParse)
        {
            eSquareColor buttonNewColor = eSquareColor.Default;

            foreach (eSquareColor buttonColor in Enum.GetValues(typeof(eSquareColor)))
            {
                if ((char)buttonColor == i_StringToParse)
                {
                    buttonNewColor = buttonColor;
                }
            }
            return(buttonNewColor);
        }
Пример #3
0
        public static void DefineBackColor(Button i_ButtonToChange, string i_valueToChangeTo)
        {
            bool parsed = Char.TryParse(i_valueToChangeTo, out char valueToChangeToAsChar);

            if (parsed)
            {
                eSquareColor buttonNewColor = parseStringToColor(valueToChangeToAsChar);
                i_ButtonToChange.BackColor = Color.FromName(Enum.GetName(typeof(eSquareColor), buttonNewColor));
            }
            else
            {
                throw new Exception();
            }
        }
Пример #4
0
 public Square(int i_Row, int i_Column)
 {
     m_Column = i_Column;
     m_Row    = i_Row;
     m_Type   = eSquareColor.Empty;
 }