public IEnumerator startPatch() { // loading local patch info PatchMessage = "Checking new version..."; process = 0; string localpath = Application.persistentDataPath + "/" + CommonPatcherData.patchVersionFN; XmlDocument localVerDoc = XmlTool.loadXml(localpath); if (localVerDoc != null) { PatchVersion.setVersion(localVerDoc.SelectSingleNode("/VERSIONS/PATCH").Attributes ["LastVersion"].Value); } // loading latest patch info string infofile = PatchURL + "/" + CommonPatcherData.patchVersionFN; WWW patchInfo = new WWW(infofile); yield return(patchInfo); if (patchInfo.error == null) { XmlDocument xmlDoc = XmlTool.loadXml(patchInfo.bytes); string newVersion_Folder = xmlDoc.SelectSingleNode("/VERSIONS/PATCH").Attributes ["LastVersion"].Value; if (!PatchVersion.isEqualToLocalVersion(newVersion_Folder)) { // proc update PatchMessage = "Start updating..."; // get list to update yield return(instance.StartCoroutine(instance.getPatchInfo(xmlDoc))); // startcoroutine for all list } if (patchErrorCount > 0) { PatchProgress = 100; } else { PatchMessage = "Finish !"; PatchProgress = 100; File.WriteAllBytes(localpath, patchInfo.bytes); } } else { Debug.LogError("Patch Error : " + patchInfo.error); PatchMessage = "Error..." + infofile; PatchProgress = 100; PatchErrorCount = 1; } }
// Use this for initialization IEnumerator Start() { yield return(StartCoroutine(Initialize())); EasyPatcher patcher = GameObject.Find("EasyPatcherPrefab").GetComponent <EasyPatcher> (); EasyPatcher.SetRepogitory("http://localhost/test/"); yield return(patcher.StartCoroutine(patcher.startPatch())); if (EasyPatcher.PatchErrorCount == 0) { // Load asset. yield return(StartCoroutine(Load(assetBundleName, assetName))); // Unload assetBundles. AssetBundleManager.UnloadAssetBundle(assetBundleName); } else { yield break; } }