Exemple #1
0
        private void ProcessData(SocketData data)
        {
            switch (data.Command)
            {
            case (int)SocketCommand.NOTIFY:
                MessageBox.Show(data.Message);
                break;

            case (int)SocketCommand.NEW_GAME:
                this.Invoke((MethodInvoker)(() =>
                {
                    NewGame();
                    pnlChessBoard.Enabled = false;
                }));
                break;

            case (int)SocketCommand.SEND_POINT:
                this.Invoke((MethodInvoker)(() =>
                {
                    pcbCircular.Value = 0;
                    pnlChessBoard.Enabled = true;
                    tmCoolDown.Start();
                    ChessBoard.OtherPlayerMark(data.Point);
                    undoToolStripMenuItem.Enabled = true;
                }));
                break;

            case (int)SocketCommand.UNDO:
                Undo();
                pcbCircular.Value = 0;
                break;

            case (int)SocketCommand.END_GAME:
                MaterialMessageBoxOK.Show("Đã 5 con trên 1 hàng", "Thông báo", MessageBoxButtons.OK);
                break;

            case (int)SocketCommand.TIME_OUT:
                MaterialMessageBoxOK.Show("Hết giờ", "Thông báo", MessageBoxButtons.OK);
                break;

            case (int)SocketCommand.QUIT:
                tmCoolDown.Stop();
                MaterialMessageBoxOK.Show("Người chơi đã thoát!!", "Thông báo", MessageBoxButtons.OK);
                break;

            default:
                break;
            }

            Listen();
        }
Exemple #2
0
        private void ProcessData(SocketData data)
        {
            switch (data.Command)
            {
            case (int)SocketCommand.NOTIFY:
                tmCoolDown.Stop();
                MessageBox.Show(data.Message);
                break;

            case (int)SocketCommand.SENDPOINT:
                this.Invoke((MethodInvoker)(() =>
                {
                    pgbCoolDown.Value = 0;
                    tmCoolDown.Start();
                    chessboard.OtherPlayerMark(data.point);
                }));

                break;

            case (int)SocketCommand.NEWGAME:
                this.Invoke((MethodInvoker)(() =>
                {
                    NewGame();
                    pnl_chessboard.Enabled = false;
                }));

                break;

            case (int)SocketCommand.UNDO:
                break;

            case (int)SocketCommand.QUIT:

                this.Invoke((MethodInvoker)(() =>
                {
                    tmCoolDown.Stop();
                    MessageBox.Show(data.Message);
                    Application.Exit();
                }));

                break;

            default:
                break;
            }
            Listen();
        }