Пример #1
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));
                        }
                    }
                }
            }
        }
Пример #2
0
        private static void SetScenePrefabABName(ref List <AssetsInfo> depList)
        {
            var targetList = new List <AssetsInfo>();

            for (int i = depList.Count - 1; i >= 0; i--)
            {
                var info = depList[i];
                if (info.category != AssetsCategory.Model && info.category != AssetsCategory.UI &&
                    info.refCount > 1 &&
                    string.IsNullOrEmpty(info.abName) &&
                    info.extension.Equals(".prefab"))
                {
                    targetList.Add(info);
                    SetDepAB(info.path, ABConfig.GetSceneDepPrefabABName(info.name));
                    depList.Remove(info);
                }
            }
            var list = ABHelper.GetDepList(ABHelper.GetDependencies(targetList));

            foreach (var info in list)
            {
                if (info.type != AssetsType.Shader)
                {
                    var abName = info.GetFirstRefAB();
                    SetDepAB(info.path, ABConfig.GetSceneDepPrefabABName(abName));
                }
            }
        }
Пример #3
0
        /// <summary>
        /// 场景材质球和它关联的贴图一起打AB,如果贴图依赖大于1时,贴图单独打
        /// </summary>
        /// <param name="depList"></param>
        private static void SetSceneMaterialABName(ref List <AssetsInfo> depList)
        {
            var targetList = new List <AssetsInfo>();

            for (int i = depList.Count - 1; i >= 0; i--)
            {
                var info = depList[i];
                if (info.type == AssetsType.Material &&
                    info.category != AssetsCategory.Model && info.category != AssetsCategory.UI &&
                    string.IsNullOrEmpty(info.abName))
                {
                    targetList.Add(info);
                    SetAB(info.path, ABConfig.GetSceneDepMaterialABName(info.name));
                    depList.Remove(info);
                }
            }
            var list = ABHelper.GetDepList(ABHelper.GetDependencies(targetList));

            foreach (var info in list)
            {
                if (info.type != AssetsType.Shader)
                {
                    if (info.refCount > 1)
                    {
                        SetABIfEmpty(info.path, info.name.ToLower());
                    }
                    else
                    {
                        var abName = info.GetFirstRefAB();
                        SetABIfEmpty(info.path, ABConfig.GetSceneDepMaterialABName(abName));
                    }
                }
            }
        }
Пример #4
0
        public static void ResetAllDepABNameByAnalyzeDepdencies()
        {
            BuildLog.Log("ResetAllDepABNameByAnalyzeDepdencies ...");
            var depList = ABHelper.GetDepList(ABHelper.GetAllDependencies());

            ClearAllDepABName(depList);
            SetSceneMaterialABName(ref depList);
            SetScenePrefabABName(ref depList);
            SetDepABName(depList);
            SetShaderABName();
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
            BuildLog.Log("ResetAllDepABNameByAnalyzeDepdencies DONE!");
        }