Пример #1
0
        public static void LoadFileManifest(System.Action onComplete)
        {
            var fileListName = Common.CRC32_FILELIST_NAME;
            var url          = CUtils.PathCombine(CUtils.GetRealStreamingAssetsPath(), CUtils.GetRightFileName(fileListName));

            url = CUtils.GetAndroidABLoadPath(url);
            AssetBundle ab = AssetBundle.LoadFromFile(url);

            if (ab != null)
            {
                var assets = ab.LoadAllAssets <FileManifest>();
                if (assets.Length > 0)
                {
                    ManifestManager.fileManifest = assets[0];
                }
                else
                {
                    Debug.LogWarning("there is no fileManifest in StreamingAssetsPath use (Hugula/BUild For Bublish) build ");
                }

#if HUGULA_LOADER_DEBUG || UNITY_EDITOR
                Debug.LogFormat("LoadFileManifest 1 {0} is done !\r\n ManifestManager.fileManifest.count = {1}", url, ManifestManager.fileManifest.Count);
#endif
                ab.Unload(false);
            }

            if (onComplete != null)
            {
                onComplete();
            }
        }
Пример #2
0
        //同步加载
        internal void StartSync()
        {
            m_start = true;
            url     = ResourcesLoader.GetAssetBundleDownloadingURL(assetBundleName); // set full url
            url     = CUtils.GetAndroidABLoadPath(url);
            var assetBundle = AssetBundle.LoadFromFile(url);

            m_Done(assetBundle);
        }
Пример #3
0
        public void Start()
        {
            m_start = true;
            var cacheData = CacheManager.TryGetCache(assetBundleName);

            if (!cacheData.canUse)                                                           //判断ab是否已经加载防止同步加载
            {
                url         = ResourcesLoader.GetAssetBundleDownloadingURL(assetBundleName); // set full url
                url         = CUtils.GetAndroidABLoadPath(url);
                m_abRequest = AssetBundle.LoadFromFileAsync(url);
                CacheManager.SetCacheDataLoding(assetBundleName);//修改为loading状态
            }
        }
Пример #4
0
        void m_Start()
        {
#if HUGULA_LOADER_DEBUG
            HugulaDebug.FilterLogFormat(cRequest.key, " <color=#15A0A1> 1 AssetBundle  Request(assetName={0}) key={1},frame={2} </color>", cRequest.assetName, cRequest.key, Time.frameCount);
#endif
            if (cRequest.url.StartsWith("http"))
            {
                m_UnityWebRequest = UnityWebRequest.GetAssetBundle(cRequest.url);
                m_abRequest       = m_UnityWebRequest.Send();
            }
            else
            {
                cRequest.url = ResourcesLoader.GetAssetBundleDownloadingURL(cRequest.vUrl);  // set full url
                string url = CUtils.GetAndroidABLoadPath(cRequest.url);
                // var abInfo = ManifestManager.GetABInfo (cRequest.key);
                // if (abInfo != null && abInfo.size < ResourcesLoader.asyncSize) {
                //     assetBundle = AssetBundle.LoadFromFile (url);
                // } else {
                m_abRequest = AssetBundle.LoadFromFileAsync(url);
            }
            frameBegin = Time.frameCount;
        }
        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
        }