Ejemplo n.º 1
0
        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);
 }
Ejemplo n.º 3
0
        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);
     }
 }
Ejemplo n.º 5
0
        internal static WWWItem GetPreDownloadBundle(string assetPath, ItemType type)
        {
            WWWItem wWWItem = null;
            string  text    = assetPath.ToLower();

            foreach (Dictionary <string, WWWItem> current in Holder.m_bundleGroupStack)
            {
                if (current.ContainsKey(text))
                {
                    WWWItem result = null;
                    return(result);
                }
            }
            if (Holder.ms_UndefinedStack.TryGetValue(text, out wWWItem))
            {
                return(null);
            }
            wWWItem = new WWWItem(Option.undefinedStackName);
            wWWItem.SetAssetPath(text);
            Holder.ms_UndefinedStack.Add(text, wWWItem);
            wWWItem.SetItemType(type);
            wWWItem.refCnt++;
            return(wWWItem);
        }