From f9b72a22ae627259fb92606b59e12a23d0f81814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E5=86=A0=E5=B3=B0?= Date: Mon, 30 Dec 2024 16:27:50 +0800 Subject: [PATCH] fix #423 --- .../BaseTasks/TaskCreateReport.cs | 2 +- .../Runtime/Settings/YooAssetSettings.cs | 7 ++++- .../Runtime/Settings/YooAssetSettingsData.cs | 27 ++++++++++++++----- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateReport.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateReport.cs index cecbb1b5..17c5580a 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateReport.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateReport.cs @@ -116,7 +116,7 @@ namespace YooAsset.Editor buildReport.IndependAssets = new List(buildMapContext.IndependAssets); // 序列化文件 - string fileName = YooAssetSettingsData.GetReportFileName(buildParameters.PackageName, buildParameters.PackageVersion); + string fileName = YooAssetSettingsData.GetBuildReportFileName(buildParameters.PackageName, buildParameters.PackageVersion); string filePath = $"{packageOutputDirectory}/{fileName}"; BuildReport.Serialize(filePath, buildReport); BuildLogger.Log($"Create build report file: {filePath}"); diff --git a/Assets/YooAsset/Runtime/Settings/YooAssetSettings.cs b/Assets/YooAsset/Runtime/Settings/YooAssetSettings.cs index 845c570f..52da20f9 100644 --- a/Assets/YooAsset/Runtime/Settings/YooAssetSettings.cs +++ b/Assets/YooAsset/Runtime/Settings/YooAssetSettings.cs @@ -6,10 +6,15 @@ namespace YooAsset internal class YooAssetSettings : ScriptableObject { /// - /// 默认的YooAsset文件夹名称 + /// YooAsset文件夹名称 /// public string DefaultYooFolderName = "yoo"; + /// + /// 资源清单前缀名称(默认为空) + /// + public string PackageManifestPrefix = string.Empty; + /// /// 清单文件头标记 diff --git a/Assets/YooAsset/Runtime/Settings/YooAssetSettingsData.cs b/Assets/YooAsset/Runtime/Settings/YooAssetSettingsData.cs index 1bf1e71e..d62a541a 100644 --- a/Assets/YooAsset/Runtime/Settings/YooAssetSettingsData.cs +++ b/Assets/YooAsset/Runtime/Settings/YooAssetSettingsData.cs @@ -36,9 +36,12 @@ namespace YooAsset /// /// 获取构建报告文件名 /// - public static string GetReportFileName(string packageName, string packageVersion) + public static string GetBuildReportFileName(string packageName, string packageVersion) { - return $"{packageName}_{packageVersion}.report"; + if (string.IsNullOrEmpty(Setting.PackageManifestPrefix)) + return $"{packageName}_{packageVersion}.report"; + else + return $"{Setting.PackageManifestPrefix}_{packageName}_{packageVersion}.report"; } /// @@ -46,7 +49,10 @@ namespace YooAsset /// public static string GetManifestBinaryFileName(string packageName, string packageVersion) { - return $"{packageName}_{packageVersion}.bytes"; + if (string.IsNullOrEmpty(Setting.PackageManifestPrefix)) + return $"{packageName}_{packageVersion}.bytes"; + else + return $"{Setting.PackageManifestPrefix}_{packageName}_{packageVersion}.bytes"; } /// @@ -54,7 +60,10 @@ namespace YooAsset /// public static string GetManifestJsonFileName(string packageName, string packageVersion) { - return $"{packageName}_{packageVersion}.json"; + if (string.IsNullOrEmpty(Setting.PackageManifestPrefix)) + return $"{packageName}_{packageVersion}.json"; + else + return $"{Setting.PackageManifestPrefix}_{packageName}_{packageVersion}.json"; } /// @@ -62,7 +71,10 @@ namespace YooAsset /// public static string GetPackageHashFileName(string packageName, string packageVersion) { - return $"{packageName}_{packageVersion}.hash"; + if (string.IsNullOrEmpty(Setting.PackageManifestPrefix)) + return $"{packageName}_{packageVersion}.hash"; + else + return $"{Setting.PackageManifestPrefix}_{packageName}_{packageVersion}.hash"; } /// @@ -70,7 +82,10 @@ namespace YooAsset /// public static string GetPackageVersionFileName(string packageName) { - return $"{packageName}.version"; + if (string.IsNullOrEmpty(Setting.PackageManifestPrefix)) + return $"{packageName}.version"; + else + return $"{Setting.PackageManifestPrefix}_{packageName}.version"; } #region 路径相关