A game framework written with osu! in mind.

Fix regression

+29 -4
+15
osu.Framework.Tests/Visual/UserInterface/TestCaseSearchContainer.cs
··· 137 } 138 } 139 140 public IEnumerable<IFilterable> FilterableChildren => Children.OfType<IFilterable>(); 141 142 protected override Container<Drawable> Content => flowContainer; ··· 173 Hide(); 174 } 175 } 176 } 177 178 private class SearchableText : SpriteText, IFilterable ··· 186 else 187 Hide(); 188 } 189 } 190 } 191 }
··· 137 } 138 } 139 140 + public bool FilteringActive 141 + { 142 + set { } 143 + } 144 + 145 public IEnumerable<IFilterable> FilterableChildren => Children.OfType<IFilterable>(); 146 147 protected override Container<Drawable> Content => flowContainer; ··· 178 Hide(); 179 } 180 } 181 + 182 + public bool FilteringActive 183 + { 184 + set { } 185 + } 186 } 187 188 private class SearchableText : SpriteText, IFilterable ··· 196 else 197 Hide(); 198 } 199 + } 200 + 201 + public bool FilteringActive 202 + { 203 + set { } 204 } 205 } 206 }
+5
osu.Framework/Graphics/Containers/IFilterable.cs
··· 9 /// Whether the current object is matching (ie. visible) given the current filter criteria of a parent. 10 /// </summary> 11 bool MatchingFilter { set; } 12 } 13 }
··· 9 /// Whether the current object is matching (ie. visible) given the current filter criteria of a parent. 10 /// </summary> 11 bool MatchingFilter { set; } 12 + 13 + /// <summary> 14 + /// Whether a filter is currently being performed. 15 + /// </summary> 16 + bool FilteringActive { set; } 17 } 18 }
+4 -3
osu.Framework/Graphics/Containers/SearchContainer.cs
··· 26 { 27 searchTerm = value; 28 var terms = value.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); 29 - Children.OfType<IFilterable>().ForEach(child => match(child, terms)); 30 } 31 } 32 33 - private static bool match(IFilterable filterable, IEnumerable<string> terms) 34 { 35 //Words matched by parent is not needed to match children 36 var childTerms = terms.Where(term => ··· 44 //We need to check the children and should any child match this matches as well 45 if (hasFilterableChildren != null) 46 foreach (IFilterable child in hasFilterableChildren.FilterableChildren) 47 - matching |= match(child, childTerms); 48 49 return filterable.MatchingFilter = matching; 50 } 51 }
··· 26 { 27 searchTerm = value; 28 var terms = value.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); 29 + Children.OfType<IFilterable>().ForEach(child => match(child, terms, terms.Length > 0)); 30 } 31 } 32 33 + private static bool match(IFilterable filterable, IEnumerable<string> terms, bool searchActive) 34 { 35 //Words matched by parent is not needed to match children 36 var childTerms = terms.Where(term => ··· 44 //We need to check the children and should any child match this matches as well 45 if (hasFilterableChildren != null) 46 foreach (IFilterable child in hasFilterableChildren.FilterableChildren) 47 + matching |= match(child, childTerms, searchActive); 48 49 + filterable.FilteringActive = searchActive; 50 return filterable.MatchingFilter = matching; 51 } 52 }
+3 -1
osu.Framework/Testing/Drawables/TestCaseButton.cs
··· 30 } 31 } 32 33 private readonly Container content; 34 private readonly TextFlowContainer text; 35 public readonly Type TestType; ··· 113 114 private void updateVisibility() 115 { 116 - if (matchingFilter || !collapsed) 117 Show(); 118 else 119 Hide();
··· 30 } 31 } 32 33 + public bool FilteringActive { get; set; } 34 + 35 private readonly Container content; 36 private readonly TextFlowContainer text; 37 public readonly Type TestType; ··· 115 116 private void updateVisibility() 117 { 118 + if (FilteringActive && matchingFilter || !collapsed) 119 Show(); 120 else 121 Hide();
+2
osu.Framework/Testing/Drawables/TestCaseButtonGroup.cs
··· 19 set => Alpha = value ? 1 : 0; 20 } 21 22 public IEnumerable<IFilterable> FilterableChildren => buttonFlow.Children; 23 24 private readonly FillFlowContainer<TestCaseButton> buttonFlow;
··· 19 set => Alpha = value ? 1 : 0; 20 } 21 22 + public bool FilteringActive { get; set; } 23 + 24 public IEnumerable<IFilterable> FilterableChildren => buttonFlow.Children; 25 26 private readonly FillFlowContainer<TestCaseButton> buttonFlow;