Exemple #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;
    }
    private IEnumerator                     StartConnection()
    {
        int i = 0;

        ConnectionProgressBar.SetProgress(0, 100);
        ConnectionProgressBar.Caption = "Loading...";
        Util.Timer connClock = new Util.Timer();
        connClock.StartTimer();
        if (_blnForceConnection)
        {
            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();
        ConnectionProgressBar.Caption = "";
        if (!Net.IsConnected && connClock.GetFloatTime > Net.CONNECTION_TIMEOUT)
        {
            ConnectionProgressBar.Caption = "Unable to Load.";
            if (Net.IsClient)
            {
                Net.ClientDisconnect();
//				if (Net.UsesMatchMaking)
//				{
//					PanelManager.Instance.ShowMatchMakingPanel();
//					Net.StartMatchMaking();
//				} else
                PanelManager.Instance.ShowConnectPanel();
            }
        }
        connClock = null;
    }