mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-07-02 20:03:42 +00:00
调整search模式的判定方式
This commit is contained in:
@@ -19,15 +19,7 @@ namespace YooAsset.Editor
|
|||||||
window.minSize = new Vector2(800, 600);
|
window.minSize = new Vector2(800, 600);
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum EViewMode
|
private string _lowerSearchKey = string.Empty;
|
||||||
{
|
|
||||||
Normal,
|
|
||||||
Search,
|
|
||||||
}
|
|
||||||
|
|
||||||
private EViewMode _viewMode;
|
|
||||||
private string _searchKey;
|
|
||||||
private string _lowerSearchKey;
|
|
||||||
|
|
||||||
private ToolbarSearchField _searchField;
|
private ToolbarSearchField _searchField;
|
||||||
|
|
||||||
@@ -82,8 +74,6 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_viewMode = EViewMode.Normal;
|
|
||||||
|
|
||||||
_collectorTypeList = new List<string>()
|
_collectorTypeList = new List<string>()
|
||||||
{
|
{
|
||||||
$"{nameof(ECollectorType.MainAssetCollector)}",
|
$"{nameof(ECollectorType.MainAssetCollector)}",
|
||||||
@@ -380,18 +370,8 @@ namespace YooAsset.Editor
|
|||||||
|
|
||||||
private void OnSearchFieldValueChanged(ChangeEvent<string> evt)
|
private void OnSearchFieldValueChanged(ChangeEvent<string> evt)
|
||||||
{
|
{
|
||||||
_searchKey = evt.newValue;
|
|
||||||
_lowerSearchKey = evt.newValue.ToLower();
|
_lowerSearchKey = evt.newValue.ToLower();
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(evt.newValue))
|
|
||||||
{
|
|
||||||
_viewMode = EViewMode.Normal;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_viewMode = EViewMode.Search;
|
|
||||||
}
|
|
||||||
|
|
||||||
RefreshWindow();
|
RefreshWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -566,7 +546,7 @@ namespace YooAsset.Editor
|
|||||||
#if UNITY_2020_3_OR_NEWER
|
#if UNITY_2020_3_OR_NEWER
|
||||||
_helpBoxContainer.Clear();
|
_helpBoxContainer.Clear();
|
||||||
|
|
||||||
if (_viewMode == EViewMode.Search)
|
if (string.IsNullOrWhiteSpace(_lowerSearchKey) == false)
|
||||||
{
|
{
|
||||||
string tips = "Currently in search mode";
|
string tips = "Currently in search mode";
|
||||||
var helpBox = new HelpBox(tips, HelpBoxMessageType.Error);
|
var helpBox = new HelpBox(tips, HelpBoxMessageType.Error);
|
||||||
@@ -602,11 +582,11 @@ namespace YooAsset.Editor
|
|||||||
|
|
||||||
List<AssetBundleCollectorPackage> packages = null;
|
List<AssetBundleCollectorPackage> packages = null;
|
||||||
|
|
||||||
if (_viewMode == EViewMode.Normal)
|
if (string.IsNullOrWhiteSpace(_lowerSearchKey))
|
||||||
{
|
{
|
||||||
packages = AssetBundleCollectorSettingData.Setting.Packages;
|
packages = AssetBundleCollectorSettingData.Setting.Packages;
|
||||||
}
|
}
|
||||||
else if (_viewMode == EViewMode.Search)
|
else
|
||||||
{
|
{
|
||||||
packages = new List<AssetBundleCollectorPackage>();
|
packages = new List<AssetBundleCollectorPackage>();
|
||||||
|
|
||||||
@@ -692,7 +672,7 @@ namespace YooAsset.Editor
|
|||||||
var textField1 = element.Q<Label>("Label1");
|
var textField1 = element.Q<Label>("Label1");
|
||||||
textField1.text = package.PackageName;
|
textField1.text = package.PackageName;
|
||||||
|
|
||||||
if(_viewMode == EViewMode.Search)
|
if(string.IsNullOrWhiteSpace(_lowerSearchKey) == false)
|
||||||
{
|
{
|
||||||
if(package.PackageName.ToLower().Contains(_lowerSearchKey))
|
if(package.PackageName.ToLower().Contains(_lowerSearchKey))
|
||||||
{
|
{
|
||||||
@@ -753,7 +733,7 @@ namespace YooAsset.Editor
|
|||||||
if (selectPackage == null)
|
if (selectPackage == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(_viewMode == EViewMode.Search)
|
if(string.IsNullOrWhiteSpace(_lowerSearchKey) == false)
|
||||||
{
|
{
|
||||||
_displayGroupList = new List<AssetBundleCollectorGroup>();
|
_displayGroupList = new List<AssetBundleCollectorGroup>();
|
||||||
foreach(var group in selectPackage.Groups)
|
foreach(var group in selectPackage.Groups)
|
||||||
@@ -826,7 +806,7 @@ namespace YooAsset.Editor
|
|||||||
var textField1 = element.Q<Label>("Label1");
|
var textField1 = element.Q<Label>("Label1");
|
||||||
textField1.text = group.GroupName;
|
textField1.text = group.GroupName;
|
||||||
|
|
||||||
if(_viewMode == EViewMode.Search)
|
if(string.IsNullOrWhiteSpace(_lowerSearchKey) == false)
|
||||||
{
|
{
|
||||||
if(group.GroupName.ToLower().Contains(_lowerSearchKey))
|
if(group.GroupName.ToLower().Contains(_lowerSearchKey))
|
||||||
{
|
{
|
||||||
@@ -863,7 +843,7 @@ namespace YooAsset.Editor
|
|||||||
_groupDescTxt.SetValueWithoutNotify(selectGroup.GroupDesc);
|
_groupDescTxt.SetValueWithoutNotify(selectGroup.GroupDesc);
|
||||||
_groupTagsTxt.SetValueWithoutNotify(selectGroup.AssetTags);
|
_groupTagsTxt.SetValueWithoutNotify(selectGroup.AssetTags);
|
||||||
|
|
||||||
if(_viewMode == EViewMode.Search)
|
if(string.IsNullOrWhiteSpace(_lowerSearchKey) == false)
|
||||||
{
|
{
|
||||||
if(selectGroup.AssetTags.ToLower().Contains(_lowerSearchKey))
|
if(selectGroup.AssetTags.ToLower().Contains(_lowerSearchKey))
|
||||||
{
|
{
|
||||||
@@ -916,7 +896,7 @@ namespace YooAsset.Editor
|
|||||||
_collectorScrollView.Clear();
|
_collectorScrollView.Clear();
|
||||||
for (int i = 0; i < selectGroup.Collectors.Count; i++)
|
for (int i = 0; i < selectGroup.Collectors.Count; i++)
|
||||||
{
|
{
|
||||||
if(_viewMode == EViewMode.Search)
|
if(string.IsNullOrWhiteSpace(_lowerSearchKey) == false)
|
||||||
{
|
{
|
||||||
if(selectGroup.Collectors[i].CollectPath.ToLower().Contains(_lowerSearchKey))
|
if(selectGroup.Collectors[i].CollectPath.ToLower().Contains(_lowerSearchKey))
|
||||||
{
|
{
|
||||||
@@ -1093,7 +1073,7 @@ namespace YooAsset.Editor
|
|||||||
var objectField1 = element.Q<ObjectField>("ObjectField1");
|
var objectField1 = element.Q<ObjectField>("ObjectField1");
|
||||||
objectField1.SetValueWithoutNotify(collectObject);
|
objectField1.SetValueWithoutNotify(collectObject);
|
||||||
|
|
||||||
if (_viewMode == EViewMode.Search)
|
if (string.IsNullOrWhiteSpace(_lowerSearchKey) == false)
|
||||||
{
|
{
|
||||||
if (collector.CollectPath.ToLower().Contains(_lowerSearchKey))
|
if (collector.CollectPath.ToLower().Contains(_lowerSearchKey))
|
||||||
{
|
{
|
||||||
@@ -1115,7 +1095,7 @@ namespace YooAsset.Editor
|
|||||||
collector.CollectorGUID = AssetDatabase.AssetPathToGUID(collector.CollectPath);
|
collector.CollectorGUID = AssetDatabase.AssetPathToGUID(collector.CollectPath);
|
||||||
objectField1.value.name = collector.CollectPath;
|
objectField1.value.name = collector.CollectPath;
|
||||||
|
|
||||||
if(_viewMode == EViewMode.Search)
|
if(string.IsNullOrWhiteSpace(_lowerSearchKey) == false)
|
||||||
{
|
{
|
||||||
if(collector.CollectPath.ToLower().Contains(_lowerSearchKey))
|
if(collector.CollectPath.ToLower().Contains(_lowerSearchKey))
|
||||||
{
|
{
|
||||||
@@ -1215,7 +1195,7 @@ namespace YooAsset.Editor
|
|||||||
|
|
||||||
// Tags
|
// Tags
|
||||||
var textFiled1 = element.Q<TextField>("TextField1");
|
var textFiled1 = element.Q<TextField>("TextField1");
|
||||||
if(_viewMode == EViewMode.Search)
|
if(string.IsNullOrWhiteSpace(_lowerSearchKey) == false)
|
||||||
{
|
{
|
||||||
if(collector.AssetTags.ToLower().Contains(_lowerSearchKey))
|
if(collector.AssetTags.ToLower().Contains(_lowerSearchKey))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user