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

◆ ChangeFilter()

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

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

175 {
176 widget.ClearItems();
177
178 TStringArray filters;
179 PrepareFilters(filterWidget.GetText(),filters);
180
181 map<string,ref TStringArray> itemsByFilters = new map<string,ref TStringArray>();
182
183 TStringArray itemsArray = TStringArray();
184
185 for (int i = 0; i < classes.Count(); i++)
186 {
187 string config_path = classes.Get(i);
188
189 int objects_count = g_Game.ConfigGetChildrenCount(config_path);
190 for (int j = 0; j < objects_count; j++)
191 {
192 string child_name;
193 bool add = false;
194 g_Game.ConfigGetChildName(config_path, j, child_name);
195
196 if (!filters.Count())
197 {
198 add = true;
199 }
200 else
201 {
202 foreach (int indx, string filter:filters)
203 {
204 string child_name_lower = child_name;
205 child_name_lower.ToLower();
206
207 if (child_name_lower.Contains(filter))
208 {
209 add = true;
210 break;
211 }
212 }
213 }
214 if (add)
215 itemsArray.Insert(child_name);
216 }
217 }
218
219 if (itemsArray)
220 {
221 itemsArray.Sort();
222 foreach (string it:itemsArray)
223 {
224 widget.AddItem(it, NULL, 0);
225 }
226 }
227
228 if (filters)
229 {
230 /*
231 if (m_FilterOrderReversed)
232 filters.Invert();
233 */
234 foreach (string f:filters)
235 {
236 TStringArray arr2 = itemsByFilters.Get(f);
237 if (arr2)
238 {
239 arr2.Sort();
240 foreach (string itm: arr2)
241 {
242 int row = widget.AddItem(itm, NULL, 0);
243 }
244 }
245 }
246 }
247
248
249 }
DayZGame g_Game
Определения DayZGame.c:4074
void PrepareFilters(string filter, out TStringArray filters)
Определения ScriptConsoleSoundsTab.c:157
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(), g_Game, PrepareFilters(), string::ToLower() и TStringArray.

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