From a348d9131d1e015ea807ef1a1dad660eff940c18 Mon Sep 17 00:00:00 2001 From: hevinci Date: Sun, 9 Oct 2022 11:54:26 +0800 Subject: [PATCH] Update AssetBundleBuilder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加首包资源文件拷贝选项 --- .../AssetBundleBuilder/AssetBundleBuilder.cs | 2 + .../AssetBundleBuilderSetting.cs | 10 +++ .../AssetBundleBuilderWindow.cs | 32 ++++++- .../AssetBundleBuilderWindow.uxml | 2 + .../AssetBundleBuilder/BuildParameters.cs | 10 +++ .../BuildTasks/TaskCopyBuildinFiles.cs | 87 +++++++++++++++++++ .../BuildTasks/TaskCopyBuildinFiles.cs.meta | 11 +++ .../BuildTasks/TaskPrepare.cs | 9 ++ .../ECopyBuildinFileOption.cs | 34 ++++++++ .../ECopyBuildinFileOption.cs.meta | 11 +++ 10 files changed, 207 insertions(+), 1 deletion(-) create mode 100644 Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCopyBuildinFiles.cs create mode 100644 Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCopyBuildinFiles.cs.meta create mode 100644 Assets/YooAsset/Editor/AssetBundleBuilder/ECopyBuildinFileOption.cs create mode 100644 Assets/YooAsset/Editor/AssetBundleBuilder/ECopyBuildinFileOption.cs.meta diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs index 838a942..2079263 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs @@ -59,6 +59,7 @@ namespace YooAsset.Editor new TaskCreatePatchManifest(), //创建清单文件 new TaskCreateReport(), //创建报告文件 new TaskCreatePatchPackage(), //制作补丁包 + new TaskCopyBuildinFiles(), //拷贝内置文件 }; } else if (buildParameters.BuildPipeline == EBuildPipeline.ScriptableBuildPipeline) @@ -73,6 +74,7 @@ namespace YooAsset.Editor new TaskCreatePatchManifest(), //创建清单文件 new TaskCreateReport(), //创建报告文件 new TaskCreatePatchPackage(), //制作补丁包 + new TaskCopyBuildinFiles(), //拷贝内置文件 }; } else diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSetting.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSetting.cs index 24d7661..19f23d4 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSetting.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSetting.cs @@ -30,6 +30,16 @@ namespace YooAsset.Editor /// public EOutputNameStyle OutputNameStyle = EOutputNameStyle.HashName; + /// + /// 首包资源文件的拷贝方式 + /// + public ECopyBuildinFileOption CopyBuildinFileOption = ECopyBuildinFileOption.None; + + /// + /// 首包资源文件的标签集合 + /// + public string CopyBuildinFileTags = string.Empty; + /// /// 加密类名称 /// diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs index 2f9934f..dd23547 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs @@ -31,6 +31,8 @@ namespace YooAsset.Editor private PopupField _encryptionField; private EnumField _compressionField; private EnumField _outputNameStyleField; + private EnumField _copyBuildinFileOptionField; + private TextField _copyBuildinFileTagsField; public void CreateGUI() { @@ -135,7 +137,7 @@ namespace YooAsset.Editor encryptionContainer.Add(_encryptionField); } - // 压缩方式 + // 压缩方式选项 _compressionField = root.Q("Compression"); _compressionField.Init(AssetBundleBuilderSettingData.Setting.CompressOption); _compressionField.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.CompressOption); @@ -157,6 +159,27 @@ namespace YooAsset.Editor AssetBundleBuilderSettingData.Setting.OutputNameStyle = (EOutputNameStyle)_outputNameStyleField.value; }); + // 首包文件拷贝选项 + _copyBuildinFileOptionField = root.Q("CopyBuildinFileOption"); + _copyBuildinFileOptionField.Init(AssetBundleBuilderSettingData.Setting.CopyBuildinFileOption); + _copyBuildinFileOptionField.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.CopyBuildinFileOption); + _copyBuildinFileOptionField.style.width = 350; + _copyBuildinFileOptionField.RegisterValueChangedCallback(evt => + { + AssetBundleBuilderSettingData.IsDirty = true; + AssetBundleBuilderSettingData.Setting.CopyBuildinFileOption = (ECopyBuildinFileOption)_copyBuildinFileOptionField.value; + RefreshWindow(); + }); + + // 首包文件的资源标签 + _copyBuildinFileTagsField = root.Q("CopyBuildinFileTags"); + _copyBuildinFileTagsField.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.CopyBuildinFileTags); + _copyBuildinFileTagsField.RegisterValueChangedCallback(evt => + { + AssetBundleBuilderSettingData.IsDirty = true; + AssetBundleBuilderSettingData.Setting.CopyBuildinFileTags = _copyBuildinFileTagsField.value; + }); + // 构建按钮 var buildButton = root.Q