Update AssetBundleBuilder

pull/13/head
hevinci 2022-06-10 10:50:27 +08:00
parent 9d4656a1f2
commit 33387e8d26
4 changed files with 5 additions and 19 deletions

View File

@ -34,10 +34,5 @@ namespace YooAsset.Editor
/// 附加后缀格式 /// 附加后缀格式
/// </summary> /// </summary>
public bool AppendExtension = false; public bool AppendExtension = false;
/// <summary>
/// 拷贝内置资源文件(首包资源文件)
/// </summary>
public bool CopyBuildinTagFiles = true;
} }
} }

View File

@ -29,7 +29,6 @@ namespace YooAsset.Editor
private PopupField<string> _encryptionField; private PopupField<string> _encryptionField;
private EnumField _compressionField; private EnumField _compressionField;
private Toggle _appendExtensionToggle; private Toggle _appendExtensionToggle;
private Toggle _copyBuildinTagFilesToggle;
public void CreateGUI() public void CreateGUI()
{ {
@ -122,14 +121,6 @@ namespace YooAsset.Editor
AssetBundleBuilderSettingData.Setting.AppendExtension = _appendExtensionToggle.value; AssetBundleBuilderSettingData.Setting.AppendExtension = _appendExtensionToggle.value;
}); });
// 拷贝首包文件
_copyBuildinTagFilesToggle = root.Q<Toggle>("CopyBuildinFiles");
_copyBuildinTagFilesToggle.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.CopyBuildinTagFiles);
_copyBuildinTagFilesToggle.RegisterValueChangedCallback(evt =>
{
AssetBundleBuilderSettingData.Setting.CopyBuildinTagFiles = _copyBuildinTagFilesToggle.value;
});
// 构建按钮 // 构建按钮
var buildButton = root.Q<Button>("Build"); var buildButton = root.Q<Button>("Build");
buildButton.clicked += BuildButton_clicked; ; buildButton.clicked += BuildButton_clicked; ;
@ -154,7 +145,6 @@ namespace YooAsset.Editor
_encryptionField.SetEnabled(enableElement); _encryptionField.SetEnabled(enableElement);
_compressionField.SetEnabled(enableElement); _compressionField.SetEnabled(enableElement);
_appendExtensionToggle.SetEnabled(enableElement); _appendExtensionToggle.SetEnabled(enableElement);
_copyBuildinTagFilesToggle.SetEnabled(buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild);
} }
private void BuildButton_clicked() private void BuildButton_clicked()
{ {
@ -175,17 +165,19 @@ namespace YooAsset.Editor
/// </summary> /// </summary>
private void ExecuteBuild() private void ExecuteBuild()
{ {
var buildMode = (EBuildMode)_buildModeField.value;
string defaultOutputRoot = AssetBundleBuilderHelper.GetDefaultOutputRoot(); string defaultOutputRoot = AssetBundleBuilderHelper.GetDefaultOutputRoot();
BuildParameters buildParameters = new BuildParameters(); BuildParameters buildParameters = new BuildParameters();
buildParameters.OutputRoot = defaultOutputRoot; buildParameters.OutputRoot = defaultOutputRoot;
buildParameters.BuildTarget = _buildTarget; buildParameters.BuildTarget = _buildTarget;
buildParameters.BuildMode = (EBuildMode)_buildModeField.value; buildParameters.BuildMode = buildMode;
buildParameters.BuildVersion = _buildVersionField.value; buildParameters.BuildVersion = _buildVersionField.value;
buildParameters.BuildinTags = _buildinTagsField.value; buildParameters.BuildinTags = _buildinTagsField.value;
buildParameters.VerifyBuildingResult = true; buildParameters.VerifyBuildingResult = true;
buildParameters.EnableAddressable = AssetBundleCollectorSettingData.Setting.EnableAddressable; buildParameters.EnableAddressable = AssetBundleCollectorSettingData.Setting.EnableAddressable;
buildParameters.AppendFileExtension = _appendExtensionToggle.value; buildParameters.AppendFileExtension = _appendExtensionToggle.value;
buildParameters.CopyBuildinTagFiles = _copyBuildinTagFilesToggle.value; buildParameters.CopyBuildinTagFiles = buildMode == EBuildMode.ForceRebuild;
buildParameters.EncryptionServices = CreateEncryptionServicesInstance(); buildParameters.EncryptionServices = CreateEncryptionServicesInstance();
buildParameters.CompressOption = (ECompressOption)_compressionField.value; buildParameters.CompressOption = (ECompressOption)_compressionField.value;

View File

@ -7,7 +7,6 @@
<ui:VisualElement name="EncryptionContainer" style="height: 24px;" /> <ui:VisualElement name="EncryptionContainer" style="height: 24px;" />
<uie:EnumField label="Compression" value="Center" name="Compression" /> <uie:EnumField label="Compression" value="Center" name="Compression" />
<ui:Toggle label="Append Extension" name="AppendExtension" style="height: 15px;" /> <ui:Toggle label="Append Extension" name="AppendExtension" style="height: 15px;" />
<ui:Toggle label="Copy BuildinTag Files" name="CopyBuildinFiles" style="height: 15px;" />
<ui:TextField picking-mode="Ignore" label="Buildin Tags" name="BuildinTags" /> <ui:TextField picking-mode="Ignore" label="Buildin Tags" name="BuildinTags" />
<ui:Button text="构建" display-tooltip-when-elided="true" name="Build" style="height: 50px; background-color: rgb(40, 106, 42); margin-top: 10px;" /> <ui:Button text="构建" display-tooltip-when-elided="true" name="Build" style="height: 50px; background-color: rgb(40, 106, 42); margin-top: 10px;" />
</ui:VisualElement> </ui:VisualElement>

View File

@ -52,7 +52,7 @@ namespace YooAsset.Editor
public bool AppendFileExtension = false; public bool AppendFileExtension = false;
/// <summary> /// <summary>
/// 拷贝内置资源文件(首包资源文件) /// 拷贝内置资源文件到StreamingAssets目录(首包资源文件)
/// </summary> /// </summary>
public bool CopyBuildinTagFiles = false; public bool CopyBuildinTagFiles = false;