private void btn_Computer_Click(object sender, EventArgs e) { ChessBoard = new ChessBoardManager(pnl_ChessBoard); ChessBoard.DrawChessBoard(pnl_ChessBoard); ChessBoard.EndedGame += ChessBoard_EndedGame; NewGame(); }
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; }
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"); } }