Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros
EntryFilterer.cs
Go to the documentation of this file.
3
5
6public class EntryFilterer<T, U> where T : new() where U : IEntryFilter<T>
7{
9
11
13
15
17
19 {
21 ActiveFilters = new List<U>();
23 }
24
29
30 public bool FitsFilter(T entry)
31 {
32 if (_searchFilter != null && !_searchFilter.FitsFilter(entry))
33 {
34 return false;
35 }
36 for (int i = 0; i < AlwaysActiveFilters.Count; i++)
37 {
39 {
40 return false;
41 }
42 }
43 if (ActiveFilters.Count == 0)
44 {
45 return true;
46 }
47 for (int j = 0; j < ActiveFilters.Count; j++)
48 {
50 {
51 return true;
52 }
53 }
54 return false;
55 }
56
57 public void ToggleFilter(int filterIndex)
58 {
60 if (ActiveFilters.Contains(item))
61 {
63 }
64 else
65 {
66 ActiveFilters.Add(item);
67 }
68 }
69
70 public bool IsFilterActive(int filterIndex)
71 {
72 if (!AvailableFilters.IndexInRange(filterIndex))
73 {
74 return false;
75 }
77 return ActiveFilters.Contains(item);
78 }
79
84
85 public void SetSearchFilter(string searchFilter)
86 {
87 if (string.IsNullOrWhiteSpace(searchFilter))
88 {
89 _searchFilter = null;
90 return;
91 }
93 _searchFilter.SetSearch(searchFilter);
94 }
95
96 public string GetDisplayName()
97 {
98 object obj = new { ActiveFilters.Count };
99 return Language.GetTextValueWith("BestiaryInfo.Filters", obj);
100 }
101}
void AddRange(IEnumerable< T > collection)
Definition List.cs:275
void SetSearchFilter(string searchFilter)
void AddFilters(List< U > filters)
ISearchFilter< T > _searchFilterFromConstructor
void SetSearchFilterObject< Z >(Z searchFilter)
static string GetTextValueWith(string key, object obj)
Definition Language.cs:40