public static void REQ_ASSETBUNDLE(string resPath, PostProcPerItem callback, object obj)
        {
            WWWItem wWWItem = Holder.TryGetOrCreateBundle(resPath, null);

            wWWItem.SetItemType(ItemType.USER_ASSETB);
            wWWItem.SetCallback(callback, obj);
            TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem, DownGroup.RUNTIME, false);
        }
 internal bool _RequestPreDownload(string listFileName, PreDownloader.DownlaodToComplete callback)
 {
     if (!Option.EnablePreDownload)
     {
         TsLog.LogWarning("[PreDownload] Request( \"{0}\" ) => Disalbe Pre-Download.", new object[]
         {
             listFileName
         });
         return(false);
     }
     BackgroundInstall.Progress progress;
     if (BackgroundInstall.ms_ProgressCollection.TryGetValue(listFileName, out progress) && progress.downloading)
     {
         TsLog.LogWarning("[PreDownload] Request( \"{0}\" ) => alreay request pre-download.", new object[]
         {
             listFileName
         });
         return(false);
     }
     if (Path.HasExtension(listFileName))
     {
         WWWItem wWWItem = Holder.TryGetOrCreateBundle(listFileName, Option.undefinedStackName);
         if (wWWItem == null)
         {
             TsLog.LogWarning("[PreDownload] Request( \"{0}\" ) => cannot read file from AssetBundle.", new object[]
             {
                 listFileName
             });
             return(false);
         }
         wWWItem.SetCallback(new PostProcPerItem(this._DownloadComplete_ListFile), callback);
         wWWItem.SetItemType(ItemType.USER_STRING);
         TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem, DownGroup.RUNTIME, true);
     }
     else
     {
         TextAsset textAsset = ResourceCache.LoadFromResourcesImmediate(string.Format("PreDownload/{0}", listFileName)) as TextAsset;
         if (!textAsset)
         {
             TsLog.LogWarning("[PreDownload] Request( \"{0}\" ) => cannot read file from resources.", new object[]
             {
                 listFileName
             });
             return(false);
         }
         this._DownloadAssets(listFileName, textAsset.text, callback);
     }
     return(true);
 }
        public static bool RequestDownloadWebFile(string url, bool unloadAfterPostProcess, PostProcPerItem downlaodCompleteCallbak, object callbackParam)
        {
            if (!Helper._CheckUrl(url))
            {
                return(false);
            }
            WWWItem wWWItem = Holder.TryGetOrCreateBundle(url, Helper.WebFileBundleStackName, true);

            if (wWWItem == null)
            {
                return(false);
            }
            wWWItem.SetItemType(ItemType.USER_BYTESA);
            wWWItem.SetCallback(downlaodCompleteCallbak, callbackParam);
            TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem, DownGroup.RUNTIME, unloadAfterPostProcess);
            return(true);
        }
 internal bool _IsCached(string listFileName, bool fullLog, StringBuilder targetLog, PreDownloader.CachingReport callback)
 {
     if (Path.HasExtension(listFileName))
     {
         WWWItem wWWItem = Holder.TryGetOrCreateBundle(listFileName, Option.undefinedStackName);
         if (wWWItem != null)
         {
             wWWItem.SetCallback(new PostProcPerItem(this._DownloadComplete_ListFile_ForReporting), new BackgroundInstall.CachingReportPack(listFileName, fullLog, targetLog, callback));
             wWWItem.SetItemType(ItemType.USER_STRING);
             TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem, DownGroup.RUNTIME, true);
             return(true);
         }
         TsLog.LogWarning("[PreDownload] Request( \"{0}\" ) => cannot read file from AssetBundle.", new object[]
         {
             listFileName
         });
         return(false);
     }
     else
     {
         TextAsset textAsset = ResourceCache.LoadFromResourcesImmediate(string.Format("{0}{1}", "PreDownload/", listFileName)) as TextAsset;
         if (textAsset)
         {
             float cachedRate = this._CachingReport(listFileName, textAsset.text, fullLog, targetLog);
             if (callback != null)
             {
                 callback(listFileName, cachedRate, targetLog);
             }
             return(true);
         }
         if (targetLog != null)
         {
             targetLog.AppendFormat("{0} => error (refresh asset database, please.)", listFileName);
             targetLog.AppendLine();
         }
         TsLog.LogWarning("[PreDownload] IsCached( \"{0}\" ) => cannot read file from resources.", new object[]
         {
             listFileName
         });
         return(false);
     }
 }
 private static void _PreDownloadRequest(string assetPath, ref List <WWWItem> reqPreloadList, bool skipDuplicationCheck, object param)
 {
     if (reqPreloadList == null)
     {
         TsLog.LogWarning("[PreDownalod] reqPreloadList param is null!", new object[0]);
     }
     else
     {
         WWWItem wWWItem;
         if (skipDuplicationCheck)
         {
             wWWItem = Holder.TryGetOrCreateBundle(assetPath, Option.undefinedStackName);
         }
         else
         {
             wWWItem = Holder.GetPreDownloadBundle(assetPath, ItemType.UNDEFINED);
         }
         if (wWWItem == null)
         {
             if (Option.EnableTrace)
             {
                 TsLog.Log("[PreDownload] _PreDownloadRequest( AssetPath=\"{0}\", Type={1} ) => already created WWWItem.", new object[]
                 {
                     assetPath,
                     ItemType.UNDEFINED
                 });
             }
         }
         else
         {
             if (Option.EnablePreDownloadHistory)
             {
                 Helper._WriteToHistory(wWWItem);
             }
             wWWItem.SetCallback(new PostProcPerItem(Helper.DisposeDownloadedWWW), param);
             reqPreloadList.Add(wWWItem);
         }
     }
 }
Beispiel #6
0
 public static WWWItem TryGetOrCreateBundle(string key, string stackName)
 {
     return(Holder.TryGetOrCreateBundle(key, stackName, false));
 }