private IEnumerator check_update() { label.text = @"检查更新中..."; versionCode = LMVersion.getVersion_list().Split('.'); Baseurl = AllAdrList.list["Android"]; QiangGengAddress = AllAdrList.list["PackagePath"]; string bigVersionPath = URLAntiCacheRandomizer.RandomURL(Baseurl + "Version.txt"); WWW versionLoader = new WWW(bigVersionPath); yield return(versionLoader); if (versionLoader.error == null && versionLoader.isDone) { Debug.Log("==>" + versionLoader.url); newversionCode = versionLoader.text.Split('.'); Debug.Log(versionLoader.text); if (versionCode[0].Equals(newversionCode[0]) && versionCode[1].Equals(newversionCode[1])) { bundleExtractor.StartLoading(OnCopyToCacheEnd); } else { //bundleExtractor.StartLoading(OnCopyToCacheEnd); Debug.Log("版本检查需要更新"); } } StopCoroutine("check_update"); }
private IEnumerator HashCodeLoad() { Debug.Log("copyFileEnd !!!!"); WWW versionLoader = new WWW(URLAntiCacheRandomizer.RandomURL(Baseurl + "/v.txt")); yield return(versionLoader); if (versionLoader.error == null && versionLoader.isDone) { string[] result = versionLoader.text.Split('\n'); foreach (string line in result) { if (line.Length > 0) { loadList.Add(line); } } //这里只是把服务器的v.txt列表传入后,和本地文件对比,如果名字不同或者版本不同。就做为下载文件 totalMtoLoad = BundleManager.getIns().TotalBytesToload(loadList); if (totalMtoLoad > 0) { NoticeUI.SetActive(true); } else { Debug.Log("检查文件正常,进入下一个scene"); StartCoroutine(LoadNextScene()); } } Debug.Log("totalMtoLoad=" + totalMtoLoad); }
IEnumerator RequestXml() { this.xmlLoader = new WWW(URLAntiCacheRandomizer.RandomURL(ServerAddress)); Debug.Log(xmlLoader.url); label.text = @"连接服务器中....."; yield return(this.xmlLoader); if (this.xmlLoader.error == null && this.xmlLoader.isDone) { SecurityParser xml = new SecurityParser(); xml.LoadXml(this.xmlLoader.text); Debug.Log(this.xmlLoader.text); label.text = @"服务器地址加载中"; SecurityElement root = xml.ToXml(); AllAdrList.InitList(root); StartCoroutine(check_update()); } else { label.text = @"服务器地址加载出错"; Debug.Log(this.xmlLoader.error); } StopCoroutine(RequestXml()); }