Exemple #1
0
        /// <summary>
        /// 目标引用减一
        /// </summary>
        /// <param name="hashcode"></param>
        /// <returns></returns>
        public static string OverrideRequestUrlByCrc(CRequest req)
        {
            string url    = req.url;
            ABInfo abInfo = ManifestManager.GetABInfo(req.key);

            if (abInfo != null)
            {
                bool appCrc = HugulaSetting.instance != null ? HugulaSetting.instance.appendCrcToFile : false;
                if (abInfo.crc32 > 0 && appCrc)
                {
                    url = CUtils.InsertAssetBundleName(url, "_" + abInfo.crc32.ToString());
                }
            }

            return(url);
        }
Exemple #2
0
        internal void RemoveTask(ABInfo abInfo, BackGroundQueue bQueue)
        {
            loadingTasks.Remove(abInfo);
            bool isError    = abInfo.state != ABInfoState.Success;
            var  mainAbInfo = ManifestManager.GetABInfo(abInfo.abName);

            if (mainAbInfo != null)
            {
                mainAbInfo.state = abInfo.state;
            }
#if !HUGULA_NO_LOG
            Debug.LogFormat("task complete abName={0},size={1},isError={2},loadingTasks.Count={3},bQueue.count={4}", abInfo.abName, abInfo.size, isError, loadingTasks.Count, bQueue.Count);
#endif
            bQueue.Complete(abInfo, isError);

            if (!bQueue.IsError)
            {
                LoadingQueue();
            }
        }
Exemple #3
0
        /// <summary>
        /// assetbundle is done
        /// </summary>
        /// <param name="req"></param>
        /// <param name="ab"></param>
        static protected void CallOnAssetBundleComplete(CRequest req, AssetBundle ab)
        {
            if (OnAssetBundleComplete != null)
            {
                OnAssetBundleComplete(req, ab);
            }
#if HUGULA_PROFILER_DEBUG && !HUGULA_NO_LOG
            var now    = System.DateTime.Now;
            var dt1    = now - req.beginQueueTime;
            var dt2    = now - req.beginLoadTime;
            var size   = 0u;
            var abinfo = ManifestManager.GetABInfo(req.key);
            if (abinfo != null)
            {
                size = abinfo.size;
            }
            string tips = "AssetBundle";
            if (req.isShared)
            {
                tips = "Shared AssetBundle";
            }
            Debug.LogFormat("<color=#0a9a0a>{0} Request(asset={1},key={2},size={3}) alltime={4}s,loadtime={5}s,frame={6}</color>", tips, req.assetName, req.key, size, dt1.TotalSeconds, dt2.TotalSeconds, Time.frameCount);
#endif
        }
        private void _BeginDownload()
        {
            /*
             * Stream Compressed (LZMA) Mem: LZ4 compressed bundle size.  Perf: reading from disk + LZMA decompression + LZ4 compression.
             * Chunk Compressed (LZ4)   Mem: no extra memory is used.     Perf: reading from disk.
             */
            string url    = CUtils.GetAndroidABLoadPath(cRequest.url);
            var    abInfo = ManifestManager.GetABInfo(cRequest.key);

            if (abInfo != null && abInfo.size < ResourcesLoader.asyncSize)
            {
#if HUGULA_PROFILER_DEBUG
                Profiler.BeginSample("AssetBundle.LoadFromFile:" + url);
#endif
                assetBundle = AssetBundle.LoadFromFile(url);
            }
            else
            {
#if HUGULA_PROFILER_DEBUG
                Profiler.BeginSample("AssetBundle.LoadFromFileAsync:" + url);
#endif
                m_abRequest = AssetBundle.LoadFromFileAsync(url);
            }

#if HUGULA_PROFILER_DEBUG
            Profiler.EndSample();
#endif
            if (m_abRequest != null)
            {
                m_abRequest.priority = cRequest.priority;
            }

#if HUGULA_LOADER_DEBUG
            HugulaDebug.FilterLogFormat(cRequest.key, "<color=#15A0A1>1.4 AssetBundleDownloadFromDiskOperation begin Request(url={0},assetname={1},dependencies.count={3})keyHashCode{2},asyn={4},frameCount{5}</color>", cRequest.url, cRequest.assetName, cRequest.keyHashCode, cRequest.dependencies == null ? 0 : cRequest.dependencies.Length, cRequest.async, Time.frameCount);
#endif
        }