예제 #1
0
        private void btnConnect_Click(object sender, EventArgs e)
        {
            btnConnect.Enabled = false;
            ymfasClient.Connect(txtConnectIP.Text);

            splashState     = MainSplashState.Connecting;
            ticksConnecting = 0;
        }
예제 #2
0
        private void btnConnect_Click(object sender, EventArgs e)
        {
            btnConnect.Enabled = false;
            ymfasClient.Connect(txtConnectIP.Text);

            splashState = MainSplashState.Connecting;
            ticksConnecting = 0;
        }
예제 #3
0
        private void timer_Tick(object sender, EventArgs e)
        {
            //looking for servers
            if (splashState == MainSplashState.Searching)
            {
                Console.Out.WriteLine("searching...");
                //update the engine state
                ymfasClient.Update();

                //attempt to find a new server
                Lidgren.Library.Network.NetServerInfo session = ymfasClient.GetLocalSession();
                if (session != null)
                {
                    String hostname = ymfasClient.GetHostNameFromIP(session.RemoteEndpoint.Address.ToString());
                    lstServers.Items.Add(hostname + " - " + session.RemoteEndpoint.Address.ToString());
                }
            }

            //connecting to a server
            if (splashState == MainSplashState.Connecting)
            {
                // update the engine state
                ymfasClient.Update();

                //time out if too long
                if (ticksConnecting * timer.Interval >= MAX_CONNECT_TIME)
                {
                    splashState = MainSplashState.Searching;
                    ymfasClient.Dispose();
                    ymfasClient = null;
                    MessageBox.Show("Connection attempt failed.");
                }
                else
                {
                    ticksConnecting++;

                    //check for successful connection
                    if (ymfasClient.Status == NetConnectionStatus.Connected)
                    {
                        splashState = MainSplashState.None;

                        // join lobby
                        GameLobby = new frmGameLobby(ymfasClient);
                        GameLobby.ShowDialog();

                        if (GameLobby.DialogResult == DialogResult.OK)
                        {
                            ymfasClient       = GameLobby.Client;
                            this.DialogResult = DialogResult.OK;
                            this.Close();
                        }
                    }
                }
            }
        }
예제 #4
0
        private void btnJoin_Click(object sender, EventArgs e)
        {
            //Initiate search for servers
            grpServerList.Visible = true;
            ymfasClient           = new YmfasClient(txtName.Text);

            btnJoin.Enabled = false;
            btnHost.Enabled = false;
            ymfasClient.SearchSessions();

            //Handle server search in the timer object
            splashState = MainSplashState.Searching;
        }
예제 #5
0
 public frmMainSplash()
 {
     InitializeComponent();
     splashState = MainSplashState.None;
 }
예제 #6
0
 public frmMainSplash()
 {
     InitializeComponent();
     splashState = MainSplashState.None;
 }
예제 #7
0
        private void timer_Tick(object sender, EventArgs e)
        {
            //looking for servers
            if (splashState == MainSplashState.Searching) {

                Console.Out.WriteLine("searching...");
                //update the engine state
                ymfasClient.Update();

                //attempt to find a new server
                Lidgren.Library.Network.NetServerInfo session = ymfasClient.GetLocalSession();
                if (session != null) {
                    String hostname = ymfasClient.GetHostNameFromIP(session.RemoteEndpoint.Address.ToString());
                    lstServers.Items.Add(hostname + " - " + session.RemoteEndpoint.Address.ToString());
                }
            }

            //connecting to a server
            if (splashState == MainSplashState.Connecting) {

                // update the engine state
                ymfasClient.Update();

                //time out if too long
                if (ticksConnecting * timer.Interval >= MAX_CONNECT_TIME) {
                    splashState = MainSplashState.Searching;
                    ymfasClient.Dispose();
                    ymfasClient = null;
                    MessageBox.Show("Connection attempt failed.");
                }
                else {
                    ticksConnecting++;

                    //check for successful connection
                    if (ymfasClient.Status == NetConnectionStatus.Connected) {
                        splashState = MainSplashState.None;

                        // join lobby
                        GameLobby = new frmGameLobby(ymfasClient);
                        GameLobby.ShowDialog();

                        if (GameLobby.DialogResult == DialogResult.OK)
                        {
                            ymfasClient = GameLobby.Client;
                            this.DialogResult = DialogResult.OK;
                            this.Close();
                        }
                    }
                }
            }
        }
예제 #8
0
        private void btnJoin_Click(object sender, EventArgs e)
        {
            //Initiate search for servers
            grpServerList.Visible = true;
            ymfasClient = new YmfasClient(txtName.Text);

            btnJoin.Enabled = false;
            btnHost.Enabled = false;
            ymfasClient.SearchSessions();

            //Handle server search in the timer object
            splashState = MainSplashState.Searching;
        }