DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ ChangeFilter()

void ScriptConsoleItemsTab::ChangeFilter ( TextListboxWidget widget,
MultilineEditBoxWidget filterWidget,
int categoryMask = -1,
bool ignoreScope = false )
inlineprotected

См. определение в файле ScriptConsoleItemsTab.c строка 939

940 {
941 widget.ClearItems();
942
943 TStringArray filters;
944 TIntArray filterColors;
945
946 string widgetText;
947 filterWidget.GetText(widgetText);
948 PrepareFilters(widgetText, filters, filterColors);
949
950 map<string,int> itemsAndColors = new map<string,int>();
951 map<string,ref TStringArray> itemsByFilters = new map<string,ref TStringArray>();
952
953 TStringArray itemsArray = TStringArray();
954
955 map<string, ref ScriptConsoleItem> items = m_Developer.GetItems();
956 foreach (string itemName, ScriptConsoleItem itemData : items)
957 {
958 string displayName = "NO DISPLAY NAME";
959 if (itemData.m_DisplayName != string.Empty)
960 displayName = itemData.m_DisplayName;
961
962 int scope = itemData.m_Scope;
963 if (scope >= OBJECT_SCOPE || ignoreScope)
964 {
965 int categoryBit = itemData.m_CategoryMask;
966 categoryBit = (1 << categoryBit);
967
968 bool display = false;
969 bool matchWithDisplayName = false;
970 int color = 0;
971 if (categoryBit & categoryMask)
972 {
973 display = true;
974 }
975 else if ((!m_ConfigDebugProfile.GetMergeType() || categoryMask == 0) && filters.Count() > 0)
976 {
977 string childNameLower = itemName;
978 childNameLower.ToLower();
979 string displayNameLower = displayName;
980 displayNameLower.ToLower();
981
982 foreach (int indx, string filter : filters)
983 {
984 if (childNameLower.Contains(filter) || displayNameLower.Contains(filter))
985 {
986 display = false;
987 color = filterColors.Get(indx);
988 TStringArray arr = itemsByFilters.Get(filter);
989 if (!arr)
990 {
991 arr = new TStringArray();
992 itemsByFilters.Set(filter, arr);
993 }
994
995 arr.Insert(itemName + " - [" + displayName + "]");
996 itemsAndColors.Insert(itemName + " - [" + displayName + "]",color);
997 break;
998 }
999 }
1000 }
1001 else if (categoryMask == 0)
1002 {
1003 display = true;
1004 }
1005
1006 if (display)
1007 {
1008 itemsArray.Insert(itemName + " - [" + displayName + "]");
1009 }
1010 }
1011 }
1012
1013 if (itemsArray)
1014 {
1015 itemsArray.Sort();
1016 foreach (string it : itemsArray)
1017 {
1018 widget.AddItem(it, NULL, 0);
1019 }
1020 }
1021
1022 if (filters)
1023 {
1025 filters.Invert();
1026
1027 foreach (string f : filters)
1028 {
1029 TStringArray arr2 = itemsByFilters.Get(f);
1030 if (arr2)
1031 {
1032 arr2.Sort();
1033 foreach (string itm: arr2)
1034 {
1035 int row = widget.AddItem(itm, NULL, 0);
1036 int clr = itemsAndColors.Get(itm);
1037 if (clr)
1038 {
1039 widget.SetItemColor(row, 0, clr);
1040 }
1041 }
1042 }
1043 }
1044 }
1045 }
void PrepareFilters(string filter, out TStringArray filters, out TIntArray colors)
Определения ScriptConsoleItemsTab.c:905
bool m_FilterOrderReversed
Определения ScriptConsoleItemsTab.c:27
PluginDeveloper m_Developer
Определения ScriptConsoleItemsTab.c:26
static int OBJECT_SCOPE
Определения ScriptConsoleItemsTab.c:11
PluginConfigDebugProfile m_ConfigDebugProfile
Определения ScriptConsoleTabBase.c:11
array< int > TIntArray
Определения EnScript.c:733
class array< Class T > TStringArray
bool Contains(string sample)
Returns true if sample is substring of string.
Определения EnString.c:286
proto int ToLower()
Changes string to lowercase. Returns length.

Перекрестные ссылки string::Contains(), ScriptConsoleTabBase::m_ConfigDebugProfile, m_Developer, m_FilterOrderReversed, OBJECT_SCOPE, PrepareFilters(), string::ToLower() и TStringArray.

Используется в ChangeFilterItems().