diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportBundleInfo.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportBundleInfo.cs index 862114d..9f5cda7 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportBundleInfo.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportBundleInfo.cs @@ -28,6 +28,11 @@ namespace YooAsset.Editor /// public string BundleName; + /// + /// 文件名称 + /// + public string FileName; + /// /// 哈希值 /// diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCopyBuildinFiles.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCopyBuildinFiles.cs index c0e8d96..d031e71 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCopyBuildinFiles.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCopyBuildinFiles.cs @@ -35,7 +35,7 @@ namespace YooAsset.Editor continue; string sourcePath = $"{pipelineOutputDirectory}/{patchBundle.BundleName}"; - string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsFolderPath()}/{patchBundle.Hash}"; + string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsFolderPath()}/{patchBundle.FileName}"; EditorTools.CopyFile(sourcePath, destPath, true); } diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs index a353ed6..df23c11 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs @@ -83,8 +83,7 @@ namespace YooAsset.Editor bool isBuildin = IsBuildinBundle(tags, buildinTags); bool isRawFile = bundleInfo.IsRawFile; - string fileName = GetFileOutputName(outputNameStype, hash, bundleInfo); - PatchBundle patchBundle = new PatchBundle(bundleName, fileName, crc32, size, tags); + PatchBundle patchBundle = new PatchBundle(bundleName, hash, crc32, size, (byte)outputNameStype, tags); patchBundle.SetFlagsValue(isEncrypted, isBuildin, isRawFile); result.Add(patchBundle); } @@ -104,37 +103,6 @@ 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/TaskCreatePatchPackage.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchPackage.cs index c29c6ed..d038a2c 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchPackage.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchPackage.cs @@ -95,7 +95,7 @@ namespace YooAsset.Editor foreach (var patchBundle in patchManifest.BundleList) { string sourcePath = $"{buildParameters.PipelineOutputDirectory}/{patchBundle.BundleName}"; - string destPath = $"{packageDirectory}/{patchBundle.Hash}"; + string destPath = $"{packageDirectory}/{patchBundle.FileName}"; EditorTools.CopyFile(sourcePath, destPath, true); EditorTools.DisplayProgressBar("拷贝补丁文件", ++progressValue, patchFileTotalCount); } diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs index cd3f2b1..91f4af2 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs @@ -95,6 +95,7 @@ namespace YooAsset.Editor { ReportBundleInfo reportBundleInfo = new ReportBundleInfo(); reportBundleInfo.BundleName = patchBundle.BundleName; + reportBundleInfo.FileName = patchBundle.FileName; reportBundleInfo.Hash = patchBundle.Hash; reportBundleInfo.CRC = patchBundle.CRC; reportBundleInfo.SizeBytes = patchBundle.SizeBytes; diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/EOutputNameStyle.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/EOutputNameStyle.cs index ef41b28..a601530 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/EOutputNameStyle.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/EOutputNameStyle.cs @@ -9,21 +9,21 @@ namespace YooAsset.Editor /// /// 000000000000000f000000000000000 /// - HashName, + HashName = 1, /// /// 000000000000000f000000000000000.bundle /// - HashName_Extension, + HashName_Extension = 2, /// /// bundle_name_000000000000000f000000000000000 /// - BundleName_HashName, + BundleName_HashName = 3, /// /// bundle_name_000000000000000f000000000000000.bundle /// - BundleName_HashName_Extension, + BundleName_HashName_Extension = 4, } } \ No newline at end of file diff --git a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterBundleListViewer.cs b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterBundleListViewer.cs index afd4d7f..1e185f9 100644 --- a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterBundleListViewer.cs +++ b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterBundleListViewer.cs @@ -275,7 +275,7 @@ namespace YooAsset.Editor return; string rootDirectory = Path.GetDirectoryName(_reportFilePath); - string filePath = $"{rootDirectory}/{bundleInfo.Hash}"; + string filePath = $"{rootDirectory}/{bundleInfo.FileName}"; if (File.Exists(filePath)) Selection.activeObject = AssetBundleRecorder.GetAssetBundle(filePath); else