public IEnumerator GetPatchVersionFromLocalStorage() { _localVersion = null; string patchVersionPath = _GetPatchVersionPath(PATCH_VERSION_PATH.LOCAL); LPetUtil.DebugLogf("Local patchversion path<{0}>", patchVersionPath); using (WWW www = new WWW(patchVersionPath)) { yield return www; if (www.error != null) { LPetUtil.DebugLogf("WWW errro, local version has an error:" + www.error); if (_IsAbleUpdateAssetBundles()) { StartCoroutine(_newVersion.DownloadSaveAssetBundles(_OnCompletedAssetBundlesDownloadSave, _OnFailedAssetBundlesDownloadSave)); } else { StartCoroutine(_GetPatchVersionFromPackage()); } yield break; } LPetUtil.DebugLogf("Local version find!"); _localVersion = new PatchVersion(); _localVersion.PatchVersionJsonParser(www.text); // Is need major update? if (_IsNeedMajorUpdate()) { // update alarm!!! and EXIT app LPetUtil.DebugLogf("App Quit"); Application.Quit(); yield break; } if (_IsAbleUpdateAssetBundles()) { StartCoroutine(_newVersion.DownloadSaveAssetBundles(_OnCompletedAssetBundlesDownloadSave, _OnFailedAssetBundlesDownloadSave)); } else { StartCoroutine(_localVersion.LoadAssetBundles(_OnCompletedAssetBundlesLoad, _OnFailedAssetBundlesLoadFromLocalStorage)); } } }
IEnumerator _GetPatchVersionFromPackage() { string patchVersionPath = _GetPatchVersionPath(PATCH_VERSION_PATH.PACKAGE); LPetUtil.DebugLogf("Package patchversion path<{0}>", patchVersionPath); using (WWW www = new WWW(patchVersionPath)) { yield return www; if (www.error != null) { LPetUtil.DebugLogf("WWW error version has an error:" + www.error); _OnFailedAssetBundlesLoad(); } _localVersion = new PatchVersion(); _localVersion.PatchVersionJsonParser(www.text); StartCoroutine(_localVersion.LoadAssetBundles(_OnCompletedAssetBundlesLoad, _OnFailedAssetBundlesLoad)); } }