public void Dispose() { if (_endpoint != null) { _endpoint.Dispose(); _endpoint = null; } }
IEnumerator DoCheckServer() { if (string.IsNullOrEmpty(_baseUrl)) { yield break; } #if UNITY_IPHONE if (Application.internetReachability == NetworkReachability.NotReachable) { yield break; } #endif if (!DownloadOverCarrierDataNetwork && Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork) { // todo: prompt? yield break; } _endpoint = new Sparx.HttpEndPoint(_baseUrl, new Sparx.EndPointOptions { KeepAlive = false }); var request = _endpoint.Get("/content"); request.AddQuery("platform", Sparx.Device.MobilePlatform); request.AddQuery("cl", Mathf.Max(1, EB.Version.GetChangeList())); request.AddQuery("udid", Sparx.Device.UniqueIdentifier); request.numRetries = 2; Response r = null; yield return(_endpoint.ServiceCoroutine(request, delegate(Response result){ r = result; })); if (r.sucessful) { if (r.hashtable == null) { EB.Debug.Log("server has no content packs, removing old ones"); _packs.Clear(); yield break; } var version = Dot.Integer("cl", r.hashtable, 0); var pack = GetPack(version); if (pack == null) { EB.Debug.Log("Downloading new pack " + version); yield return(Coroutines.Run(DoDownload(r.hashtable))); } else { EB.Debug.Log("already have pack, mounting " + version); Mount(pack); } yield break; } else { EB.Debug.Log("Check for content failed: " + r.localizedError); yield break; } }