parent
0dcbe0574c
commit
2dd3ba847e
|
@ -16,7 +16,7 @@ namespace YooAsset.Editor
|
||||||
public EBuildMode BuildMode = EBuildMode.ForceRebuild;
|
public EBuildMode BuildMode = EBuildMode.ForceRebuild;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 内置资源标签
|
/// 内置资源标签(首包资源标签)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string BuildTags = string.Empty;
|
public string BuildTags = string.Empty;
|
||||||
|
|
||||||
|
@ -34,5 +34,10 @@ namespace YooAsset.Editor
|
||||||
/// 附加后缀格式
|
/// 附加后缀格式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AppendExtension = false;
|
public bool AppendExtension = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 拷贝内置资源文件(首包资源文件)
|
||||||
|
/// </summary>
|
||||||
|
public bool CopyBuildinTagFiles = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -25,11 +25,12 @@ namespace YooAsset.Editor
|
||||||
private TextField _buildOutputField;
|
private TextField _buildOutputField;
|
||||||
private IntegerField _buildVersionField;
|
private IntegerField _buildVersionField;
|
||||||
private EnumField _buildModeField;
|
private EnumField _buildModeField;
|
||||||
private TextField _buildTagsField;
|
private TextField _buildinTagsField;
|
||||||
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()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -76,11 +77,11 @@ namespace YooAsset.Editor
|
||||||
});
|
});
|
||||||
|
|
||||||
// 内置资源标签
|
// 内置资源标签
|
||||||
_buildTagsField = root.Q<TextField>("BuildinTags");
|
_buildinTagsField = root.Q<TextField>("BuildinTags");
|
||||||
_buildTagsField.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.BuildTags);
|
_buildinTagsField.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.BuildTags);
|
||||||
_buildTagsField.RegisterValueChangedCallback(evt =>
|
_buildinTagsField.RegisterValueChangedCallback(evt =>
|
||||||
{
|
{
|
||||||
AssetBundleBuilderSettingData.Setting.BuildTags = _buildTagsField.value;
|
AssetBundleBuilderSettingData.Setting.BuildTags = _buildinTagsField.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 加密方法
|
// 加密方法
|
||||||
|
@ -123,6 +124,14 @@ 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; ;
|
||||||
|
@ -141,11 +150,13 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
private void RefreshWindow()
|
private void RefreshWindow()
|
||||||
{
|
{
|
||||||
bool enableElement = AssetBundleBuilderSettingData.Setting.BuildMode == EBuildMode.ForceRebuild;
|
var buildMode = AssetBundleBuilderSettingData.Setting.BuildMode;
|
||||||
_buildTagsField.SetEnabled(enableElement);
|
bool enableElement = buildMode == EBuildMode.ForceRebuild;
|
||||||
|
_buildinTagsField.SetEnabled(enableElement);
|
||||||
_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()
|
||||||
{
|
{
|
||||||
|
@ -172,10 +183,11 @@ namespace YooAsset.Editor
|
||||||
buildParameters.BuildTarget = _buildTarget;
|
buildParameters.BuildTarget = _buildTarget;
|
||||||
buildParameters.BuildMode = (EBuildMode)_buildModeField.value;
|
buildParameters.BuildMode = (EBuildMode)_buildModeField.value;
|
||||||
buildParameters.BuildVersion = _buildVersionField.value;
|
buildParameters.BuildVersion = _buildVersionField.value;
|
||||||
buildParameters.BuildinTags = _buildTagsField.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.EncryptionServices = CreateEncryptionServicesInstance();
|
buildParameters.EncryptionServices = CreateEncryptionServicesInstance();
|
||||||
buildParameters.CompressOption = (ECompressOption)_compressionField.value;
|
buildParameters.CompressOption = (ECompressOption)_compressionField.value;
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
<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>
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace YooAsset.Editor
|
||||||
public int BuildVersion;
|
public int BuildVersion;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 内置资源的标记列表
|
/// 内置资源标签集合(首包资源标签)
|
||||||
/// 注意:分号为分隔符
|
/// 注意:分号为分隔符
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string BuildinTags;
|
public string BuildinTags;
|
||||||
|
@ -51,6 +51,11 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AppendFileExtension = false;
|
public bool AppendFileExtension = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 拷贝内置资源文件(首包资源文件)
|
||||||
|
/// </summary>
|
||||||
|
public bool CopyBuildinTagFiles = false;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 加密类
|
/// 加密类
|
||||||
|
@ -74,7 +79,7 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取内置标记列表
|
/// 获取内置资源标签列表(首包资源标签)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<string> GetBuildinTags()
|
public List<string> GetBuildinTags()
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,6 +53,11 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AppendFileExtension;
|
public bool AppendFileExtension;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 拷贝内置资源文件
|
||||||
|
/// </summary>
|
||||||
|
public bool CopyBuildinTagFiles;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自动收集着色器
|
/// 自动收集着色器
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
// 注意:我们只有在强制重建的时候才会拷贝
|
// 注意:我们只有在强制重建的时候才会拷贝
|
||||||
var buildParameters = context.GetContextObject<AssetBundleBuilder.BuildParametersContext>();
|
var buildParameters = context.GetContextObject<AssetBundleBuilder.BuildParametersContext>();
|
||||||
if (buildParameters.Parameters.BuildMode == EBuildMode.ForceRebuild)
|
if (buildParameters.Parameters.CopyBuildinTagFiles)
|
||||||
{
|
{
|
||||||
// 清空流目录
|
// 清空流目录
|
||||||
AssetBundleBuilderHelper.ClearStreamingAssetsFolder();
|
AssetBundleBuilderHelper.ClearStreamingAssetsFolder();
|
||||||
|
|
|
@ -58,9 +58,7 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
List<PatchBundle> result = new List<PatchBundle>(1000);
|
List<PatchBundle> result = new List<PatchBundle>(1000);
|
||||||
|
|
||||||
// 内置标记列表
|
|
||||||
List<string> buildinTags = buildParameters.Parameters.GetBuildinTags();
|
List<string> buildinTags = buildParameters.Parameters.GetBuildinTags();
|
||||||
|
|
||||||
var buildMode = buildParameters.Parameters.BuildMode;
|
var buildMode = buildParameters.Parameters.BuildMode;
|
||||||
bool standardBuild = buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild;
|
bool standardBuild = buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild;
|
||||||
foreach (var bundleInfo in buildMapContext.BundleInfos)
|
foreach (var bundleInfo in buildMapContext.BundleInfos)
|
||||||
|
@ -90,7 +88,7 @@ namespace YooAsset.Editor
|
||||||
}
|
}
|
||||||
private bool IsBuildinBundle(string[] bundleTags, List<string> buildinTags)
|
private bool IsBuildinBundle(string[] bundleTags, List<string> buildinTags)
|
||||||
{
|
{
|
||||||
// 注意:没有任何标记的Bundle文件默认为内置文件
|
// 注意:没有任何分类标签的Bundle文件默认为内置文件
|
||||||
if (bundleTags.Length == 0)
|
if (bundleTags.Length == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ namespace YooAsset.Editor
|
||||||
buildReport.Summary.BuildinTags = buildParameters.Parameters.BuildinTags;
|
buildReport.Summary.BuildinTags = buildParameters.Parameters.BuildinTags;
|
||||||
buildReport.Summary.EnableAddressable = buildParameters.Parameters.EnableAddressable;
|
buildReport.Summary.EnableAddressable = buildParameters.Parameters.EnableAddressable;
|
||||||
buildReport.Summary.AppendFileExtension = buildParameters.Parameters.AppendFileExtension;
|
buildReport.Summary.AppendFileExtension = buildParameters.Parameters.AppendFileExtension;
|
||||||
|
buildReport.Summary.CopyBuildinTagFiles = buildParameters.Parameters.CopyBuildinTagFiles;
|
||||||
buildReport.Summary.AutoCollectShaders = AssetBundleCollectorSettingData.Setting.AutoCollectShaders;
|
buildReport.Summary.AutoCollectShaders = AssetBundleCollectorSettingData.Setting.AutoCollectShaders;
|
||||||
buildReport.Summary.ShadersBundleName = AssetBundleCollectorSettingData.Setting.ShadersBundleName;
|
buildReport.Summary.ShadersBundleName = AssetBundleCollectorSettingData.Setting.ShadersBundleName;
|
||||||
buildReport.Summary.EncryptionServicesClassName = buildParameters.Parameters.EncryptionServices == null ?
|
buildReport.Summary.EncryptionServicesClassName = buildParameters.Parameters.EncryptionServices == null ?
|
||||||
|
|
|
@ -70,6 +70,7 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
_items.Add(new ItemWrapper("启用可寻址资源定位", $"{buildReport.Summary.EnableAddressable}"));
|
_items.Add(new ItemWrapper("启用可寻址资源定位", $"{buildReport.Summary.EnableAddressable}"));
|
||||||
_items.Add(new ItemWrapper("追加文件扩展名", $"{buildReport.Summary.AppendFileExtension}"));
|
_items.Add(new ItemWrapper("追加文件扩展名", $"{buildReport.Summary.AppendFileExtension}"));
|
||||||
|
_items.Add(new ItemWrapper("拷贝内置资源文件", $"{buildReport.Summary.CopyBuildinTagFiles}"));
|
||||||
_items.Add(new ItemWrapper("自动收集着色器", $"{buildReport.Summary.AutoCollectShaders}"));
|
_items.Add(new ItemWrapper("自动收集着色器", $"{buildReport.Summary.AutoCollectShaders}"));
|
||||||
_items.Add(new ItemWrapper("着色器资源包名称", $"{buildReport.Summary.ShadersBundleName}"));
|
_items.Add(new ItemWrapper("着色器资源包名称", $"{buildReport.Summary.ShadersBundleName}"));
|
||||||
_items.Add(new ItemWrapper("加密服务类名称", $"{buildReport.Summary.EncryptionServicesClassName}"));
|
_items.Add(new ItemWrapper("加密服务类名称", $"{buildReport.Summary.EncryptionServicesClassName}"));
|
||||||
|
|
Loading…
Reference in New Issue