Skip to content

Commit a5a1c5f

Browse files
authored
Merge pull request #40 from CyberAgentGameEntertainment/feature/fix_search_bugs
Feature/fix search bugs
2 parents f2679bf + 8793a60 commit a5a1c5f

7 files changed

Lines changed: 40 additions & 15 deletions

File tree

Assets/SmartAddresser/Editor/Core/Tools/Addresser/LayoutRuleEditor/AddressRuleEditor/AddressRuleListTreeView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ private string GetText(Item item, int columnIndex)
112112
? "[Missing Reference]"
113113
: item.Rule.AddressableGroup.name;
114114
case Columns.Control:
115-
return item.Rule.Control.ToString();
115+
return item.Rule.Control.Value.ToString();
116116
case Columns.AssetGroups:
117117
if (GetSelection().FirstOrDefault() == item.id)
118118
item.Rule.RefreshAssetGroupDescription();

Assets/SmartAddresser/Editor/Core/Tools/Addresser/LayoutViewer/LayoutViewerTreeView.cs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ protected override void CellGUI(int columnIndex, Rect cellRect, RowGUIArgs args)
7575
switch ((Columns)columnIndex)
7676
{
7777
case Columns.GroupNameOrAddress:
78-
item.displayName = GetText(item, columnIndex);
78+
item.displayName = GetTextForDisplay(item, columnIndex);
7979
item.icon = errorTypeIcon;
8080
base.CellGUI(columnIndex, cellRect, args);
8181
break;
@@ -98,10 +98,10 @@ protected override void CellGUI(int columnIndex, Rect cellRect, RowGUIArgs args)
9898
statusIconRect.width = statusIconRect.height;
9999
labelRect.xMin += statusIconRect.width + 2.0f;
100100
GUI.DrawTexture(statusIconRect, errorTypeIcon);
101-
GUI.Label(labelRect, GetText(item, columnIndex));
101+
GUI.Label(labelRect, GetTextForDisplay(item, columnIndex));
102102
break;
103103
case Columns.AssetPath:
104-
GUI.Label(cellRect, GetText(item, columnIndex));
104+
GUI.Label(cellRect, GetTextForDisplay(item, columnIndex));
105105
break;
106106
case Columns.Labels:
107107
DrawBadges(entryItem.Entry.Labels, new Vector2(cellRect.x, cellRect.y + 1),
@@ -162,9 +162,25 @@ string KeySelector(TreeViewItem x)
162162
: items.OrderByDescending(KeySelector, Comparer<string>.Create(EditorUtility.NaturalCompare));
163163
}
164164

165+
private string GetTextForDisplay(TreeViewItem item, int columnIndex)
166+
{
167+
return hasSearch ? GetTextForSearch(item, columnIndex) : GetText(item, columnIndex);
168+
}
169+
165170
protected override string GetTextForSearch(TreeViewItem item, int columnIndex)
166171
{
167-
return GetText(item, columnIndex);
172+
// GroupItem is not a search target.
173+
if (item is GroupItem)
174+
return null;
175+
176+
if (columnIndex != (int)Columns.GroupNameOrAddress)
177+
return GetText(item, columnIndex);
178+
179+
var groupItem = item.parent;
180+
var groupText = GetText(groupItem, columnIndex);
181+
var entryText = GetText(item, columnIndex);
182+
return $"[{groupText}] {entryText}";
183+
168184
}
169185

170186
protected override bool CanMultiSelect(TreeViewItem item)

Assets/SmartAddresser/Editor/Foundation/EasyTreeView/TreeViewBase.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,10 @@ protected override void SelectionChanged(IList<int> selectedIds)
246246

247247
private bool DoesCellMatchSearch(TreeViewItem item, int columnIndex, string search)
248248
{
249-
return GetTextForSearch(item, columnIndex).IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0;
249+
var text = GetTextForSearch(item, columnIndex);
250+
if (string.IsNullOrEmpty(text))
251+
return false;
252+
return text.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0;
250253
}
251254

252255
protected override TreeViewItem BuildRoot()

Assets/SmartAddresser/Editor/Foundation/EasyTreeView/TreeViewSearchField.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ public string OnToolbarGUI(Rect rect)
114114
foreach (var targetColumn in _targetColumns)
115115
{
116116
var columnName = targetColumn.Value;
117+
118+
// If the columnName contains a slash, replace it with the Unicode slash \u2215.
119+
// Otherwise, the slash will be recognized as a menu hierarchy separator.
120+
// https://answers.unity.com/questions/398495/can-genericmenu-item-content-display-.html
121+
columnName = columnName.Replace("/", "\u2215");
122+
117123
var index = targetColumn.Key;
118124
menu.AddItem(new GUIContent(columnName), _selectedColumnIndex == index, () =>
119125
{

Packages/manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"dependencies": {
33
"com.unity.addressables": "1.18.19",
4-
"com.unity.collab-proxy": "1.15.17",
5-
"com.unity.ide.rider": "2.0.7",
6-
"com.unity.ide.visualstudio": "2.0.15",
4+
"com.unity.collab-proxy": "1.17.2",
5+
"com.unity.ide.rider": "3.0.15",
6+
"com.unity.ide.visualstudio": "2.0.16",
77
"com.unity.ide.vscode": "1.2.5",
88
"com.unity.test-framework": "1.1.31",
99
"com.unity.textmeshpro": "3.0.6",

Packages/packages-lock.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"url": "https://packages.unity.com"
1616
},
1717
"com.unity.collab-proxy": {
18-
"version": "1.15.17",
18+
"version": "1.17.2",
1919
"depth": 0,
2020
"source": "registry",
2121
"dependencies": {
@@ -31,16 +31,16 @@
3131
"url": "https://packages.unity.com"
3232
},
3333
"com.unity.ide.rider": {
34-
"version": "2.0.7",
34+
"version": "3.0.15",
3535
"depth": 0,
3636
"source": "registry",
3737
"dependencies": {
38-
"com.unity.test-framework": "1.1.1"
38+
"com.unity.ext.nunit": "1.0.6"
3939
},
4040
"url": "https://packages.unity.com"
4141
},
4242
"com.unity.ide.visualstudio": {
43-
"version": "2.0.15",
43+
"version": "2.0.16",
4444
"depth": 0,
4545
"source": "registry",
4646
"dependencies": {

ProjectSettings/ProjectVersion.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
m_EditorVersion: 2020.3.35f1
2-
m_EditorVersionWithRevision: 2020.3.35f1 (18e4db7a9996)
1+
m_EditorVersion: 2020.3.40f1
2+
m_EditorVersionWithRevision: 2020.3.40f1 (ba48d4efcef1)

0 commit comments

Comments
 (0)