private IEnumerator RunAllUpdateCoroutine(string[] urls) { if (newListDownloaderState == NewListDownloaderState.Downloading) { yield break; } newListDownloaderState = NewListDownloaderState.Downloading; var cors = new List <IEnumerator>(); foreach (var url in urls) { var customCor = CustomEndCor(url); cors.Add(customCor); } var allDone = false; while (!allDone) { foreach (var cor in cors) { allDone = !cor.MoveNext(); } yield return(null); } newListDownloaderState = NewListDownloaderState.Ready; }
private void DownloadNewAssetBundleList(string url) { newListDownloaderState = NewListDownloaderState.Downloading; mainthreadDispatcher.Commit( autoya._assetBundleListDownloader.DownloadAssetBundleList( url, newList => { // got new list. OnUpdatingListReceived(newList); }, (code, reason, autoyaStatus) => { // do nothing. } ) ); }
#pragma warning restore 414 private void DownloadNewAssetBundleList(string url) { newListDownloaderState = NewListDownloaderState.Downloading; mainthreadDispatcher.Commit( autoya._assetBundleListDownloader.DownloadAssetBundleList( url, (downloadedUrl, newList) => { // got new list. OnUpdatingListReceived(newList); }, (code, reason, autoyaStatus) => { // failed to get new list. // Debug.Log("failed to download new AssetBundleList from url:" + url + " code:" + code + " reason:" + reason); newListDownloaderState = NewListDownloaderState.Ready; } ) ); }
private void OnUpdatingListReceived(AssetBundleList newList) { var assetUsingCondition = GetCurrentAssetBundleUsingCondition(newList); if (ShouldUpdateToNewAssetBundleList(assetUsingCondition)) { var result = StoreAssetBundleListToStorage(newList); if (result) { // update runtime manifest. { var newListIdentity = newList.identity; var runtimeManifest = Autoya.Manifest_LoadRuntimeManifest(); foreach (var resInfo in runtimeManifest.resourceInfos) { if (resInfo.listIdentity == newListIdentity) { resInfo.listVersion = newList.version; break; } } Autoya.Manifest_UpdateRuntimeManifest(runtimeManifest); } ReadyLoaderAndPreloader(newList); // finish downloading new assetBundleList. newListDownloaderState = NewListDownloaderState.Ready; return; } // failed to store new assetBundleList. } // finish downloading new assetBundleList. newListDownloaderState = NewListDownloaderState.Ready; return; }
private void OnUpdatingListReceived(AssetBundleList newList) { var assetUsingCondition = GetCurrentAssetBundleUsingCondition(newList); if (ShouldUpdateToNewAssetBundleList(assetUsingCondition)) { var result = StoreAssetBundleListToStorage(newList); if (result) { // update runtime manifest. set "resVersion" to downloaded version. { var runtimeManifest = Autoya.Manifest_LoadRuntimeManifest(); runtimeManifest.resVersion = newList.version; Autoya.Manifest_UpdateRuntimeManifest(runtimeManifest); } _currentAssetBundleList = newList; // discard postponed cache. _postponedNewAssetBundleList = null; // finish downloading new assetBundleList. newListDownloaderState = NewListDownloaderState.Ready; return; } // failed to store new assetBundleList. } // store on memory as postponed. // list is not updated actually. _postponedNewAssetBundleList = newList; // finish downloading new assetBundleList. newListDownloaderState = NewListDownloaderState.Ready; return; }
private IEnumerator OnUpdatingListReceived(AssetBundleList newList) { var assetUsingCondition = GetCurrentAssetBundleUsingCondition(newList); var proceed = false; var done = false; ShouldUpdateToNewAssetBundleList( assetUsingCondition, () => { done = true; proceed = true; }, () => { done = true; proceed = false; } ); while (!done) { yield return(null); } if (!proceed) { yield break; } // store AssetBundleList and renew Loader and Preloader. var result = StoreAssetBundleListToStorage(newList); if (result) { // update AssetBundleList version. OnUpdateToNewAssetBundleList(newList.identity, newList.version); ReadyLoaderAndPreloader(newList); // finish downloading new assetBundleList. newListDownloaderState = NewListDownloaderState.Ready; /* * start postprocess. */ var condition = GetCurrentAssetBundleUsingCondition(newList); var postProcessReady = false; OnAssetBundleListUpdated( condition, () => { postProcessReady = true; } ); while (!postProcessReady) { yield return(null); } yield break; } // failed to store new assetBundleList. var cor = OnNewAssetBundleListStoreFailed("failed to store new AssetBundleList to storage. maybe shortage of storage size."); while (cor.MoveNext()) { yield return(null); } // failed to store AssetBundleList. finish downloading new assetBundleList anyway. newListDownloaderState = NewListDownloaderState.Ready; }