Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!Ready)
            {
                MessageBox.Show("Podaj imiona graczy!");
                return;
            }
            Point p = new Point();

            p = (Point)(sender as Button).Tag;

            (sender as Button).Text = GomokuObj.Active.Type == FieldType.ftCircle ? "O" : "X";

            GomokuObj.Set(p.X, p.Y);

            if (GomokuObj.Winner)
            {
                MessageBox.Show(String.Format("Brawo dla {0}", GomokuObj.Active.Name), "Wygrana!");
                for (int i = 0; i < Controls.Count; i++)
                {
                    if (Controls[i] is Button && (Controls[i] as Button).Tag != null)
                    {
                        (Controls[i] as Button).Text = "";
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!Ready)
            {
                MessageBox.Show("Podaj imiona graczy!");
                return;
            }
            Point p = new Point();

            p = (Point)(sender as Button).Tag;

            if (!GomokuObj.Set(p.X, p.Y))
            {
                MessageBox.Show("To pole nie jest puste!!!");
                return;
            }

            (sender as Button).Text = GomokuObj.Active.Type == FieldType.ftCircle ? "O" : "X";

            if (GomokuObj.Winner)
            {
                MessageBox.Show(String.Format("Brawo dla {0}", GomokuObj.Active.Name), "Wygrana!");
            }
        }