public GameForm(TcpModel tcpModel, int roomId, int userOffset) { this.tcpModel = tcpModel; InitializeComponent(); CheckForIllegalCrossThreadCalls = false; ptbMyCards = new List <PictureBox>(); ptbReceiveCards = new List <PictureBox>(); timeCount = timePerTurn; isClick = new bool[13]; lblRoomId.Text = $"Room {roomId}"; userOffsetInRoom = userOffset; prbTimerCount.Maximum = timePerTurn; sunPosition = new Point[] { btnFight.Location, btnIgnore.Location }; createPicturebox(); Thread thread = new Thread(receiveDataThread); thread.Start(); if (userOffsetInRoom == 0) { btnPlay.Enabled = true; } }
private void connect() { tcpModel = new TcpModel(txtIP.Text, int.Parse(txtPort.Text)); btnConnect.Enabled = false; btnCreate.Enabled = btnJoin.Enabled = true; Thread thread = new Thread(receiveFromServerThread); thread.Start(); }
private void BtnLocal_Click(object sender, EventArgs e) { tcpModel = new TcpModel("127.0.0.1", 13000); btnConnect.Enabled = false; btnLocal.Enabled = false; btnCreate.Enabled = btnJoin.Enabled = true; Thread thread = new Thread(receiveFromServerThread); thread.Start(); }