public void CheckAccess(OnCheckResponseDelegate OnResponse) { if (UnityEngine.Application.internetReachability == NetworkReachability.NotReachable) { OnResponse(false); return; } if (!this.HasAddress) { if (!this.resolvingIpAddress) { this.resolveThread = new Thread(new ThreadStart(this.ResolveIpAddress)); this.resolveThread.Start(); } this.waitingCheck = true; this.OnCheckResponse = (OnCheckResponseDelegate)Delegate.Combine(this.OnCheckResponse, OnResponse); } else if (this.resolvingConnectivity) { this.OnCheckResponse = (OnCheckResponseDelegate)Delegate.Combine(this.OnCheckResponse, OnResponse); } else if (Time.realtimeSinceStartup - this.lastCheck > 10f) { this.OnCheckResponse = (OnCheckResponseDelegate)Delegate.Combine(this.OnCheckResponse, OnResponse); base.StartCoroutine(this.CheckAccess(15f)); this.lastCheck = Time.realtimeSinceStartup; } else { OnResponse(this.connected); } }
public void UnsubscribeFromResponse(OnCheckResponseDelegate OnResponse) { this.OnCheckResponse = (OnCheckResponseDelegate)Delegate.Remove(this.OnCheckResponse, OnResponse); }