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

◆ ChangeFilter()

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

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

935 {
936 widget.ClearItems();
937
938 TStringArray filters;
939 TIntArray filterColors;
940
941 string widgetText;
942 filterWidget.GetText(widgetText);
943 PrepareFilters(widgetText, filters, filterColors);
944
945 map<string,int> itemsAndColors = new map<string,int>();
947
948 TStringArray itemsArray = TStringArray();
949
950 for (int i = 0; i < classes.Count(); i++)
951 {
952 string config_path = classes.Get(i);
953
954 int objects_count = g_Game.ConfigGetChildrenCount(config_path);
955 for (int j = 0; j < objects_count; j++)
956 {
957 string child_name;
958
959 g_Game.ConfigGetChildName(config_path, j, child_name);
960
961 int scope = g_Game.ConfigGetInt(config_path + " " + child_name + " scope");
962
963 if (scope >= m_ObjectsScope || ignoreScope)
964 {
965 int category_bit = g_Game.ConfigGetInt(config_path + " " + child_name + " debug_ItemCategory") - 1;
966 category_bit = (1 << category_bit);
967
968 bool display = false;
969 int color = 0;
970 if (category_bit & categoryMask)
971 {
972 display = true;
973 }
974 else if ((!m_ConfigDebugProfile.GetMergeType() || categoryMask == 0) && filters.Count() > 0)
975 {
976 string child_name_lower = child_name;
977 child_name_lower.ToLower();
978
979 foreach (int indx, string filter:filters)
980 {
981 if (child_name_lower.Contains(filter))
982 {
983 display = false;
984 color = filterColors.Get(indx);
985 TStringArray arr = itemsByFilters.Get(filter);
986 if (!arr)
987 {
988 arr = new TStringArray();
989 itemsByFilters.Set(filter, arr);
990 }
991 arr.Insert(child_name);
992 itemsAndColors.Insert(child_name,color);
993 break;
994 }
995 }
996 }
997 else if (categoryMask == 0)
998 {
999 display = true;
1000 }
1001
1002 if (display)
1003 {
1004 itemsArray.Insert(child_name);
1005
1006 }
1007 }
1008 }
1009 }
1010
1011 if (itemsArray)
1012 {
1013 itemsArray.Sort();
1014 foreach (string it:itemsArray)
1015 {
1016 widget.AddItem(it, NULL, 0);
1017 }
1018 }
1019
1020 if (filters)
1021 {
1023 filters.Invert();
1024
1025 foreach (string f:filters)
1026 {
1027 TStringArray arr2 = itemsByFilters.Get(f);
1028 if (arr2)
1029 {
1030 arr2.Sort();
1031 foreach (string itm: arr2)
1032 {
1033 int row = widget.AddItem(itm, NULL, 0);
1034 int clr = itemsAndColors.Get(itm);
1035 if (clr)
1036 {
1037 widget.SetItemColor(row, 0, clr);
1038 }
1039 }
1040 }
1041 }
1042 }
1043
1044
1045 }
map
Определения ControlsXboxNew.c:4
DayZGame g_Game
Определения DayZGame.c:3942
void PrepareFilters(string filter, out TStringArray filters, out TIntArray colors)
Определения ScriptConsoleItemsTab.c:900
static int m_ObjectsScope
Определения ScriptConsoleItemsTab.c:11
bool m_FilterOrderReversed
Определения ScriptConsoleItemsTab.c:27
PluginConfigDebugProfile m_ConfigDebugProfile
Определения ScriptConsoleTabBase.c:11
array< string > TStringArray
Определения EnScript.c:712
array< int > TIntArray
Определения EnScript.c:714
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(), g_Game, ScriptConsoleTabBase::m_ConfigDebugProfile, m_FilterOrderReversed, m_ObjectsScope, PrepareFilters() и string::ToLower().

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