public AssetBundlesDownloader(string url, string cacheFilePath) { if (!url.StartsWith("file://")) { url = $"file://{url}"; } _assetBundlesRootUrl = Path.Combine(url, AssetBundlesFileSystem.GetTargetName()); _cacheFilePath = cacheFilePath; }
public override IEnumerator LoadAssetBundle(string assetBundleName, Func <bool, IEnumerator> onComplete) { if (HasCache(assetBundleName)) { if (!IsAssetBundleLoaded(assetBundleName)) { yield return(BundleDownloadCompleted(true, AssetBundlesFileSystem.GetFullPath(assetBundleName))); } yield return(onComplete.Invoke(true)); } else { AssetBundlesDownloader downloader = new AssetBundlesDownloader(_baseUrl, AssetBundlesFileSystem.GetFullPath(assetBundleName)); yield return(downloader.DownloadFromName(assetBundleName, BundleDownloadCompleted)); yield return(onComplete.Invoke(_assetBundles.ContainsKey(assetBundleName))); } }
public override bool HasCache(string assetBundleName) => AssetBundlesFileSystem.AssetBundleExists(assetBundleName);