Exemplo n.º 1
0
    private IEnumerator                     StartConnection()
    {
        yield return(new WaitForSeconds(0.1f));

        int i = 0;

        ConnectionProgressBar.Progress = 0;
        ConnectionProgressBar.Caption  = "Connecting...";
        Util.Timer connClock = new Util.Timer();
        _blnIsConnecting = true;
        Display(true);
        connClock.StartTimer();
        Net.ClientConnect();
        while (!Net.IsConnected && connClock.GetTime <= Net.CONNECTION_TIMEOUT)
        {
            yield return(null);

            i++;
            ConnectionProgressBar.SetProgress(connClock.GetFloatTime, Net.CONNECTION_TIMEOUT);
            yield return(null);
        }
        connClock.StopTimer();
        _blnIsConnecting = false;
        _blnAutoConnect  = false;
        ConnectionProgressBar.Caption = "";
        if (!Net.IsConnected && connClock.GetFloatTime > Net.CONNECTION_TIMEOUT)
        {
            Display();
        }
        connClock = null;
    }
 public void                                    ManualServerConnectButtonOnClick()
 {
     if (ServerIPaddress != "" && ServerPort > 0)
     {
         Net.StopMatchMaker();
         Net.UsesMatchMaking = false;
         Net.ForceHostMode   = false;
         Net.ServerIPaddress = this.ServerIPaddress;
         Net.ServerPort      = this.ServerPort;
         Net.ClientConnect();
         PanelManager.Instance.ShowConnectPanel();
     }
 }