예제 #1
0
 void NewGame()
 {
     pcbCoolDown.Value = 0;
     tmCoolDown.Stop();
     btn_Undo.Enabled = true;
     ChessBoard.DrawChessBoard(pnl_ChessBoard);
 }
예제 #2
0
 private void btn_Computer_Click(object sender, EventArgs e)
 {
     ChessBoard = new ChessBoardManager(pnl_ChessBoard);
     ChessBoard.DrawChessBoard(pnl_ChessBoard);
     ChessBoard.EndedGame += ChessBoard_EndedGame;
     NewGame();
 }
예제 #3
0
        SocketManager socket;// = new SocketManager();
        #endregion

        public Form_Main(string username, string useremail)
        {
            InitializeComponent();
            Control.CheckForIllegalCrossThreadCalls = false;
            this.playername  = username;
            this.playeremail = useremail;
            ChessBoard       = new ChessBoardManager(pnl_ChessBoard);
            ChessBoard.DrawChessBoard(pnl_ChessBoard);
            ChessBoard.EndedGame    += ChessBoard_EndedGame;
            ChessBoard.PlayerMarked += ChessBoard_PlayerMarked;
            pcbCoolDown.Maximum      = Cons.COOL_DOWN_TIME;
            pcbCoolDown.Step         = Cons.COOL_DOWN_STEP;
            pcbCoolDown.Value        = 0;

            tmCoolDown.Interval = Cons.COOL_DOWN_INTERVAL;

            socket = new SocketManager();

            NewGame();
            pnl_ChessBoard.Enabled = false;
        }
예제 #4
0
        private void btn_Lan_Click(object sender, EventArgs e)
        {
            ChessBoard = new ChessBoardManager(pnl_ChessBoard);
            ChessBoard.DrawChessBoard(pnl_ChessBoard);
            ChessBoard.EndedGame    += ChessBoard_EndedGame;
            ChessBoard.PlayerMarked += ChessBoard_PlayerMarked;
            socket.IP = txt_IP.Text;

            if (!socket.ConnecServer())
            {
                socket.isServer        = true;
                pnl_ChessBoard.Enabled = true;
                socket.CreateServer();
            }
            else
            {
                socket.isServer        = false;
                pnl_ChessBoard.Enabled = false;
                Listen();
                MessageBox.Show("Kết nối thành công");
            }
        }