Ejemplo n.º 1
0
        private List <BundleInfo> GetDownloadListByPaths(AssetInfo[] assetInfos)
        {
            // 获取资源对象的资源包和所有依赖资源包
            List <PatchBundle> checkList = new List <PatchBundle>();

            foreach (var assetInfo in assetInfos)
            {
                if (assetInfo.IsInvalid)
                {
                    YooLogger.Warning(assetInfo.Error);
                    continue;
                }

                string mainBundleName = LocalPatchManifest.GetBundleName(assetInfo.AssetPath);
                if (LocalPatchManifest.Bundles.TryGetValue(mainBundleName, out PatchBundle mainBundle))
                {
                    if (checkList.Contains(mainBundle) == false)
                    {
                        checkList.Add(mainBundle);
                    }
                }

                string[] dependBundleNames = LocalPatchManifest.GetAllDependencies(assetInfo.AssetPath);
                foreach (var dependBundleName in dependBundleNames)
                {
                    if (LocalPatchManifest.Bundles.TryGetValue(dependBundleName, out PatchBundle dependBundle))
                    {
                        if (checkList.Contains(dependBundle) == false)
                        {
                            checkList.Add(dependBundle);
                        }
                    }
                }
            }

            List <PatchBundle> downloadList = new List <PatchBundle>(1000);

            foreach (var patchBundle in checkList)
            {
                // 忽略缓存文件
                if (DownloadSystem.ContainsVerifyFile(patchBundle.Hash))
                {
                    continue;
                }

                // 忽略APP资源
                // 注意:如果是APP资源并且哈希值相同,则不需要下载
                if (AppPatchManifest.Bundles.TryGetValue(patchBundle.BundleName, out PatchBundle appPatchBundle))
                {
                    if (appPatchBundle.IsBuildin && appPatchBundle.Hash == patchBundle.Hash)
                    {
                        continue;
                    }
                }

                downloadList.Add(patchBundle);
            }

            return(ConvertToDownloadList(downloadList));
        }
Ejemplo n.º 2
0
        BundleInfo IBundleServices.GetBundleInfo(AssetInfo assetInfo)
        {
            if (assetInfo.IsInvalid)
            {
                throw new Exception("Should never get here !");
            }

            string bundleName = LocalPatchManifest.GetBundleName(assetInfo.AssetPath);

            return(CreateBundleInfo(bundleName));
        }
Ejemplo n.º 3
0
        BundleInfo[] IBundleServices.GetAllDependBundleInfos(AssetInfo assetInfo)
        {
            if (assetInfo.IsInvalid)
            {
                throw new Exception("Should never get here !");
            }

            var depends = LocalPatchManifest.GetAllDependencies(assetInfo.AssetPath);
            List <BundleInfo> result = new List <BundleInfo>(depends.Length);

            foreach (var bundleName in depends)
            {
                BundleInfo bundleInfo = CreateBundleInfo(bundleName);
                result.Add(bundleInfo);
            }
            return(result.ToArray());
        }
Ejemplo n.º 4
0
 string IBundleServices.MappingToAssetPath(string location)
 {
     return(LocalPatchManifest.MappingToAssetPath(location));
 }