/// <summary>
        /// On click, starts the NetHost and takes user to the host lobby
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void HostButton_Click(object sender, EventArgs e)
        {
            Host.ServerStart();
            NetworkClasses.UpdatePlayerStat(User.PlayerId, "Games_Hosted", 1);
            Form gameList = new HostGameListForm();

            gameList.Show();
            Dispose();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Enabled by selecting a server
        /// On click, joins the selected server and takes the user to the player lobby
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void join_Click(object sender, EventArgs e)
        {
            if (!join.Enabled)
            {
                return;
            }
            var goodConnection = Client.Connect();

            if (goodConnection)
            {
                NetworkClasses.JoinServer(serverList.SelectedItems[0].SubItems[1].Text, User.PlayerId);
                NetworkClasses.UpdatePlayerStat(User.PlayerId, "Games_Joined", 1);
                var lobby = new PlayerLobby();
                lobby.Show();
                Dispose();
            }
            else
            {
                Console.WriteLine("Couldn't Connect");
            }
        }