Пример #1
0
        public static List <AssetsInfo> GetDepList(Dictionary <string, List <string> > depDic)
        {
            var infoDic = new Dictionary <string, AssetsInfo>();

            foreach (var kv in depDic)
            {
                var abName = kv.Key;
                foreach (var depPath in kv.Value)
                {
                    var extension = Path.GetExtension(depPath).ToLower();
                    var category  = ABConfig.GetDepCategory(depPath);
                    var type      = ABConfig.GetAssetType(extension);
                    if (!ABConfig.IsValidDep(category, type))
                    {
                        continue;
                    }
                    if (!infoDic.ContainsKey(depPath))
                    {
                        infoDic[depPath] = new AssetsInfo()
                        {
                            path      = depPath,
                            category  = category,
                            type      = type,
                            name      = Path.GetFileNameWithoutExtension(depPath),
                            extension = extension,
                            abName    = GetABName(depPath),
                            size      = 0,
                        };
                    }
                    infoDic[depPath].AddRefAB(abName);
                }
            }
            return(infoDic.Values.ToList());
        }
Пример #2
0
        private static void SetDepInfoAB(AssetsInfo info)
        {
            var abConfig = ABConfig.Instance;

            if (info.type == AssetsType.Shader)
            {
                SetAB(info.path, abConfig.ab_prefix_shader);
            }
            else
            {
                if (info.refCount > 1)
                {
                    info.size = ABHelper.GetAssetSize(info.path);
                    var abName = ABConfig.GetDepNeedSetABName(info);
                    if (!string.IsNullOrEmpty(abName))
                    {
                        SetDepAB(info.path, abName);
                    }
                }
                else
                {
                    if (info.category == AssetsCategory.Scene)
                    {
                        if (info.type == AssetsType.Texture || info.type == AssetsType.Asset)
                        {
                            var abName = info.GetFirstRefAB();
                            SetDepAB(info.path, ABConfig.GetABNameWithDepSuffix(abName));
                        }
                    }
                }
            }
        }
Пример #3
0
 internal static string GetDepNeedSetABName(AssetsInfo info)
 {
     if (IsNeedSetSingleABName(info))
     {
         return(GetDepSingleABName(info));
     }
     else
     {
         return(GetDepCommonABName(info));
     }
 }
Пример #4
0
        internal static string GetDepSingleABName(AssetsInfo info)
        {
            switch (info.category)
            {
            case AssetsCategory.Model:
                if (info.type == AssetsType.Texture || info.type == AssetsType.Prefab ||
                    info.type == AssetsType.Asset)
                {
                    return(Instance.ab_prefix_model_dep + info.name.ToLower());
                }
                break;

            case AssetsCategory.Scene:
                if (info.type == AssetsType.Texture || info.type == AssetsType.Prefab ||
                    info.type == AssetsType.Asset)
                {
                    return(Instance.ab_prefix_scene_dep + info.name.ToLower());
                }
                break;
            }
            return(null);
        }
Пример #5
0
        internal static string GetDepCommonABName(AssetsInfo info)
        {
            switch (info.category)
            {
            case AssetsCategory.Model:
                if (info.type == AssetsType.Texture)
                {
                    return(Instance.ab_prefix_model_dep_common_tex + GetCommonDepIndex(info.path));
                }
                break;

            case AssetsCategory.Scene:
                if (info.type == AssetsType.Texture)
                {
                    return(Instance.ab_prefix_scene_dep_common_tex + GetCommonDepIndex(info.path));
                }
                else if (info.type == AssetsType.Asset)
                {
                    return(Instance.ab_prefix_scene_dep_common_asset + GetCommonDepIndex(info.path));
                }
                break;
            }
            return(null);
        }
Пример #6
0
 internal static bool IsNeedSetSingleABName(AssetsInfo info)
 {
     return((info.category == AssetsCategory.Model && info.size > Instance.ab_dep_single_size_limit_model) ||
            (info.category == AssetsCategory.Scene && info.size > Instance.ab_dep_single_size_limit_scene));
 }