/// <summary> /// 检查是否已经从网络下载 /// </summary> protected WWW IsLoadAssetBundleAtInternal(string assetBundleName) { //已经存在了呀 LOAssetBundle bundle = LOAssetCache.GetBundleCache(assetBundleName); if (bundle != null) { //保留一次 bundle.Retain(); return(null); } //如果WWW缓存策略中包含有对应的关键字,则返回null if (LOAssetCache.InWWWCache(assetBundleName)) { return(null); } //创建下载链接 WWW www = new WWW(LOAssetManager.URI + assetBundleName); //加入缓存策略 LOAssetCache.SetWWWCache(assetBundleName, www); return(www); }
/// <summary> /// 检查是否已经从网络下载 /// </summary> protected WWW IsLoadAssetBundleAtInternal(string assetBundleName, int version = 0) { //已经存在了 var bundle = cache.GetBundleCache(assetBundleName); if (bundle != null) { //保留一次 bundle.Retain(); return(null); } //如果WWW缓存策略中包含有对应的关键字,则返回null if (cache.InWWWCache(assetBundleName)) { return(null); } //创建下载链接 string url = URI + assetBundleName; com.QH.QPGame.GameUtils.Logger.Res.Log("load ab from url. Url:" + url); /*Debug.Log("Version cached. Value:" + Caching.IsVersionCached(url, 0)); * Debug.Log("Caching maximumAvailableDiskSpace:" + Caching.maximumAvailableDiskSpace); * Debug.Log("Caching spaceFree:" + Caching.spaceFree); * Debug.Log("Caching spaceOccupied:" + Caching.spaceOccupied); */ WWW www = null; if (Caching.enabled) { www = WWW.LoadFromCacheOrDownload(url, version); } else { www = new WWW(url); } //加入缓存策略 cache.SetWWWCache(assetBundleName, www); return(www); }