// Token: 0x0600001B RID: 27 RVA: 0x0000294C File Offset: 0x00000B4C public static bool CustomDrawer_Filter(Rect rect, SettingHandle <float> slider, bool def_isPercentage, float def_min, float def_max, Color background) { DrawUtility.drawBackground(rect, background); int num = 50; Rect rect2 = new Rect(rect); rect2.width -= (float)num; Rect rect3 = new Rect(rect); rect3.width = (float)num; rect3.position = new Vector2(rect2.position.x + rect2.width + 5f, rect2.position.y + 4f); rect2 = GenUI.ContractedBy(rect2, 2f); if (def_isPercentage) { Widgets.Label(rect3, Mathf.Round(slider.Value * 100f).ToString("F0") + "%"); } else { Widgets.Label(rect3, slider.Value.ToString("F2")); } float num2 = Widgets.HorizontalSlider(rect2, slider.Value, def_min, def_max, true, null, null, null, -1f); bool result = false; bool flag = slider.Value != num2; if (flag) { result = true; } slider.Value = num2; return(result); }
// Token: 0x0600001E RID: 30 RVA: 0x00002D0C File Offset: 0x00000F0C internal static bool CustomDrawer_MatchingWeapons_active(Rect wholeRect, SettingHandle <DictWeaponRecordHandler> setting, List <ThingDef> allWeapons, SettingHandle <float> filter = null, string yesText = "Light weapon", string noText = "Heavy weapon") { DrawUtility.drawBackground(wholeRect, DrawUtility.background); GUI.color = Color.white; Rect rect = new Rect(wholeRect); rect.width = rect.width; rect.height = wholeRect.height - 20f + 2f; rect.position = new Vector2(rect.position.x - 275f, rect.position.y); Rect rect2 = new Rect(wholeRect); rect2.width = rect2.width; rect.height = wholeRect.height - 20f + 2f; rect2.position = new Vector2(rect2.position.x - 275f + rect.width, rect2.position.y); DrawUtility.DrawLabel(yesText, rect, 20f); DrawUtility.DrawLabel(noText, rect2, 20f); rect.position = new Vector2(rect.position.x, rect.position.y + 20f); rect2.position = new Vector2(rect2.position.x, rect2.position.y + 20f); int num = (int)(rect.width / 33f); bool flag = false; int num2 = 0; DrawUtility.filterWeapons(ref setting, allWeapons, filter); Dictionary <string, WeaponRecord> innerList = setting.Value.InnerList; foreach (KeyValuePair <string, WeaponRecord> keyValuePair in innerList) { bool isSelected = keyValuePair.Value.isSelected; if (isSelected) { num2++; } } int num3 = Math.Max(num2 / num, (innerList.Count - num2) / num) + 1; setting.CustomDrawerHeight = (float)num3 * 32f + (float)num3 * 1f + 20f; Dictionary <string, ThingDef> dictionary = allWeapons.ToDictionary((ThingDef o) => o.defName, (ThingDef o) => o); int num4 = 0; int num5 = 0; foreach (KeyValuePair <string, WeaponRecord> item in innerList) { Rect contentRect = item.Value.isSelected ? rect2 : rect; int num6 = item.Value.isSelected ? num5 : num4; bool isSelected2 = item.Value.isSelected; if (isSelected2) { num5++; } else { num4++; } int num7 = num6 % num; int num8 = num6 / num; ThingDef weapon = null; bool flag2 = dictionary.TryGetValue(item.Key, out weapon); bool flag3 = false; bool flag4 = flag2; if (flag4) { flag3 = DrawUtility.DrawIconForWeapon(weapon, item, contentRect, new Vector2(32f * (float)num7 + (float)num7 * 1f, 32f * (float)num8 + (float)num8 * 1f), num6); } bool flag5 = flag3; if (flag5) { flag = true; item.Value.isSelected = !item.Value.isSelected; item.Value.isException = !item.Value.isException; } } bool flag6 = flag; if (flag6) { setting.Value.InnerList = innerList; } return(flag); }