Example #1
0
        /// <summary>
        /// Проверка на конец игры
        /// </summary>
        /// <returns></returns>
        public bool CheckForEndGame()
        {
            bool check = true;

            for (int i = 0; i < myGame.size * myGame.size - 1; i++)
            {
                Button foundButton = GameBox.FindControl("Button" + i.ToString()) as Button;
                if (foundButton.Text == (i + 1).ToString())
                {
                    check = true;
                }
                else
                {
                    return(false);
                }
            }
            return(true);
        }
Example #2
0
        /// <summary>
        /// Обновление значений кнопок
        /// </summary>
        public void UpdateGameField()
        {
            int numb = 0;

            for (int i = 0; i < myGame.ArrGame.Length; i++)
            {
                for (int j = 0; j < myGame.ArrGame[i].Length; j++)
                {
                    string nam         = "Button" + numb;
                    Button foundButton = GameBox.FindControl(nam) as Button;
                    foundButton.Text        = (myGame.ArrGame[i][j].Name).ToString();
                    foundButton.BorderStyle = BorderStyle.NotSet;
                    foundButton.BackColor   = System.Drawing.Color.SteelBlue;
                    numb++;
                    if (foundButton.Text == "")
                    {
                        foundButton.BorderColor = System.Drawing.Color.White;
                        foundButton.BorderStyle = BorderStyle.None;
                        foundButton.BackColor   = System.Drawing.Color.White;
                    }
                }
            }
        }