Beispiel #1
0
 private void OnResourceWebRequesterFail(ResourceWebRequester resourceWebRequester)
 {
     if (resultInfo.isDone)
     {
         return;
     }
     if (!waitingAssetBundleCatDict.ContainsValue(resourceWebRequester.assetBundleCat) ||
         resourceWebRequester.isNotCache)
     {
         return;
     }
     resultInfo.isFail = true;
     RemoveListener <ResourceWebRequester>(null, AssetBundleEventNameConst.On_ResourceWebRequester_Fail,
                                           OnResourceWebRequesterFail);
 }
Beispiel #2
0
 private void OnResourceWebRequesterSuccess(ResourceWebRequester resourceWebRequester)
 {
     if (resultInfo.isDone)
     {
         return;
     }
     if (!waitingAssetBundleCatDict.ContainsValue(resourceWebRequester.assetBundleCat) ||
         resourceWebRequester.isNotCache)
     {
         return;
     }
     waitingAssetBundleCatDict.Remove(resourceWebRequester.assetBundleCat.assetBundleName);
     if (waitingAssetBundleCatDict.Count == 0)
     {
         resultInfo.isSuccess = true;
     }
 }
Beispiel #3
0
        public IEnumerator LoadManifest()
        {
            var manifestRequestURL = BuildConst.ManifestBundle_Path.WithRootPath(urlRoot);

            manifestRequest = Client.instance.assetBundleManager.DownloadFileAsyncNoCache(manifestRequestURL);
            yield return(manifestRequest);

            if (manifestRequest.error.IsNullOrWhiteSpace())
            {
                manifest.LoadFromAssetBundle(manifestRequest.assetBundle);
                manifest.SaveBytes(manifestRequest.bytes);
                manifestRequest.assetBundle.Unload(false);
            }

            manifestRequest.Destroy();
            PoolCatManagerUtil.Despawn(manifestRequest);
        }
Beispiel #4
0
 private void OnResourceWebRequesterDone(ResourceWebRequester resourceWebRequester)
 {
     if (!resourceWebRequesterProcessingList.Contains(resourceWebRequester))
     {
         return;
     }
     resourceWebRequesterProcessingList.Remove(resourceWebRequester);
     resourceWebRequesterAllDict.RemoveByFunc((k, v) => v == resourceWebRequester);
     // 无缓存,不计引用计数、Creater使用后由上层回收,所以这里不需要做任何处理
     if (!resourceWebRequester.isNotCache)
     {
         var assetBundleCat = resourceWebRequester.assetBundleCat;
         // 解除webRequester对AB持有的引用
         assetBundleCat?.SubRefCount();
         resourceWebRequester.Destroy();
         PoolCatManagerUtil.Despawn(resourceWebRequester);
     }
 }
Beispiel #5
0
        private void OnResourceWebRequesterDone(ResourceWebRequester resourceWebRequester)
        {
            //    LogCat.LogError("kkkkkkkkkkkkkkk:"+resourceWebRequester.url);
            if (!downloadingRequestList.Contains(resourceWebRequester))
            {
                return;
            }

            if (!resourceWebRequester.error.IsNullOrWhiteSpace())
            {
                LogCat.LogError("Error when downloading file : " + resourceWebRequester.cache.Get <string>("file_path") +
                                "\n from url : " +
                                resourceWebRequester.url + "\n err : " + resourceWebRequester.error);
                needDownloadList.Add(resourceWebRequester.cache.Get <string>("file_path"));
            }
            else
            {
                downloadingRequestList.Remove(resourceWebRequester);
                needDownloadDict[resourceWebRequester.cache.Get <string>("file_path")]["is_finished"]     = true;
                needDownloadDict[resourceWebRequester.cache.Get <string>("file_path")]["downloded_bytes"] =
                    needDownloadDict[resourceWebRequester.cache.Get <string>("file_path")]["total_bytes"];
                var filePath = resourceWebRequester.cache.Get <string>("file_path")
                               .WithRootPath(FilePathConst.PersistentAssetBundleRoot);
                StdioUtil.WriteFile(filePath, resourceWebRequester.bytes);
            }

            resourceWebRequester.Destroy();
            PoolCatManagerUtil.Despawn(resourceWebRequester);

            //    LogCat.LogError("ffffffffffffaaaaaaa:"+downloadingRequest.Count);
            //    LogCat.LogError("ffffffffffffbbbbbbb:" + needDownloadList.Count);
            if (downloadingRequestList.Count == 0 && needDownloadList.Count == 0)
            {
                isUpdatingRes = false;
            }
        }