Beispiel #1
0
 private void btnJoinAddress_Click(object sender, EventArgs e)
 {
     try
     {
         bool result = clientSideNetworking.JoinGame(new System.Net.IPEndPoint(IPAddress.Parse(txtAddress.Text),ushort.Parse( txtPort.Text)), txtName.Text, ushort.Parse(txtGame.Text), ushort.Parse(txtTeam.Text));
         if (result)
         {
             gamePlayForm = new GameplayForm(clientSideNetworking);
             gamePlayForm.Show();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Beispiel #2
0
        private void btnJoin_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 1)
            {
                int index = dataGridView1.SelectedRows[0].Index;

                UDPClientServerCommons.Packets.GameInfoPacket gameInfoPacket = gameInfoPackets[index];

                ChooseTeamForm chooseTeam = new ChooseTeamForm(gameInfoPacket);
                if (chooseTeam.ShowDialog(this) == DialogResult.OK)
                {
                    bool result = clientSideNetworking.JoinGame(gameInfoPacket.ServerAddress, chooseTeam.PlayerName, gameInfoPacket.GameId, chooseTeam.TeamId.Value);
                    if (result)
                    {
                        gamePlayForm = new GameplayForm(clientSideNetworking);
                        gamePlayForm.Show();
                    }
                }
            }
        }