Beispiel #1
0
        private void Btn_1_Click(object sender, EventArgs e)
        {
            Button button = (Button)sender;

            button.BackColor = Color.Green;
            button.Enabled   = false;
            int x = Playing_Field.GetPositionFromControl((Button)sender).Column;
            int y = Playing_Field.GetPositionFromControl((Button)sender).Row;

            SetButton(x, y, mark);
            bool won = Won();

            client.SendMessage(new
            {
                id   = "opponentSet",
                data = new
                {
                    x    = x,
                    y    = y,
                    mark = mark,
                    won  = won.ToString(),
                    full = full
                }
            });
            if (!won)
            {
                AddMessageToConsole("Opponents turn...");
            }
        }
Beispiel #2
0
        private void Btn_2_Click(object sender, EventArgs e)
        {
            int x = Playing_Field.GetPositionFromControl((Button)sender).Column;
            int y = Playing_Field.GetPositionFromControl((Button)sender).Row;


            SetButton(x, y, mark);
            client.SendMessage(new
            {
                id   = "opponentSet",
                data = new
                {
                    x    = x,
                    y    = y,
                    mark = mark,
                    won  = Won().ToString()
                }
            });
            AddMessageToConsole("Opponents turn...");
        }