/// <summary>
        /// 设置AB名
        /// </summary>
        public bool SetABName(string assetName, string newABName, SetABNameMode mode = SetABNameMode.Simple)
        {
            //1.如果ab名被修改过,说明有其他规则影响,需要理清打包规则。(比如散图打成图集名)
            //2.如果资源被其他资源引用,修改ab名,需要修改所有引用该ab的名字

            //AssetData assetdata = this.AssetDataMaps.


            return(false);
        }
예제 #2
0
        /// <summary>
        /// 设置AB名(颗粒度)
        /// </summary>
        public bool SetABName(string assetName, string newABName, SetABNameMode setNameMode = SetABNameMode.Simple, string changelog = "")
        {
            //1.如果ab名被修改过,说明有其他规则影响,需要理清打包规则。(比如散图打成图集名)
            //2.如果资源被其他资源引用,修改ab名,需要修改所有引用该ab的名字

            bool isCanSetABName   = false;
            bool isSetAllDependAB = false;

            this.AssetInfoMap.TryGetValue(assetName, out var assetData);
            //
            if (assetData != null)
            {
                switch (setNameMode)
                {
                //未被其他规则设置过abname,可以直接修改
                case SetABNameMode.Simple:
                {
                    //AB名和资源名相等说明没有被修改过
                    if (assetData.ABName.Equals(assetName, StringComparison.OrdinalIgnoreCase) || assetData.ABName == newABName)
                    {
                        isCanSetABName = true;
                    }
                }
                break;

                //强行修改
                case SetABNameMode.Force:
                {
                    isCanSetABName = true;
                }
                break;

                //强行修改 并且修改所有AB引用
                case SetABNameMode.ForceAndFixAllRef:
                {
                    isCanSetABName   = true;
                    isSetAllDependAB = true;
                }
                break;
                }
            }


            if (isCanSetABName)
            {
                assetData.ABName = newABName;
            }

            //设置所有依赖的AB name
            if (isSetAllDependAB)
            {
                //刷新整个列表替换
                foreach (var assetItem in this.AssetInfoMap)
                {
                    //依赖替换
                    for (int i = 0; i < assetItem.Value.DependAssetList.Count; i++)
                    {
                        if (assetItem.Value.DependAssetList[i] == assetName)
                        {
                            assetItem.Value.DependAssetList[i] = newABName;
                        }
                    }
                }
            }


            return(isCanSetABName);
        }