// Token: 0x06005129 RID: 20777 RVA: 0x001BB3F0 File Offset: 0x001B97F0 private IEnumerator DownloadAndUnpackAssetBundleCoroutine(string url, string assetId, int assetVersion, string pluginUrl, OnDownloadProgressDelegate onProgress, AssetBundleDownloadManager.OnDownloadCompleted onSuccess, AssetBundleDownloadManager.OnDownloadError onError, AssetBundleDownloadManager.UnpackType unpackType, int retryCount = 0, int downloadId = 0, bool forceRefreshCache = false) { AssetBundleDownload download = new AssetBundleDownload(url, unpackType); download.onDownloadCompleted = onSuccess; download.onDownloadError = onError; download.onProgress = onProgress; download.retryCount = retryCount; download.forceRefreshCache = forceRefreshCache; download.assetId = assetId; download.assetVersion = assetVersion; download.pluginUrl = pluginUrl; download.onPluginLoadError = delegate(string message) { Debug.LogError("Plugin failed to load: " + message); if (!download.forceRefreshCache) { download.forceRefreshCache = true; this.StartCoroutine(this.DownloadAndUnpackAssetBundleCoroutine(download)); } else { download.OnDownloadError("Plugin failed to load: " + message, LoadErrorReason.PluginLoadFailed); } }; if (Player.Instance != null && Player.Instance.isInternal) { Debug.Log(string.Concat(new object[] { "[", download.downloadId, "] Downloading asset: '", download.assetUrl, "'" })); } if (string.IsNullOrEmpty(download.assetUrl)) { download.OnDownloadError("URL is empty", LoadErrorReason.InvalidURL); yield break; } if (downloadId > 0) { download.downloadId = downloadId; } bool hasExistingDownload = this.mAssetBundleDownloads.ContainsKey(download.assetUrl); if (!hasExistingDownload) { this.mAssetBundleDownloads[download.assetUrl] = download; } if (download.assetUrl.StartsWith("file")) { if (!string.IsNullOrEmpty(download.pluginUrl)) { yield return(this.DownloadAndLoadLocalPlugin(download)); } if (download.currentState == AssetBundleDownload.State.Error) { yield break; } if (this.CheckForCancellation(download)) { yield break; } if (!string.IsNullOrEmpty(download.assetUrl)) { yield return(this.RequestLocalAssetBundle(download, hasExistingDownload)); } yield return(this.WaitForAssetToLoad(download)); } else { UnityEngine.Object asset = AssetBundleDownloadManager.Instance.GetLoadedAsset(download.assetUrl); if (asset == null) { download.currentState = AssetBundleDownload.State.WaitingForRequestToBeSent; if (!string.IsNullOrEmpty(download.pluginUrl) && PluginManager.IsAllowedUrl(download.pluginUrl)) { yield return(this.DownloadAndLoadRemotePlugin(download)); } else { download.pluginUrl = null; } if (download.currentState == AssetBundleDownload.State.Error) { yield break; } if (this.CheckForCancellation(download)) { yield break; } if (!string.IsNullOrEmpty(download.assetUrl)) { yield return(this.RequestRemoteAssetBundle(download, hasExistingDownload)); } yield return(this.WaitForAssetToLoad(download)); } else { VRC.Core.Logger.Log(string.Concat(new object[] { "[", download.downloadId, "] Asset: ", download.assetUrl, " already loaded." }), DebugLevel.AssetBundleDownloadManager); download.asset = asset; download.OnDownloadCompleted(); } } yield break; }
// Token: 0x06005118 RID: 20760 RVA: 0x001BAC50 File Offset: 0x001B9050 public void DownloadAssetBundle(ApiWorld world, OnDownloadProgressDelegate onProgress, AssetBundleDownloadManager.OnDownloadCompleted onSuccess, AssetBundleDownloadManager.OnDownloadError onError, AssetBundleDownloadManager.UnpackType unpackType) { base.StartCoroutine(this.DownloadAndUnpackAssetBundleCoroutine(world.assetUrl, world.id, world.version, world.pluginUrl, onProgress, onSuccess, onError, unpackType, 0, 0, false)); }
// Token: 0x06005119 RID: 20761 RVA: 0x001BAC8C File Offset: 0x001B908C public void DownloadAssetBundle(ApiAvatar avatar, OnDownloadProgressDelegate onProgress, AssetBundleDownloadManager.OnDownloadCompleted onSuccess, AssetBundleDownloadManager.OnDownloadError onError, AssetBundleDownloadManager.UnpackType unpackType) { base.StartCoroutine(this.DownloadAndUnpackAssetBundleCoroutine(avatar.assetUrl, avatar.id, avatar.version, null, onProgress, onSuccess, onError, unpackType, 0, 0, false)); }
// Token: 0x06005153 RID: 20819 RVA: 0x001BDFAC File Offset: 0x001BC3AC public static void DownloadAssetBundle(ApiWorld world, OnDownloadProgressDelegate onProgress = null, AssetBundleDownloadManager.OnDownloadCompleted onSuccess = null, AssetBundleDownloadManager.OnDownloadError onError = null, AssetBundleDownloadManager.UnpackType unpackType = AssetBundleDownloadManager.UnpackType.Async) { if (Downloader.downloadManager == null) { Downloader.InitializeDownloadManager(); } AssetBundleDownloadManager.Instance.DownloadAssetBundle(world, onProgress, onSuccess, onError, unpackType); }