Ejemplo n.º 1
0
        private void ProcessData(SocketData data)
        {
            switch (data.Command)
            {
            case (int)SocketCommand.NEW_GAME:
                this.Invoke((MethodInvoker)(() =>
                {
                    NewGame();
                    pnlChessBoard.Enabled = false;
                }));
                break;

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

            case (int)SocketCommand.END_GAME:
                //MessageBox.Show("Đã đủ 5 con liền nhau");
                break;

            case (int)SocketCommand.TIME_OUT:
                //MessageBox.Show("Đã hết giờ");
                break;

            case (int)SocketCommand.EXIT:
                tmCoolDown.Stop();
                MessageBox.Show("Đối thủ đã thoát rồi :((");
                break;

            default:
                break;
            }

            Listen();
        }