From ade97605f95e4fb681129047baa1adffe76d233a Mon Sep 17 00:00:00 2001 From: hevinci Date: Mon, 25 Sep 2023 18:19:48 +0800 Subject: [PATCH] update asset bundle collector MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加了AddressDisable规则 --- .../Editor/AssetBundleCollector/AssetBundleCollector.cs | 2 ++ .../AssetBundleCollector/AssetBundleCollectorGroup.cs | 3 +++ .../AssetBundleCollector/AssetBundleCollectorPackage.cs | 3 +++ .../AssetBundleCollectorSettingData.cs | 3 ++- .../DefaultRules/DefaultAddressRule.cs | 9 +++++++++ 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs index f168f0f..4810460 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs @@ -204,6 +204,8 @@ namespace YooAsset.Editor { string address = collectInfoPair.Value.Address; string assetPath = collectInfoPair.Value.AssetPath; + if (string.IsNullOrEmpty(address)) + continue; if (address.StartsWith("Assets/") || address.StartsWith("assets/")) throw new Exception($"The address can not set asset path in collector : {CollectPath} \nAssetPath: {assetPath}"); diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorGroup.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorGroup.cs index 92bd97b..0468cdb 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorGroup.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorGroup.cs @@ -106,6 +106,9 @@ namespace YooAsset.Editor { string address = collectInfoPair.Value.Address; string assetPath = collectInfoPair.Value.AssetPath; + if (string.IsNullOrEmpty(address)) + continue; + if (addressTemper.TryGetValue(address, out var existed) == false) addressTemper.Add(address, assetPath); else diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorPackage.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorPackage.cs index 694dbc5..3f36872 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorPackage.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorPackage.cs @@ -83,6 +83,9 @@ namespace YooAsset.Editor { string address = collectInfoPair.Value.Address; string assetPath = collectInfoPair.Value.AssetPath; + if (string.IsNullOrEmpty(address)) + continue; + if (addressTemper.TryGetValue(address, out var existed) == false) addressTemper.Add(address, assetPath); else diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs index b29684c..ccde313 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs @@ -94,7 +94,8 @@ namespace YooAsset.Editor typeof(AddressByFileName), typeof(AddressByFilePath), typeof(AddressByFolderAndFileName), - typeof(AddressByGroupAndFileName) + typeof(AddressByGroupAndFileName), + typeof(AddressDisable) }; var customTypes = EditorTools.GetAssignableTypes(typeof(IAddressRule)); diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/DefaultRules/DefaultAddressRule.cs b/Assets/YooAsset/Editor/AssetBundleCollector/DefaultRules/DefaultAddressRule.cs index 8cde379..0a32e81 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/DefaultRules/DefaultAddressRule.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/DefaultRules/DefaultAddressRule.cs @@ -2,6 +2,15 @@ namespace YooAsset.Editor { + [DisplayName("定位地址: 禁用")] + public class AddressDisable : IAddressRule + { + string IAddressRule.GetAssetAddress(AddressRuleData data) + { + return string.Empty; + } + } + [DisplayName("定位地址: 文件名")] public class AddressByFileName : IAddressRule {