diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSetting.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSetting.cs
index bd63107..c179c05 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSetting.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSetting.cs
@@ -30,14 +30,14 @@ namespace YooAsset.Editor
///
public ECompressOption CompressOption = ECompressOption.LZ4;
+ ///
+ /// 输出文件名称样式
+ ///
+ public EOutputNameStyle OutputNameStyle = EOutputNameStyle.HashName;
+
///
/// 加密类名称
///
public string EncyptionClassName = string.Empty;
-
- ///
- /// 附加后缀格式
- ///
- public bool AppendExtension = false;
}
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs
index 064cd3d..2c8d6cd 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs
@@ -30,7 +30,7 @@ namespace YooAsset.Editor
private TextField _buildinTagsField;
private PopupField _encryptionField;
private EnumField _compressionField;
- private Toggle _appendExtensionToggle;
+ private EnumField _outputNameStyleField;
public void CreateGUI()
{
@@ -76,7 +76,7 @@ namespace YooAsset.Editor
_buildPipelineField = root.Q("BuildPipeline");
_buildPipelineField.Init(AssetBundleBuilderSettingData.Setting.BuildPipeline);
_buildPipelineField.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.BuildPipeline);
- _buildPipelineField.style.width = 300;
+ _buildPipelineField.style.width = 350;
_buildPipelineField.RegisterValueChangedCallback(evt =>
{
AssetBundleBuilderSettingData.IsDirty = true;
@@ -88,7 +88,7 @@ namespace YooAsset.Editor
_buildModeField = root.Q("BuildMode");
_buildModeField.Init(AssetBundleBuilderSettingData.Setting.BuildMode);
_buildModeField.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.BuildMode);
- _buildModeField.style.width = 300;
+ _buildModeField.style.width = 350;
_buildModeField.RegisterValueChangedCallback(evt =>
{
AssetBundleBuilderSettingData.IsDirty = true;
@@ -112,7 +112,7 @@ namespace YooAsset.Editor
int defaultIndex = GetEncryptionDefaultIndex(AssetBundleBuilderSettingData.Setting.EncyptionClassName);
_encryptionField = new PopupField(_encryptionServicesClassNames, defaultIndex);
_encryptionField.label = "Encryption";
- _encryptionField.style.width = 300;
+ _encryptionField.style.width = 350;
_encryptionField.RegisterValueChangedCallback(evt =>
{
AssetBundleBuilderSettingData.IsDirty = true;
@@ -124,7 +124,7 @@ namespace YooAsset.Editor
{
_encryptionField = new PopupField();
_encryptionField.label = "Encryption";
- _encryptionField.style.width = 300;
+ _encryptionField.style.width = 350;
encryptionContainer.Add(_encryptionField);
}
@@ -132,20 +132,22 @@ namespace YooAsset.Editor
_compressionField = root.Q("Compression");
_compressionField.Init(AssetBundleBuilderSettingData.Setting.CompressOption);
_compressionField.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.CompressOption);
- _compressionField.style.width = 300;
+ _compressionField.style.width = 350;
_compressionField.RegisterValueChangedCallback(evt =>
{
AssetBundleBuilderSettingData.IsDirty = true;
AssetBundleBuilderSettingData.Setting.CompressOption = (ECompressOption)_compressionField.value;
});
- // 附加后缀格式
- _appendExtensionToggle = root.Q("AppendExtension");
- _appendExtensionToggle.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.AppendExtension);
- _appendExtensionToggle.RegisterValueChangedCallback(evt =>
+ // 输出文件名称样式
+ _outputNameStyleField = root.Q("OutputNameStyle");
+ _outputNameStyleField.Init(AssetBundleBuilderSettingData.Setting.OutputNameStyle);
+ _outputNameStyleField.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.OutputNameStyle);
+ _outputNameStyleField.style.width = 350;
+ _outputNameStyleField.RegisterValueChangedCallback(evt =>
{
AssetBundleBuilderSettingData.IsDirty = true;
- AssetBundleBuilderSettingData.Setting.AppendExtension = _appendExtensionToggle.value;
+ AssetBundleBuilderSettingData.Setting.OutputNameStyle = (EOutputNameStyle)_outputNameStyleField.value;
});
// 构建按钮
@@ -188,7 +190,7 @@ namespace YooAsset.Editor
_buildinTagsField.SetEnabled(enableElement);
_encryptionField.SetEnabled(enableElement);
_compressionField.SetEnabled(enableElement);
- _appendExtensionToggle.SetEnabled(enableElement);
+ _outputNameStyleField.SetEnabled(enableElement);
}
private void SaveBtn_clicked()
{
@@ -223,10 +225,10 @@ namespace YooAsset.Editor
buildParameters.BuildinTags = AssetBundleBuilderSettingData.Setting.BuildTags;
buildParameters.VerifyBuildingResult = true;
buildParameters.EnableAddressable = AssetBundleCollectorSettingData.Setting.EnableAddressable;
- buildParameters.AppendFileExtension = AssetBundleBuilderSettingData.Setting.AppendExtension;
buildParameters.CopyBuildinTagFiles = AssetBundleBuilderSettingData.Setting.BuildMode == EBuildMode.ForceRebuild;
buildParameters.EncryptionServices = CreateEncryptionServicesInstance();
buildParameters.CompressOption = AssetBundleBuilderSettingData.Setting.CompressOption;
+ buildParameters.OutputNameStyle = AssetBundleBuilderSettingData.Setting.OutputNameStyle;
if (AssetBundleBuilderSettingData.Setting.BuildPipeline == EBuildPipeline.ScriptableBuildPipeline)
{
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.uxml b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.uxml
index 294ca87..81e2c2b 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.uxml
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.uxml
@@ -9,7 +9,7 @@
-
+
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs
index 6b47e1e..943f5d6 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs
@@ -77,12 +77,7 @@ namespace YooAsset.Editor
/// 启用可寻址资源定位
///
public bool EnableAddressable = false;
-
- ///
- /// 追加文件扩展名
- ///
- public bool AppendFileExtension = false;
-
+
///
/// 拷贝内置资源文件到StreamingAssets目录(首包资源文件)
///
@@ -94,6 +89,11 @@ namespace YooAsset.Editor
///
public IEncryptionServices EncryptionServices = null;
+ ///
+ /// 补丁文件名称的样式
+ ///
+ public EOutputNameStyle OutputNameStyle = EOutputNameStyle.HashName;
+
///
/// 压缩选项
///
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportSummary.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportSummary.cs
index 4018e2d..da04cb1 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportSummary.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportSummary.cs
@@ -58,11 +58,6 @@ namespace YooAsset.Editor
///
public bool EnableAddressable;
- ///
- /// 追加文件扩展名
- ///
- public bool AppendFileExtension;
-
///
/// 拷贝内置资源文件
///
@@ -84,6 +79,7 @@ namespace YooAsset.Editor
public string EncryptionServicesClassName;
// 构建参数
+ public EOutputNameStyle OutputNameStyle;
public ECompressOption CompressOption;
public bool DisableWriteTypeTree;
public bool IgnoreTypeTreeChanges;
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs
index 09dd2dc..a353ed6 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs
@@ -69,6 +69,7 @@ namespace YooAsset.Editor
List buildinTags = buildParameters.Parameters.GetBuildinTags();
var buildMode = buildParameters.Parameters.BuildMode;
+ var outputNameStype = buildParameters.Parameters.OutputNameStyle;
bool standardBuild = buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild;
foreach (var bundleInfo in buildMapContext.BundleInfos)
{
@@ -82,13 +83,8 @@ namespace YooAsset.Editor
bool isBuildin = IsBuildinBundle(tags, buildinTags);
bool isRawFile = bundleInfo.IsRawFile;
- // 附加文件扩展名
- if (buildParameters.Parameters.AppendFileExtension)
- {
- hash += bundleInfo.GetAppendExtension();
- }
-
- PatchBundle patchBundle = new PatchBundle(bundleName, hash, crc32, size, tags);
+ string fileName = GetFileOutputName(outputNameStype, hash, bundleInfo);
+ PatchBundle patchBundle = new PatchBundle(bundleName, fileName, crc32, size, tags);
patchBundle.SetFlagsValue(isEncrypted, isBuildin, isRawFile);
result.Add(patchBundle);
}
@@ -108,6 +104,37 @@ namespace YooAsset.Editor
}
return false;
}
+ private string GetFileOutputName(EOutputNameStyle outputNameStyle, string hash, BuildBundleInfo bundleInfo)
+ {
+ string fileName;
+ var bundleName = bundleInfo.BundleName;
+ if (outputNameStyle == EOutputNameStyle.HashName)
+ {
+ fileName = hash;
+ }
+ else if (outputNameStyle == EOutputNameStyle.HashName_Extension)
+ {
+ string tempFileExtension = bundleInfo.GetAppendExtension();
+ fileName = $"{hash}{tempFileExtension}";
+ }
+ else if (outputNameStyle == EOutputNameStyle.BundleName_HashName)
+ {
+ string tempFileExtension = bundleInfo.GetAppendExtension();
+ string tempBundleName = bundleName.Replace('/', '_').Replace(tempFileExtension, "");
+ fileName = $"{tempBundleName}_{hash}";
+ }
+ else if (outputNameStyle == EOutputNameStyle.BundleName_HashName_Extension)
+ {
+ string tempFileExtension = bundleInfo.GetAppendExtension();
+ string tempBundleName = bundleName.Replace('/', '_').Replace(tempFileExtension, "");
+ fileName = $"{tempBundleName}_{hash}{tempFileExtension}";
+ }
+ else
+ {
+ throw new NotImplementedException();
+ }
+ return fileName;
+ }
private string GetFileHash(string filePath, bool standardBuild)
{
if (standardBuild)
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs
index f327884..cd3f2b1 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs
@@ -47,7 +47,6 @@ namespace YooAsset.Editor
buildReport.Summary.BuildVersion = buildParameters.Parameters.BuildVersion;
buildReport.Summary.BuildinTags = buildParameters.Parameters.BuildinTags;
buildReport.Summary.EnableAddressable = buildParameters.Parameters.EnableAddressable;
- buildReport.Summary.AppendFileExtension = buildParameters.Parameters.AppendFileExtension;
buildReport.Summary.CopyBuildinTagFiles = buildParameters.Parameters.CopyBuildinTagFiles;
buildReport.Summary.AutoCollectShaders = AssetBundleCollectorSettingData.Setting.AutoCollectShaders;
buildReport.Summary.ShadersBundleName = AssetBundleCollectorSettingData.Setting.ShadersBundleName;
@@ -55,6 +54,7 @@ namespace YooAsset.Editor
"null" : buildParameters.Parameters.EncryptionServices.GetType().FullName;
// 构建参数
+ buildReport.Summary.OutputNameStyle = buildParameters.Parameters.OutputNameStyle;
buildReport.Summary.CompressOption = buildParameters.Parameters.CompressOption;
buildReport.Summary.DisableWriteTypeTree = buildParameters.Parameters.DisableWriteTypeTree;
buildReport.Summary.IgnoreTypeTreeChanges = buildParameters.Parameters.IgnoreTypeTreeChanges;
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/EOutputNameStyle.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/EOutputNameStyle.cs
new file mode 100644
index 0000000..ef41b28
--- /dev/null
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/EOutputNameStyle.cs
@@ -0,0 +1,29 @@
+
+namespace YooAsset.Editor
+{
+ ///
+ /// 输出文件名称的样式
+ ///
+ public enum EOutputNameStyle
+ {
+ ///
+ /// 000000000000000f000000000000000
+ ///
+ HashName,
+
+ ///
+ /// 000000000000000f000000000000000.bundle
+ ///
+ HashName_Extension,
+
+ ///
+ /// bundle_name_000000000000000f000000000000000
+ ///
+ BundleName_HashName,
+
+ ///
+ /// bundle_name_000000000000000f000000000000000.bundle
+ ///
+ BundleName_HashName_Extension,
+ }
+}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/EOutputNameStyle.cs.meta b/Assets/YooAsset/Editor/AssetBundleBuilder/EOutputNameStyle.cs.meta
new file mode 100644
index 0000000..856af36
--- /dev/null
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/EOutputNameStyle.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 84c5eff5dedf53343897e83f6b10eea6
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterSummaryViewer.cs b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterSummaryViewer.cs
index 6915e3f..30c510d 100644
--- a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterSummaryViewer.cs
+++ b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterSummaryViewer.cs
@@ -70,7 +70,6 @@ namespace YooAsset.Editor
_items.Add(new ItemWrapper("内置资源标签", $"{buildReport.Summary.BuildinTags}"));
_items.Add(new ItemWrapper("启用可寻址资源定位", $"{buildReport.Summary.EnableAddressable}"));
- _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.ShadersBundleName}"));
@@ -78,6 +77,7 @@ namespace YooAsset.Editor
_items.Add(new ItemWrapper(string.Empty, string.Empty));
_items.Add(new ItemWrapper("构建参数", string.Empty));
+ _items.Add(new ItemWrapper("OutputNameStyle", $"{buildReport.Summary.OutputNameStyle}"));
_items.Add(new ItemWrapper("CompressOption", $"{buildReport.Summary.CompressOption}"));
_items.Add(new ItemWrapper("DisableWriteTypeTree", $"{buildReport.Summary.DisableWriteTypeTree}"));
_items.Add(new ItemWrapper("IgnoreTypeTreeChanges", $"{buildReport.Summary.IgnoreTypeTreeChanges}"));