Exemple #1
0
        /// <summary>
        /// Invoked when the client has successfully connected to a server
        /// </summary>
        /// <param name="sender">The object that invoked the event (the Game Client)</param>
        /// <param name="e">The empty event arguments</param>
        private void ClientConnected(object sender, EventArgs e)
        {
            myTimer.Stop();

            Hide();

            frmLobby lobby = new frmLobby();

            lobby.InitMultiplayer(myClient);
            DialogResult result = lobby.ShowDialog();

            if (!myClient.IsReady)
            {
                myClient.Run();
            }

            System.Threading.Thread.Sleep(25);

            myServers.Clear();
            dgvServers.Rows.Clear();
            myClient.OnServerDiscovered += ServerDiscovered;
            myClient.DiscoverServers();
            myTimer.Start();

            Show();
        }
Exemple #2
0
        /// <summary>
        /// Invoked when the play singleplayer button has been pressed
        /// </summary>
        /// <param name="sender">The button that the event is invoked for</param>
        /// <param name="e">The blank event arguments</param>
        private void btnPlaySingle_Click(object sender, EventArgs e)
        {
            this.Hide();

            frmLobby lobby = new frmLobby();

            lobby.InitSinglePlayer();
            lobby.ShowDialog();

            this.Show();
        }
        /// <summary>
        /// Invoked when the host button has been clicked
        /// </summary>
        /// <param name="sender">The button that raised the event</param>
        /// <param name="e">The blank event arguments</param>
        private void HostClick(object sender, EventArgs e)
        {
            this.Hide();

            frmLobby lobby = new frmLobby();

            lobby.InitMultiplayer();
            lobby.ShowDialog();

            this.Close();
        }