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); } }
public void ChangeListFilter(ListVisibilityType visibilityType) => ChangeListFilter(CustomSelectListCtrlInstance, visibilityType);