private void button_LoadGame_Click(object sender, EventArgs e) { if (isHost && label_Player2.Text.Length < 10) { server.sendMessage("p+" + Player1); label_Player2.Text += server.name; if (server.name != null) { this.button_Start.Show(); } } else if (label_PlayerOne.Text.Length < 10 && !isHost) { client.sendMessage("p+" + Player2); label_PlayerOne.Text += client.name; if (label_IP.Text.Length < 5) { label_IP.Text += ip; label_Port.Text += port; } if (client.name != null) { this.button_Start.Show(); } } }
private void button1_Click(object sender, EventArgs e) { Fire.Enabled = false; form.wait = true; labelWaitingForEnemy.Show(); if (server != null) { server.sendMessage("i+" + (currentTarget.Item1 / 50) + "," + (currentTarget.Item2 / 50 + 1)); } if (client != null) { client.sendMessage("i+" + (currentTarget.Item1 / 50) + "," + (currentTarget.Item2 / 50 + 1)); } }
private void button2_Click(object sender, EventArgs e) { if (client != null) { client.sendMessage("r+true"); if (client.ready) { Form opponentForm = new OpponentForm(client, this); opponentForm.Show(); setup = false; ReadyButton.Hide(); button_Reset.Hide(); waitingLabel.Hide(); } else { waitingLabel.Show(); } } else if (server != null) { if (server.ready) { server.sendMessage("r+true"); Form opponentForm = new OpponentForm(server, this); opponentForm.Show(); setup = false; ReadyButton.Hide(); button_Reset.Hide(); waitingLabel.Hide(); } else { waitingLabel.Show(); } } }