Ejemplo n.º 1
0
        public override bool IsDone()
        {
            if (null == m_request && null != m_downloadingError)
            {
                JSLDebug.LogError(m_downloadingError);
                return(true);
            }

            return(null != m_request && m_request.isDone);
        }
Ejemplo n.º 2
0
        public void Download(Action <AssetBundleDownloadProgress> onAssetBundleDownloadProgressChanged)
        {
            m_onAssetBundleDownloadProgressChanged = onAssetBundleDownloadProgressChanged;

            if (m_assetBundleLoadType == AssetBundleLoadType.Simulate)
            {
                JSLDebug.LogFormat("[AssetBundleManager] - The AssetBundle load type is on Simulate, don't need to download.");
                return;
            }

            if (null == m_assetBundleManifest)
            {
                JSLDebug.LogError("[AssetBundleManager] - Please download AssetBundleManifest by calling ResourceSystem.InstancenitAssetBundle() first");
                return;
            }

            JSLDebug.LogFormat("[AssetBundleManager] - Start download AssetBundle at frame {0}", Time.frameCount);

            string[]      allAssetBundles          = m_assetBundleManifest.GetAllAssetBundles();
            List <string> downloadAssetBundleNames = new List <string>();

            for (int i = 0; i < allAssetBundles.Length; i++)
            {
                if (Caching.IsVersionCached(m_downloadingURL + allAssetBundles[i], m_assetBundleManifest.GetAssetBundleHash(allAssetBundles[i])))
                {
                    continue;
                }

                downloadAssetBundleNames.Add(allAssetBundles[i]);
            }

            UnloadAssetBundles(allAssetBundles.ToList());

            for (int i = 0; i < allAssetBundles.Length; i++)
            {
                DownloadAssetBundle(allAssetBundles[i], false);
            }

            m_assetBundleDownloadProgress = new AssetBundleDownloadProgress(allAssetBundles.Length, m_assetBundleCatalogs.GetAllFileSize(downloadAssetBundleNames));
        }