From de09a042e640d9fc94df8b89b93380db43a341d4 Mon Sep 17 00:00:00 2001 From: hevinci Date: Wed, 21 Dec 2022 12:05:05 +0800 Subject: [PATCH] update runtime code --- .../Runtime/PatchSystem/PatchManifest.cs | 21 ++++++++++--------- .../Runtime/Settings/YooAssetSettings.cs | 7 ++++++- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Assets/YooAsset/Runtime/PatchSystem/PatchManifest.cs b/Assets/YooAsset/Runtime/PatchSystem/PatchManifest.cs index 1e30739..7a45850 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/PatchManifest.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/PatchManifest.cs @@ -2,7 +2,6 @@ using System.IO; using System.Collections; using System.Collections.Generic; -using UnityEngine; namespace YooAsset { @@ -270,24 +269,26 @@ namespace YooAsset /// /// 生成Bundle文件的正式名称 /// - public static string CreateBundleFileName(int nameStype, string bundleName, string fileHash, bool isRawFile) + public static string CreateBundleFileName(int nameStyle, string bundleName, string fileHash, bool isRawFile) { - if (nameStype == 1) - { - return fileHash; - } - else if (nameStype == 2) + if (nameStyle == 1) //HashName { string fileExtension = isRawFile ? YooAssetSettingsData.Setting.RawFileVariant : YooAssetSettingsData.Setting.AssetBundleFileVariant; return StringUtility.Format("{0}.{1}", fileHash, fileExtension); } - else if (nameStype == 4) + else if (nameStyle == 2) //BundleName { - return StringUtility.Format("{0}_{1}", fileHash, bundleName); + return bundleName; + } + else if (nameStyle == 4) //BundleName_HashName + { + string fileName = bundleName.Remove(bundleName.LastIndexOf('.')); + string fileExtension = isRawFile ? YooAssetSettingsData.Setting.RawFileVariant : YooAssetSettingsData.Setting.AssetBundleFileVariant; + return StringUtility.Format("{0}_{1}.{2}", fileName, fileHash, fileExtension); } else { - throw new NotImplementedException($"Invalid nameStype {nameStype}"); + throw new NotImplementedException($"Invalid name style : {nameStyle}"); } } } diff --git a/Assets/YooAsset/Runtime/Settings/YooAssetSettings.cs b/Assets/YooAsset/Runtime/Settings/YooAssetSettings.cs index 5411e1b..bee373a 100644 --- a/Assets/YooAsset/Runtime/Settings/YooAssetSettings.cs +++ b/Assets/YooAsset/Runtime/Settings/YooAssetSettings.cs @@ -20,6 +20,11 @@ namespace YooAsset /// public string PatchManifestFileName = "PatchManifest"; + /// + /// 资源包名正规化(移除路径分隔符) + /// + public bool RegularBundleName = true; + /// /// 清单文件头标记 @@ -34,7 +39,7 @@ namespace YooAsset /// /// 清单文件格式版本 /// - public const string PatchManifestFileVersion = "1.3.4"; + public const string PatchManifestFileVersion = "1.4.0"; /// /// 构建输出文件夹名称