From 11386a7ec2210b4c9805771278f35170d9965984 Mon Sep 17 00:00:00 2001 From: hevinci Date: Mon, 25 Sep 2023 16:57:35 +0800 Subject: [PATCH] fix #161 --- .../AssetBundleCollector/AssetBundleCollector.cs | 8 ++++---- .../AssetBundleCollector/CollectRules/IFilterRule.cs | 10 ++++++++-- .../AssetBundleCollector/CollectRules/IPackRule.cs | 7 ------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs index 813d7f1..f168f0f 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs @@ -166,7 +166,7 @@ namespace YooAsset.Editor string[] findAssets = EditorTools.FindAssets(EAssetSearchType.All, collectDirectory); foreach (string assetPath in findAssets) { - if (IsValidateAsset(assetPath, isRawFilePackRule) && IsCollectAsset(assetPath)) + if (IsValidateAsset(assetPath, isRawFilePackRule) && IsCollectAsset(group, assetPath)) { if (result.ContainsKey(assetPath) == false) { @@ -183,7 +183,7 @@ namespace YooAsset.Editor else { string assetPath = CollectPath; - if (IsValidateAsset(assetPath, isRawFilePackRule) && IsCollectAsset(assetPath)) + if (IsValidateAsset(assetPath, isRawFilePackRule) && IsCollectAsset(group, assetPath)) { var collectAssetInfo = CreateCollectAssetInfo(command, group, assetPath, isRawFilePackRule); result.Add(assetPath, collectAssetInfo); @@ -292,11 +292,11 @@ namespace YooAsset.Editor return true; } - private bool IsCollectAsset(string assetPath) + private bool IsCollectAsset(AssetBundleCollectorGroup group, string assetPath) { // 根据规则设置过滤资源文件 IFilterRule filterRuleInstance = AssetBundleCollectorSettingData.GetFilterRuleInstance(FilterRuleName); - return filterRuleInstance.IsCollectAsset(new FilterRuleData(assetPath)); + return filterRuleInstance.IsCollectAsset(new FilterRuleData(assetPath, CollectPath, group.GroupName, UserData)); } private string GetAddress(CollectCommand command, AssetBundleCollectorGroup group, string assetPath) { diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/CollectRules/IFilterRule.cs b/Assets/YooAsset/Editor/AssetBundleCollector/CollectRules/IFilterRule.cs index 1e36e8a..c65f0e6 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/CollectRules/IFilterRule.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/CollectRules/IFilterRule.cs @@ -4,10 +4,16 @@ namespace YooAsset.Editor public struct FilterRuleData { public string AssetPath; - - public FilterRuleData(string assetPath) + public string CollectPath; + public string GroupName; + public string UserData; + + public FilterRuleData(string assetPath, string collectPath, string groupName, string userData) { AssetPath = assetPath; + CollectPath = collectPath; + GroupName = groupName; + UserData = userData; } } diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/CollectRules/IPackRule.cs b/Assets/YooAsset/Editor/AssetBundleCollector/CollectRules/IPackRule.cs index feaba34..1194294 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/CollectRules/IPackRule.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/CollectRules/IPackRule.cs @@ -8,13 +8,6 @@ namespace YooAsset.Editor public string GroupName; public string UserData; - public PackRuleData(string assetPath) - { - AssetPath = assetPath; - CollectPath = string.Empty; - GroupName = string.Empty; - UserData = string.Empty; - } public PackRuleData(string assetPath, string collectPath, string groupName, string userData) { AssetPath = assetPath;