Beispiel #1
0
        //初始化默认配置,方便编辑
        private void CreateNative()
        {
            AddBuildData("Animator");
            AddBuildData("Audio");
            AddBuildData("AudioMixer");
            AddBuildData("BG");
            AddBuildData("Icon");
            AddBuildData("Material");
            AddBuildData("Music");
            AddBuildData("Perform");
            AddBuildData("PhysicsMaterial");
            AddBuildData("Prefab");
            AddBuildData("Scene", BuildRuleType.File);
            AddBuildData("UI");
            AddBuildData("Video");
            AddBuildData("System");
            AddBuildData("Texture");

            void AddBuildData(string name, BuildRuleType type = BuildRuleType.Directroy)
            {
                var data = new BuildRuleData();

                data.BuildRuleType  = type;
                data.SearchPath     = name;
                data.CustomRootPath = null;
                Data.Add(data);
            }
        }
Beispiel #2
0
        //添加打包规则
        public void AddBuildData(string name, BuildRuleType type = BuildRuleType.Directroy, string customRootPath = null)
        {
            var data = new BuildRuleData();

            data.BuildRuleType  = type;
            data.SearchPath     = name;
            data.CustomRootPath = customRootPath;
            Data.Add(data);
        }
Beispiel #3
0
        public DLCItem(DLCItemConfig config, AssetBundleManifest assetBundleManifest = null)
        {
            Config     = config;
            Name       = config.Name;
            IsActive   = config.IsActive;
            ABManifest = assetBundleManifest;

            BuildRuleData.Clear();
            CopyDirectory.Clear();

            foreach (var item in DLCConfig.Config)
            {
                BuildRuleData.Add(item.Clone() as BuildRuleConfig);
            }
            CopyDirectory.AddRange(DLCConfig.CopyDirectory.ToArray());

            //计算DLC的跟目录
            AssetsRootPath = CalcAssetRootPath(Name);
            //计算出绝对路径(拷贝文件使用)
            AbsRootPath = Path.Combine(Application.dataPath, AssetsRootPath.Replace("Assets/", ""));
            //计算出目标路径
            TargetPath = Path.Combine(Const.Path_StreamingAssets, Name);

            //计算Const路径
            ConstPath = Path.Combine(Const.RPath_Resources, Const.Dir_Const, Name + "Const.cs");
            //计算Manifest路径
            if (IsEditorMode)
            {
                ManifestPath = Path.Combine(AssetsRootPath, Const.Dir_Config);
            }
            else
            {
                ManifestPath = Path.Combine(TargetPath, Const.Dir_Config);
            }
            //计算Config路径
            if (IsEditorMode)
            {
                ConfigPath = Path.Combine(AssetsRootPath, Const.Dir_Config);
            }
            else
            {
                ConfigPath = Path.Combine(TargetPath, Const.Dir_Config);
            }
            //计算语言包路径
            if (IsEditorMode)
            {
                LanguagePath = Path.Combine(AssetsRootPath, Const.Dir_Language);
            }
            else
            {
                LanguagePath = Path.Combine(TargetPath, Const.Dir_Language);
            }
            //计算lua路径
            if (IsEditorMode)
            {
                LuaPath = Path.Combine(AssetsRootPath, Const.Dir_Lua);
            }
            else
            {
                LuaPath = Path.Combine(TargetPath, Const.Dir_Lua);
            }
            //计算Text路径
            if (IsEditorMode)
            {
                TextPath = Path.Combine(AssetsRootPath, Const.Dir_TextAssets);
            }
            else
            {
                TextPath = Path.Combine(TargetPath, Const.Dir_TextAssets);
            }
            //计算CS路径
            if (IsEditorMode)
            {
                CSPath = Path.Combine(AssetsRootPath, Const.Dir_CSharp);
            }
            else
            {
                CSPath = Path.Combine(TargetPath, Const.Dir_CSharp);
            }
            //计算Excel路径
            if (IsEditorMode)
            {
                ExcelPath = Path.Combine(AssetsRootPath, Const.Dir_Excel);
            }
            else
            {
                ExcelPath = Path.Combine(TargetPath, Const.Dir_Excel);
            }

            #region func
            GenerateCopyPath();
            GeneralPath();
            //建立拷贝路径
            void GenerateCopyPath()
            {
                AbsCopyDirectory.Clear();
                if (CopyDirectory != null)
                {
                    for (int i = 0; i < CopyDirectory.Count; ++i)
                    {
                        AbsCopyDirectory.Add(Path.Combine(AbsRootPath, CopyDirectory[i]));
                    }
                }
            }

            //建立打包路径
            void GeneralPath()
            {
                foreach (var item in BuildRuleData)
                {
                    string tempRootPath = AssetsRootPath;
                    if (!item.CustomRootPath.IsInv())
                    {
                        tempRootPath = item.CustomRootPath;
                    }
                    item.FullSearchPath = tempRootPath + "/" + item.Name;
                }
            }

            #endregion
        }