From 31c79f3f84d6af1c55b9696e10421a24fe1f9721 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=AC=E6=98=A5=E9=B9=8F?= Date: Sat, 7 Jun 2025 10:02:02 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4search=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E7=9A=84=E5=88=A4=E5=AE=9A=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AssetBundleCollectorWindow.cs | 44 +++++-------------- 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs index bf108656..fbbb265e 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs @@ -19,15 +19,7 @@ namespace YooAsset.Editor window.minSize = new Vector2(800, 600); } - private enum EViewMode - { - Normal, - Search, - } - - private EViewMode _viewMode; - private string _searchKey; - private string _lowerSearchKey; + private string _lowerSearchKey = string.Empty; private ToolbarSearchField _searchField; @@ -82,8 +74,6 @@ namespace YooAsset.Editor { try { - _viewMode = EViewMode.Normal; - _collectorTypeList = new List() { $"{nameof(ECollectorType.MainAssetCollector)}", @@ -380,18 +370,8 @@ namespace YooAsset.Editor private void OnSearchFieldValueChanged(ChangeEvent evt) { - _searchKey = evt.newValue; _lowerSearchKey = evt.newValue.ToLower(); - if (string.IsNullOrWhiteSpace(evt.newValue)) - { - _viewMode = EViewMode.Normal; - } - else - { - _viewMode = EViewMode.Search; - } - RefreshWindow(); } @@ -566,7 +546,7 @@ namespace YooAsset.Editor #if UNITY_2020_3_OR_NEWER _helpBoxContainer.Clear(); - if (_viewMode == EViewMode.Search) + if (string.IsNullOrWhiteSpace(_lowerSearchKey) == false) { string tips = "Currently in search mode"; var helpBox = new HelpBox(tips, HelpBoxMessageType.Error); @@ -602,11 +582,11 @@ namespace YooAsset.Editor List packages = null; - if (_viewMode == EViewMode.Normal) + if (string.IsNullOrWhiteSpace(_lowerSearchKey)) { packages = AssetBundleCollectorSettingData.Setting.Packages; } - else if (_viewMode == EViewMode.Search) + else { packages = new List(); @@ -692,7 +672,7 @@ namespace YooAsset.Editor var textField1 = element.Q