From c099517a4d9f2c00b8357656f87a8109ede83e11 Mon Sep 17 00:00:00 2001 From: Y-way Date: Tue, 16 Aug 2022 10:52:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AF=E5=AF=BB=E5=9D=80=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=8B=E6=94=AF=E6=8C=81=E5=85=A8=E8=B7=AF=E5=BE=84=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Runtime/PatchSystem/PatchManifest.cs | 66 ++++++++++--------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/Assets/YooAsset/Runtime/PatchSystem/PatchManifest.cs b/Assets/YooAsset/Runtime/PatchSystem/PatchManifest.cs index ea18152..9bc498d 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/PatchManifest.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/PatchManifest.cs @@ -84,43 +84,45 @@ namespace YooAsset { if (locationToLower) YooLogger.Error("Addressable not support location to lower !"); - - foreach (var patchAsset in AssetList) - { - string location = patchAsset.Address; - if (AssetPathMapping.ContainsKey(location)) - throw new Exception($"Address have existed : {location}"); - else - AssetPathMapping.Add(location, patchAsset.AssetPath); - } } else { _locationToLower = locationToLower; - foreach (var patchAsset in AssetList) - { - string location = patchAsset.AssetPath; - if (locationToLower) - location = location.ToLower(); - - // 添加原生路径的映射 - if (AssetPathMapping.ContainsKey(location)) - throw new Exception($"AssetPath have existed : {location}"); - else - AssetPathMapping.Add(location, patchAsset.AssetPath); - - // 添加无后缀名路径的映射 - if (Path.HasExtension(location)) - { - string locationWithoutExtension = StringUtility.RemoveExtension(location); - if (AssetPathMapping.ContainsKey(locationWithoutExtension)) - YooLogger.Warning($"AssetPath have existed : {locationWithoutExtension}"); - else - AssetPathMapping.Add(locationWithoutExtension, patchAsset.AssetPath); - } - } } - } + + foreach(var patchAsset in AssetList) + { + string location = patchAsset.AssetPath; + if(locationToLower) + location = location.ToLower(); + // 添加原生路径的映射 + if(AssetPathMapping.ContainsKey(location)) + throw new Exception($"AssetPath have existed : {location}"); + else + AssetPathMapping.Add(location, patchAsset.AssetPath); + + // 添加无后缀名路径的映射 + if(Path.HasExtension(location)) + { + string locationWithoutExtension = StringUtility.RemoveExtension(location); + if(AssetPathMapping.ContainsKey(locationWithoutExtension)) + YooLogger.Warning($"AssetPath have existed : {locationWithoutExtension}"); + else + AssetPathMapping.Add(locationWithoutExtension, patchAsset.AssetPath); + } + // 可寻址路径映射 + if(EnableAddressable) + { + // 可寻址路径 + location = patchAsset.Address; + if(AssetPathMapping.ContainsKey(location)) + throw new Exception($"Address have existed : {location}"); + else + AssetPathMapping.Add(location, patchAsset.AssetPath); + } + } + + } /// /// 映射为资源路径