资源路径大小写不敏感逻辑优化
dev
何冠峰 2025-03-31 19:06:03 +08:00
parent b3ead90832
commit b0dc829b04
2 changed files with 8 additions and 9 deletions

View File

@ -221,9 +221,16 @@ namespace YooAsset
manifest.AssetDic = new Dictionary<string, PackageAsset>(assetCount); manifest.AssetDic = new Dictionary<string, PackageAsset>(assetCount);
if (manifest.EnableAddressable) if (manifest.EnableAddressable)
{
manifest.AssetPathMapping1 = new Dictionary<string, string>(assetCount * 3); manifest.AssetPathMapping1 = new Dictionary<string, string>(assetCount * 3);
}
else else
manifest.AssetPathMapping1 = new Dictionary<string, string>(assetCount * 2); {
if (manifest.LocationToLower)
manifest.AssetPathMapping1 = new Dictionary<string, string>(assetCount * 2, StringComparer.OrdinalIgnoreCase);
else
manifest.AssetPathMapping1 = new Dictionary<string, string>(assetCount * 2);
}
if (manifest.IncludeAssetGUID) if (manifest.IncludeAssetGUID)
manifest.AssetPathMapping2 = new Dictionary<string, string>(assetCount); manifest.AssetPathMapping2 = new Dictionary<string, string>(assetCount);
@ -245,8 +252,6 @@ namespace YooAsset
// 填充AssetPathMapping1 // 填充AssetPathMapping1
{ {
string location = packageAsset.AssetPath; string location = packageAsset.AssetPath;
if (manifest.LocationToLower)
location = location.ToLower();
// 添加原生路径的映射 // 添加原生路径的映射
if (manifest.AssetPathMapping1.ContainsKey(location)) if (manifest.AssetPathMapping1.ContainsKey(location))

View File

@ -138,9 +138,6 @@ namespace YooAsset
if (string.IsNullOrEmpty(location)) if (string.IsNullOrEmpty(location))
return string.Empty; return string.Empty;
if (LocationToLower)
location = location.ToLower();
if (AssetPathMapping1.TryGetValue(location, out string assetPath)) if (AssetPathMapping1.TryGetValue(location, out string assetPath))
return assetPath; return assetPath;
else else
@ -307,9 +304,6 @@ namespace YooAsset
return string.Empty; return string.Empty;
} }
if (LocationToLower)
location = location.ToLower();
if (AssetPathMapping1.TryGetValue(location, out string assetPath)) if (AssetPathMapping1.TryGetValue(location, out string assetPath))
{ {
return assetPath; return assetPath;