// Token: 0x0600B24D RID: 45645 RVA: 0x0041687C File Offset: 0x00414A7C internal IEnumerator LONCMFKCCJD(bool BHOGFDENPBF) { while (PhotonNetwork.JNJJAMNLOHA.AvailableRegions == null) { if (PhotonNetwork.connectionStateDetailed != ClientState.ConnectingToNameServer && PhotonNetwork.connectionStateDetailed != ClientState.ConnectedToNameServer) { UnityEngine.Debug.LogError("Call ConnectToNameServer to ping available regions."); yield break; } UnityEngine.Debug.Log(string.Concat(new object[] { "Waiting for AvailableRegions. State: ", PhotonNetwork.connectionStateDetailed, " Server: ", PhotonNetwork.Server, " PhotonNetwork.networkingPeer.AvailableRegions ", PhotonNetwork.JNJJAMNLOHA.AvailableRegions != null })); yield return(new WaitForSeconds(0.25f)); } if (PhotonNetwork.JNJJAMNLOHA.AvailableRegions == null || PhotonNetwork.JNJJAMNLOHA.AvailableRegions.Count == 0) { UnityEngine.Debug.LogError("No regions available. Are you sure your appid is valid and setup?"); yield break; } photonPingManager = new PhotonPingManager(); enumerator = PhotonNetwork.JNJJAMNLOHA.AvailableRegions.GetEnumerator(); try { while (enumerator.MoveNext()) { Region lpcnahjgafk = enumerator.Current; PhotonHandler.SP.StartCoroutine(photonPingManager.PingSocket(lpcnahjgafk)); } } finally { ((IDisposable)enumerator).Dispose(); } while (!photonPingManager.Done) { yield return(new WaitForSeconds(0.1f)); } bestRegion = photonPingManager.BestRegion; PhotonHandler.IFAEAEOAJDL = bestRegion.Code; UnityEngine.Debug.Log(string.Concat(new object[] { "Found best region: '", bestRegion.Code, "' ping: ", bestRegion.Ping, ". Calling ConnectToRegionMaster() is: ", BHOGFDENPBF })); if (BHOGFDENPBF) { PhotonNetwork.JNJJAMNLOHA.ConnectToRegionMaster(bestRegion.Code); } yield break; }
internal IEnumerator PingAvailableRegionsCoroutine(bool connectToBest) { BestRegionCodeCurrently = CloudRegionCode.none; while (PhotonNetwork.networkingPeer.AvailableRegions == null) { if (PhotonNetwork.connectionStateDetailed != PeerState.ConnectingToNameServer && PhotonNetwork.connectionStateDetailed != PeerState.ConnectedToNameServer) { Debug.LogError("Call ConnectToNameServer to ping available regions."); yield break; // break if we don't connect to the nameserver at all } Debug.Log("Waiting for AvailableRegions. State: " + PhotonNetwork.connectionStateDetailed + " Server: " + PhotonNetwork.Server + " PhotonNetwork.networkingPeer.AvailableRegions " + (PhotonNetwork.networkingPeer.AvailableRegions != null)); yield return(new WaitForSeconds(0.25f)); // wait until pinging finished (offline mode won't ping) } if (PhotonNetwork.networkingPeer.AvailableRegions == null || PhotonNetwork.networkingPeer.AvailableRegions.Count == 0) { Debug.LogError("No regions available. Are you sure your appid is valid and setup?"); yield break; // break if we don't get regions at all } //#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE) //#pragma warning disable 0162 // the library variant defines if we should use PUN's SocketUdp variant (at all) //if (PhotonPeer.NoSocket) //{ // if (PhotonNetwork.logLevel >= PhotonLogLevel.Informational) // { // Debug.Log("PUN disconnects to re-use native sockets for pining servers and to find the best."); // } // PhotonNetwork.Disconnect(); //} //#pragma warning restore 0162 //#endif PhotonPingManager pingManager = new PhotonPingManager(); foreach (Region region in PhotonNetwork.networkingPeer.AvailableRegions) { SP.StartCoroutine(pingManager.PingSocket(region)); } while (!pingManager.Done) { yield return(new WaitForSeconds(0.1f)); // wait until pinging finished (offline mode won't ping) } Region best = pingManager.BestRegion; PhotonHandler.BestRegionCodeCurrently = best.Code; PhotonHandler.BestRegionCodeInPreferences = best.Code; Debug.Log("Found best region: " + best.Code + " ping: " + best.Ping + ". Calling ConnectToRegionMaster() is: " + connectToBest); if (connectToBest) { PhotonNetwork.networkingPeer.ConnectToRegionMaster(best.Code); } }
// Token: 0x06003D00 RID: 15616 RVA: 0x001343E4 File Offset: 0x001327E4 internal IEnumerator PingAvailableRegionsCoroutine(bool connectToBest) { while (PhotonNetwork.networkingPeer.AvailableRegions == null) { if (PhotonNetwork.connectionStateDetailed != ClientState.ConnectingToNameServer && PhotonNetwork.connectionStateDetailed != ClientState.ConnectedToNameServer) { UnityEngine.Debug.LogError("Call ConnectToNameServer to ping available regions."); yield break; } UnityEngine.Debug.Log(string.Concat(new object[] { "Waiting for AvailableRegions. State: ", PhotonNetwork.connectionStateDetailed, " Server: ", PhotonNetwork.Server, " PhotonNetwork.networkingPeer.AvailableRegions ", PhotonNetwork.networkingPeer.AvailableRegions != null })); yield return(new WaitForSeconds(0.25f)); } if (PhotonNetwork.networkingPeer.AvailableRegions == null || PhotonNetwork.networkingPeer.AvailableRegions.Count == 0) { UnityEngine.Debug.LogError("No regions available. Are you sure your appid is valid and setup?"); yield break; } PhotonPingManager pingManager = new PhotonPingManager(); foreach (Region region in PhotonNetwork.networkingPeer.AvailableRegions) { PhotonHandler.SP.StartCoroutine(pingManager.PingSocket(region)); } while (!pingManager.Done) { yield return(new WaitForSeconds(0.1f)); } Region best = pingManager.BestRegion; PhotonHandler.BestRegionCodeInPreferences = best.Code; UnityEngine.Debug.Log(string.Concat(new object[] { "Found best region: '", best.Code, "' ping: ", best.Ping, ". Calling ConnectToRegionMaster() is: ", connectToBest })); if (connectToBest) { PhotonNetwork.networkingPeer.ConnectToRegionMaster(best.Code); } yield break; }
internal IEnumerator PingAvailableRegionsCoroutine(bool connectToBest) { BestRegionCodeCurrently = CloudRegionCode.none; while (PhotonNetwork.networkingPeer.AvailableRegions == null) { if (PhotonNetwork.connectionStateDetailed != PeerState.ConnectingToNameServer && PhotonNetwork.connectionStateDetailed != PeerState.ConnectedToNameServer) { Debug.LogError("Call ConnectToNameServer to ping available regions."); yield break; // break if we don't connect to the nameserver at all } Debug.Log("Waiting for AvailableRegions. State: " + PhotonNetwork.connectionStateDetailed + " Server: " + PhotonNetwork.Server + " PhotonNetwork.networkingPeer.AvailableRegions " + (PhotonNetwork.networkingPeer.AvailableRegions != null)); yield return(new WaitForSeconds(0.25f)); // wait until pinging finished (offline mode won't ping) } if (PhotonNetwork.networkingPeer.AvailableRegions == null || PhotonNetwork.networkingPeer.AvailableRegions.Count == 0) { Debug.LogError("No regions available. Are you sure your appid is valid and setup?"); yield break; // break if we don't get regions at all } PhotonPingManager pingManager = new PhotonPingManager(); foreach (Region region in PhotonNetwork.networkingPeer.AvailableRegions) { SP.StartCoroutine(pingManager.PingSocket(region)); } while (!pingManager.Done) { yield return(new WaitForSeconds(0.1f)); // wait until pinging finished (offline mode won't ping) } Region best = pingManager.BestRegion; PhotonHandler.BestRegionCodeCurrently = best.Code; PhotonHandler.BestRegionCodeInPreferences = best.Code; Debug.Log("Found best region: " + best.Code + " ping: " + best.Ping + ". Calling ConnectToRegionMaster() is: " + connectToBest); if (connectToBest) { PhotonNetwork.networkingPeer.ConnectToRegionMaster(best.Code); } }
internal IEnumerator PingAvailableRegionsCoroutine(bool connectToBest) { PhotonHandler.BestRegionCodeCurrently = CloudRegionCode.none; while (PhotonNetwork.networkingPeer.AvailableRegions == null) { if (PhotonNetwork.connectionStateDetailed != PeerStates.ConnectingToNameServer && PhotonNetwork.connectionStateDetailed != PeerStates.ConnectedToNameServer) { UnityEngine.Debug.LogError("Call ConnectToNameServer to ping available regions."); yield break; } UnityEngine.Debug.Log("Waiting for AvailableRegions. State: " + PhotonNetwork.connectionStateDetailed + " Server: " + PhotonNetwork.Server + " PhotonNetwork.networkingPeer.AvailableRegions " + (PhotonNetwork.networkingPeer.AvailableRegions != null)); yield return((object)new WaitForSeconds(0.25f)); } if (PhotonNetwork.networkingPeer.AvailableRegions == null || PhotonNetwork.networkingPeer.AvailableRegions.Count == 0) { UnityEngine.Debug.LogError("No regions available. Are you sure your appid is valid and setup?"); } else { PhotonPingManager pingManager = new PhotonPingManager(); List <Region> .Enumerator enumerator = PhotonNetwork.networkingPeer.AvailableRegions.GetEnumerator(); try { while (enumerator.MoveNext()) { Region region = enumerator.Current; PhotonHandler.SP.StartCoroutine(pingManager.PingSocket(region)); } } finally { ((IDisposable)enumerator).Dispose(); } while (!pingManager.Done) { yield return((object)new WaitForSeconds(0.1f)); } Region best = pingManager.BestRegion; PhotonHandler.BestRegionCodeCurrently = best.Code; PhotonHandler.BestRegionCodeInPreferences = best.Code; UnityEngine.Debug.Log("Found best region: " + best.Code + " ping: " + best.Ping + ". Calling ConnectToRegionMaster() is: " + connectToBest); if (connectToBest) { PhotonNetwork.networkingPeer.ConnectToRegionMaster(best.Code); } } }
internal IEnumerator PingAvailableRegionsCoroutine(bool connectToBest) { BestRegionCodeCurrently = CloudRegionCode.none; while (PhotonNetwork.networkingPeer.AvailableRegions == null) { if (PhotonNetwork.connectionStateDetailed != PeerState.ConnectingToNameServer && PhotonNetwork.connectionStateDetailed != PeerState.ConnectedToNameServer) { Debug.LogError("Call ConnectToNameServer to ping available regions."); yield break; // break if we don't connect to the nameserver at all } Debug.Log("Waiting for AvailableRegions. State: " + PhotonNetwork.connectionStateDetailed + " Server: " + PhotonNetwork.Server + " PhotonNetwork.networkingPeer.AvailableRegions " + (PhotonNetwork.networkingPeer.AvailableRegions != null)); yield return new WaitForSeconds(0.25f); // wait until pinging finished (offline mode won't ping) } if (PhotonNetwork.networkingPeer.AvailableRegions == null || PhotonNetwork.networkingPeer.AvailableRegions.Count == 0) { Debug.LogError("No regions available. Are you sure your appid is valid and setup?"); yield break; // break if we don't get regions at all } //#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE) //#pragma warning disable 0162 // the library variant defines if we should use PUN's SocketUdp variant (at all) //if (PhotonPeer.NoSocket) //{ // if (PhotonNetwork.logLevel >= PhotonLogLevel.Informational) // { // Debug.Log("PUN disconnects to re-use native sockets for pining servers and to find the best."); // } // PhotonNetwork.Disconnect(); //} //#pragma warning restore 0162 //#endif PhotonPingManager pingManager = new PhotonPingManager(); foreach (Region region in PhotonNetwork.networkingPeer.AvailableRegions) { SP.StartCoroutine(pingManager.PingSocket(region)); } while (!pingManager.Done) { yield return new WaitForSeconds(0.1f); // wait until pinging finished (offline mode won't ping) } Region best = pingManager.BestRegion; PhotonHandler.BestRegionCodeCurrently = best.Code; PhotonHandler.BestRegionCodeInPreferences = best.Code; Debug.Log("Found best region: " + best.Code + " ping: " + best.Ping + ". Calling ConnectToRegionMaster() is: " + connectToBest); if (connectToBest) { PhotonNetwork.networkingPeer.ConnectToRegionMaster(best.Code); } }
internal IEnumerator PingAvailableRegionsCoroutine(bool connectToBest) { BestRegionCodeCurrently = CloudRegionCode.none; while (PhotonNetwork.networkingPeer.AvailableRegions == null) { if (PhotonNetwork.connectionStateDetailed != ClientState.ConnectingToNameServer && PhotonNetwork.connectionStateDetailed != ClientState.ConnectedToNameServer) { Debug.LogError("Call ConnectToNameServer to ping available regions."); yield break; // break if we don't connect to the nameserver at all } Debug.Log("Waiting for AvailableRegions. State: " + PhotonNetwork.connectionStateDetailed + " Server: " + PhotonNetwork.Server + " PhotonNetwork.networkingPeer.AvailableRegions " + (PhotonNetwork.networkingPeer.AvailableRegions != null)); yield return new WaitForSeconds(0.25f); // wait until pinging finished (offline mode won't ping) } if (PhotonNetwork.networkingPeer.AvailableRegions == null || PhotonNetwork.networkingPeer.AvailableRegions.Count == 0) { Debug.LogError("No regions available. Are you sure your appid is valid and setup?"); yield break; // break if we don't get regions at all } PhotonPingManager pingManager = new PhotonPingManager(); foreach (Region region in PhotonNetwork.networkingPeer.AvailableRegions) { SP.StartCoroutine(pingManager.PingSocket(region)); } while (!pingManager.Done) { yield return new WaitForSeconds(0.1f); // wait until pinging finished (offline mode won't ping) } Region best = pingManager.BestRegion; PhotonHandler.BestRegionCodeCurrently = best.Code; PhotonHandler.BestRegionCodeInPreferences = best.Code; Debug.Log("Found best region: " + best.Code + " ping: " + best.Ping + ". Calling ConnectToRegionMaster() is: " + connectToBest); if (connectToBest) { PhotonNetwork.networkingPeer.ConnectToRegionMaster(best.Code); } }
public bool MoveNext() { uint num = (uint)this.SPC; this.SPC = -1; switch (num) { case 0: PhotonHandler.BestRegionCodeCurrently = CloudRegionCode.none; break; case 1: break; case 2: goto Label_01A4; default: goto Label_0266; } if (PhotonNetwork.networkingPeer.AvailableRegions == null) { if ((PhotonNetwork.connectionStatesDetailed != PeerStates.ConnectingToNameServer) && (PhotonNetwork.connectionStatesDetailed != PeerStates.ConnectedToNameServer)) { UnityEngine.Debug.LogError("Call ConnectToNameServer to ping available regions."); goto Label_0266; } UnityEngine.Debug.Log(string.Concat(new object[] { "Waiting for AvailableRegions. states: ", PhotonNetwork.connectionStatesDetailed, " Server: ", PhotonNetwork.Server, " PhotonNetwork.networkingPeer.AvailableRegions ", PhotonNetwork.networkingPeer.AvailableRegions != null })); this.Scurrent = new WaitForSeconds(0.25f); this.SPC = 1; goto Label_0268; } if ((PhotonNetwork.networkingPeer.AvailableRegions == null) || (PhotonNetwork.networkingPeer.AvailableRegions.Count == 0)) { UnityEngine.Debug.LogError("No regions available. Are you sure your appid is valid and setup?"); goto Label_0266; } this.pingManager__0 = new PhotonPingManager(); this.Ss_89__1 = PhotonNetwork.networkingPeer.AvailableRegions.GetEnumerator(); try { while (this.Ss_89__1.MoveNext()) { this.region__2 = this.Ss_89__1.Current; PhotonHandler.SP.StartCoroutine(this.pingManager__0.PingSocket(this.region__2)); } } finally { this.Ss_89__1.Dispose(); } Label_01A4: while (!this.pingManager__0.Done) { this.Scurrent = new WaitForSeconds(0.1f); this.SPC = 2; goto Label_0268; } this.best__3 = this.pingManager__0.BestRegion; PhotonHandler.BestRegionCodeCurrently = this.best__3.Code; PhotonHandler.BestRegionCodeInPreferences = this.best__3.Code; UnityEngine.Debug.Log(string.Concat(new object[] { "Found best region: ", this.best__3.Code, " ping: ", this.best__3.Ping, ". Calling ConnectToRegionMaster() is: ", this.connectToBest })); if (this.connectToBest) { PhotonNetwork.networkingPeer.ConnectToRegionMaster(this.best__3.Code); } this.SPC = -1; Label_0266: return(false); Label_0268: return(true); }
public bool MoveNext() { uint num = (uint)this.SPC; this.SPC = -1; switch (num) { case 0: this.region.Ping = PhotonPingManager.Attempts * PhotonPingManager.MaxMilliseconsPerPing; this.f__this.PingsRunning++; if (PhotonHandler.PingImplementation != typeof(PingNativeDynamic)) { this.ping__0 = (PhotonPing)Activator.CreateInstance(PhotonHandler.PingImplementation); break; } UnityEngine.Debug.Log("Using constructor for new PingNativeDynamic()"); this.ping__0 = new PingNativeDynamic(); break; case 1: return(GotoOne()); //goto Label_01B9; //break; case 2: GotoTwo(); //goto Label_0268; break; case 3: this.SPC = -1; goto Label_02B3; default: goto Label_02B3; } this.rttSum__1 = 0f; this.replyCount__2 = 0; this.cleanIpOfRegion__3 = this.region.HostAndPort; this.indexOfColon__4 = this.cleanIpOfRegion__3.LastIndexOf(':'); if (this.indexOfColon__4 > 1) { this.cleanIpOfRegion__3 = this.cleanIpOfRegion__3.Substring(0, this.indexOfColon__4); } this.cleanIpOfRegion__3 = PhotonPingManager.ResolveHost(this.cleanIpOfRegion__3); this.i__5 = 0; while (this.i__5 < PhotonPingManager.Attempts) { this.overtime__6 = false; this.sw__7 = new Stopwatch(); this.sw__7.Start(); try { this.ping__0.StartPing(this.cleanIpOfRegion__3); } catch (Exception exception) { this.e__8 = exception; UnityEngine.Debug.Log("catched: " + this.e__8); this.f__this.PingsRunning--; break; } /*Label_01B9: * while (!this.ping__0.Done()) * { * if (this.sw__7.ElapsedMilliseconds >= PhotonPingManager.MaxMilliseconsPerPing) * { * this.overtime__6 = true; * break; * } * this.Scurrent = 0; * this.SPC = 1; * goto Label_02B5; * } * this.rtt__9 = (int) this.sw__7.ElapsedMilliseconds; * if ((!PhotonPingManager.IgnoreInitialAttempt || (this.i__5 != 0)) && (this.ping__0.Successful && !this.overtime__6)) * { * this.rttSum__1 += this.rtt__9; * this.replyCount__2++; * this.region.Ping = (int) (this.rttSum__1 / ((float) this.replyCount__2)); * } * this.Scurrent = new WaitForSeconds(0.1f); * this.SPC = 2;*/ //goto Label_02B5; //Label_0268: //this.i__5++; } this.f__this.PingsRunning--; this.Scurrent = null; this.SPC = 3; goto Label_02B5; Label_02B3: return(false); Label_02B5: return(true); }
// Token: 0x06003DFA RID: 15866 RVA: 0x00138614 File Offset: 0x00136A14 public IEnumerator PingSocket(Region region) { region.Ping = PhotonPingManager.Attempts * PhotonPingManager.MaxMilliseconsPerPing; this.PingsRunning++; PhotonPing ping; if (PhotonHandler.PingImplementation == typeof(PingNativeDynamic)) { UnityEngine.Debug.Log("Using constructor for new PingNativeDynamic()"); ping = new PingNativeDynamic(); } else if (PhotonHandler.PingImplementation == typeof(PingMono)) { ping = new PingMono(); } else { ping = (PhotonPing)Activator.CreateInstance(PhotonHandler.PingImplementation); } float rttSum = 0f; int replyCount = 0; string regionAddress = region.HostAndPort; int indexOfColon = regionAddress.LastIndexOf(':'); if (indexOfColon > 1) { regionAddress = regionAddress.Substring(0, indexOfColon); } regionAddress = PhotonPingManager.ResolveHost(regionAddress); for (int i = 0; i < PhotonPingManager.Attempts; i++) { bool overtime = false; Stopwatch sw = new Stopwatch(); sw.Start(); try { ping.StartPing(regionAddress); } catch (Exception arg) { UnityEngine.Debug.Log("catched: " + arg); this.PingsRunning--; break; } while (!ping.Done()) { if (sw.ElapsedMilliseconds >= (long)PhotonPingManager.MaxMilliseconsPerPing) { overtime = true; break; } yield return(0); } int rtt = (int)sw.ElapsedMilliseconds; if (!PhotonPingManager.IgnoreInitialAttempt || i != 0) { if (ping.Successful && !overtime) { rttSum += (float)rtt; replyCount++; region.Ping = (int)(rttSum / (float)replyCount); } } yield return(new WaitForSeconds(0.1f)); } this.PingsRunning--; yield return(null); yield break; }
public bool MoveNext() { uint num = (uint)this.SPC; this.SPC = -1; switch (num) { case 0: this.region.Ping = PhotonPingManager.Attempts * PhotonPingManager.MaxMilliseconsPerPing; this.fthis.PingsRunning++; if (PhotonHandler.PingImplementation != typeof(PingNativeDynamic)) { this.ping0 = (PhotonPing)Activator.CreateInstance(PhotonHandler.PingImplementation); break; } UnityEngine.Debug.Log("Using constructor for new PingNativeDynamic()"); this.ping0 = new PingNativeDynamic(); break; case 1: //goto Label_01B9; case 2: //goto Label_0265; case 3: this.SPC = -1; goto Label_02B0; default: goto Label_02B0; } this.rttSum1 = 0f; this.replyCount2 = 0; this.cleanIpOfRegion3 = this.region.HostAndPort; this.indexOfColon4 = this.cleanIpOfRegion3.LastIndexOf(':'); if (this.indexOfColon4 > 1) { this.cleanIpOfRegion3 = this.cleanIpOfRegion3.Substring(0, this.indexOfColon4); } this.cleanIpOfRegion3 = PhotonPingManager.ResolveHost(this.cleanIpOfRegion3); this.i5 = 0; while (this.i5 < PhotonPingManager.Attempts) { this.overtime6 = false; this.sw7 = new Stopwatch(); this.sw7.Start(); try { this.ping0.StartPing(this.cleanIpOfRegion3); } catch (Exception exception) { this.e8 = exception; UnityEngine.Debug.Log("catched: " + this.e8); this.fthis.PingsRunning--; break; } Label_01B9: while (!this.ping0.Done()) { if (this.sw7.ElapsedMilliseconds >= PhotonPingManager.MaxMilliseconsPerPing) { this.overtime6 = true; break; } this.Scurrent = 0; this.SPC = 1; goto Label_02B2; } this.rtt9 = (int)this.sw7.ElapsedMilliseconds; if ((!PhotonPingManager.IgnoreInitialAttempt || (this.i5 != 0)) && (this.ping0.Successful && !this.overtime6)) { this.rttSum1 += this.rtt9; this.replyCount2++; this.region.Ping = (int)(this.rttSum1 / ((float)this.replyCount2)); } this.Scurrent = new WaitForSeconds(0.1f); this.SPC = 2; goto Label_02B2; Label_0265: this.i5++; } this.fthis.PingsRunning--; this.Scurrent = null; this.SPC = 3; goto Label_02B2; Label_02B0: return(false); Label_02B2: return(true); }
// Token: 0x06000413 RID: 1043 RVA: 0x0001A321 File Offset: 0x00018521 internal IEnumerator PingAvailableRegionsCoroutine(bool connectToBest) { while (PhotonNetwork.networkingPeer.AvailableRegions == null) { if (PhotonNetwork.connectionStateDetailed != ClientState.ConnectingToNameServer && PhotonNetwork.connectionStateDetailed != ClientState.ConnectedToNameServer) { Debug.LogError("Call ConnectToNameServer to ping available regions."); yield break; } Debug.Log(string.Concat(new object[] { "Waiting for AvailableRegions. State: ", PhotonNetwork.connectionStateDetailed, " Server: ", PhotonNetwork.Server, " PhotonNetwork.networkingPeer.AvailableRegions ", (PhotonNetwork.networkingPeer.AvailableRegions != null).ToString() })); yield return(new WaitForSeconds(0.25f)); } if (PhotonNetwork.networkingPeer.AvailableRegions == null || PhotonNetwork.networkingPeer.AvailableRegions.Count == 0) { Debug.LogError("No regions available. Are you sure your appid is valid and setup?"); yield break; } PhotonPingManager pingManager = new PhotonPingManager(); using (List <Region> .Enumerator enumerator = PhotonNetwork.networkingPeer.AvailableRegions.GetEnumerator()) { while (enumerator.MoveNext()) { Region region = enumerator.Current; PhotonHandler.SP.StartCoroutine(pingManager.PingSocket(region)); } goto IL_16E; } IL_14E: yield return(new WaitForSeconds(0.1f)); IL_16E: if (pingManager.Done) { Region bestRegion = pingManager.BestRegion; PhotonHandler.BestRegionCodeInPreferences = bestRegion.Code; Debug.Log(string.Concat(new object[] { "Found best region: '", bestRegion.Code, "' ping: ", bestRegion.Ping, ". Calling ConnectToRegionMaster() is: ", connectToBest.ToString() })); if (connectToBest) { PhotonNetwork.networkingPeer.ConnectToRegionMaster(bestRegion.Code, null); } yield break; } goto IL_14E; }
// Token: 0x0600050B RID: 1291 RVA: 0x0001DC5F File Offset: 0x0001BE5F public IEnumerator PingSocket(Region region) { region.Ping = PhotonPingManager.Attempts * PhotonPingManager.MaxMilliseconsPerPing; this.PingsRunning++; PhotonPing ping = null; if (PhotonHandler.PingImplementation == typeof(PingMono)) { ping = new PingMono(); } if (ping == null) { ping = (PhotonPing)Activator.CreateInstance(PhotonHandler.PingImplementation); } float rttSum = 0f; int replyCount = 0; string regionAddress = region.HostAndPort; int num = regionAddress.LastIndexOf(':'); if (num > 1) { regionAddress = regionAddress.Substring(0, num); } int num2 = regionAddress.IndexOf("wss://"); if (num2 > -1) { regionAddress = regionAddress.Substring(num2 + "wss://".Length); } regionAddress = PhotonPingManager.ResolveHost(regionAddress); int i = 0; while (i < PhotonPingManager.Attempts) { bool overtime = false; Stopwatch sw = new Stopwatch(); sw.Start(); try { ping.StartPing(regionAddress); goto IL_1BC; } catch (Exception arg) { Debug.Log("catched: " + arg); this.PingsRunning--; break; } goto IL_184; IL_1C9: int num3 = (int)sw.ElapsedMilliseconds; int num4; if ((!PhotonPingManager.IgnoreInitialAttempt || i != 0) && ping.Successful && !overtime) { rttSum += (float)num3; num4 = replyCount; replyCount = num4 + 1; region.Ping = (int)(rttSum / (float)replyCount); } yield return(new WaitForSeconds(0.1f)); sw = null; num4 = i; i = num4 + 1; continue; IL_184: if (sw.ElapsedMilliseconds >= (long)PhotonPingManager.MaxMilliseconsPerPing) { overtime = true; goto IL_1C9; } yield return(0); IL_1BC: if (ping.Done()) { goto IL_1C9; } goto IL_184; } ping.Dispose(); this.PingsRunning--; yield return(null); yield break; }