public static void MakerSearch_Search() { if (searchTextMemory.Value == Tools.SearchTextMemory.Global) { foreach (var field in Tools.fields.Where(field => field != null)) { field.text = searchString; } } Tools.MakerSearch_ResetDisables(); if (searchString == "") { return; } var trav = Traverse.Create(ctrl); var datas = trav.Field("lstSelectInfo").GetValue <List <CustomSelectInfo> >(); foreach (var t in datas.Where(t => !Tools.ItemMatchesSearch(t, searchString))) { ctrl.DisvisibleItem(t.index, true); } }
public static void ChangeListFilter(CustomSelectListCtrl customSelectListCtrl, ListVisibilityType visibilityType) { List <CustomSelectInfo> lstSelectInfo = (List <CustomSelectInfo>)Traverse.Create(customSelectListCtrl).Field("lstSelectInfo").GetValue(); int count = 0; for (var i = 0; i < lstSelectInfo.Count; i++) { CustomSelectInfo customSelectInfo = lstSelectInfo[i]; if (visibilityType == ListVisibilityType.All) { customSelectListCtrl.DisvisibleItem(customSelectInfo.index, false); continue; } bool hide = visibilityType != ListVisibilityType.Filtered; if (customSelectInfo.index >= UniversalAutoResolver.BaseSlotID) { ResolveInfo Info = UniversalAutoResolver.TryGetResolutionInfo((ChaListDefine.CategoryNo)customSelectInfo.category, customSelectInfo.index); if (Info != null) { if (CheckBlacklist(Info.GUID, (int)Info.CategoryNo, Info.Slot)) { hide = visibilityType == ListVisibilityType.Filtered; count++; } } } customSelectListCtrl.DisvisibleItem(customSelectInfo.index, hide); } ListVisibility[customSelectListCtrl] = visibilityType; if (count == 0 && visibilityType == ListVisibilityType.Hidden) { Logger.LogMessage("No items are hidden"); ChangeListFilter(customSelectListCtrl, ListVisibilityType.Filtered); } }