internal void DoSettingsWindowContents(Rect outerRect) { SettingsEverOpened = true; bool change = false; Action onChange = () => { change = true; }; Color colorSave = GUI.color; TextAnchor anchorSave = Text.Anchor; Text.Anchor = TextAnchor.MiddleCenter; var headerRect = outerRect.TopPartPixels(50); var restOfRect = new Rect(outerRect); restOfRect.y += 50; restOfRect.height -= 50; Listing_Standard prelist = new Listing_Standard(); prelist.Begin(headerRect); prelist.EnumSelector("ActiveTab_title".Translate(), ref ActiveTab, "ActiveTab_option_", valueTooltipPostfix: null, tooltip: "ActiveTab_desc".Translate()); prelist.GapLine(); prelist.End(); bool needToScroll = cachedScrollHeight > outerRect.height; var viewRect = new Rect(restOfRect); if (needToScroll) { viewRect.width -= 20f; viewRect.height = cachedScrollHeight; Widgets.BeginScrollView(restOfRect, ref scrollPosition, viewRect); } Listing_Standard listingStandard = new Listing_Standard(); listingStandard.maxOneColumn = true; listingStandard.Begin(viewRect); float initialY = listingStandard.GetRect(0).y; float maxWidth = listingStandard.ColumnWidth; //public enum OptionsTab { Presets, Automation, Allowances, Spawning, Misc } switch (ActiveTab) { case OptionsTab.Presets: { if (listingStandard.RadioButton("PresetCustom_title".Translate(), active: ActivePreset == SettingsPreset.Custom, tooltip: "PresetCustom_desc".Translate())) { ApplyPreset(SettingsPreset.Custom); } if (listingStandard.RadioButton("Preset0_title".Translate(), active: ActivePreset == SettingsPreset.Disabled, tooltip: "Preset0_desc".Translate())) { ApplyPreset(SettingsPreset.Disabled); } if (listingStandard.RadioButton("Preset1_title".Translate(), active: ActivePreset == SettingsPreset.LoadoutOnly, tooltip: "Preset1_desc".Translate())) { ApplyPreset(SettingsPreset.LoadoutOnly); } if (listingStandard.RadioButton("Preset1half_title".Translate(), active: ActivePreset == SettingsPreset.Lite, tooltip: "Preset1half_desc".Translate())) { ApplyPreset(SettingsPreset.Lite); } if (listingStandard.RadioButton("Preset2_title".Translate(), active: ActivePreset == SettingsPreset.Basic, tooltip: "Preset2_desc".Translate())) { ApplyPreset(SettingsPreset.Basic); } if (listingStandard.RadioButton("Preset3_title".Translate(), active: ActivePreset == SettingsPreset.Advanced, tooltip: "Preset3_desc".Translate())) { ApplyPreset(SettingsPreset.Advanced); } if (listingStandard.RadioButton("Preset4_title".Translate(), active: ActivePreset == SettingsPreset.Excessive, tooltip: "Preset4_desc".Translate())) { ApplyPreset(SettingsPreset.Excessive); } if (listingStandard.RadioButton("Preset5_title".Translate(), active: ActivePreset == SettingsPreset.Brawler, tooltip: "Preset5_desc".Translate())) { ApplyPreset(SettingsPreset.Brawler); } } break; case OptionsTab.Automation: { var subsection = listingStandard.BeginHiddenSection(out float subsectionHeight); subsection.ColumnWidth = (maxWidth - ColumnGap) / 2; subsection.CheckboxLabeled("ToolAutoSwitch_title".Translate(), ref ToolAutoSwitch, "ToolAutoSwitch_desc".Translate(), onChange: onChange); subsection.CheckboxLabeled("OptimalMelee_title".Translate(), ref OptimalMelee, "OptimalMelee_desc".Translate(), onChange: onChange); subsection.CheckboxLabeled("CQCAutoSwitch_title".Translate(), ref CQCAutoSwitch, "CQCAutoSwitch_desc".Translate(), onChange: onChange); subsection.CheckboxLabeled("CQCTargetOnly_title".Translate(), ref CQCTargetOnly, "CQCTargetOnly_desc".Translate(), onChange: onChange); subsection.NewHiddenColumn(ref subsectionHeight); subsection.CheckboxLabeled("RangedCombatAutoSwitch_title".Translate(), ref RangedCombatAutoSwitch, "RangedCombatAutoSwitch_desc".Translate(), onChange); if (RangedCombatAutoSwitch) { subsection.SliderLabeled("RangedCombatAutoSwitchMaxWarmup_title".Translate(), ref RangedCombatAutoSwitchMaxWarmup, 0, 1, displayMult: 100, valueSuffix: "%", onChange: onChange); } listingStandard.EndHiddenSection(subsection, subsectionHeight); } { var subsection = listingStandard.BeginHiddenSection(out float subsectionHeight); subsection.ColumnWidth = (maxWidth - ColumnGap) / 2; subsection.SliderSpeedBias("SpeedSelectionBiasMelee_title".Translate(), ref SpeedSelectionBiasMelee, 0.5f, 1f, 2f, true, displayMult: 100, valueSuffix: "%", onChange: onChange); subsection.NewHiddenColumn(ref subsectionHeight); subsection.SliderSpeedBias("SpeedSelectionBiasRanged_title".Translate(), ref SpeedSelectionBiasRanged, 0.5f, 1f, 2f, false, displayMult: 100, valueSuffix: "%", onChange: onChange); listingStandard.EndHiddenSection(subsection, subsectionHeight); } break; case OptionsTab.Allowances: { listingStandard.CheckboxLabeled("AllowBlockedWeaponUse_title".Translate(), ref AllowBlockedWeaponUse, "AllowBlockedWeaponUse_desc".Translate(), onChange: onChange); var valBefore = SeparateModes; listingStandard.CheckboxLabeled("SeparateModes_title".Translate(), ref SeparateModes, "SeparateModes_desc".Translate(), onChange: onChange); if (valBefore != SeparateModes) { LimitModeSingle_Match_Cache = null; LimitModeSingleMelee_Match_Cache = null; LimitModeSingleRanged_Match_Cache = null; } } if (!SeparateModes) { Limits(listingStandard, WeaponListKind.Both, onChange: onChange); } else { var subsection = listingStandard.BeginHiddenSection(out float subsectionHeight); subsection.ColumnWidth = (maxWidth - ColumnGap) / 2; Limits(subsection, WeaponListKind.Melee, onChange: onChange); subsection.NewHiddenColumn(ref subsectionHeight); Limits(subsection, WeaponListKind.Ranged, onChange: onChange); listingStandard.EndHiddenSection(subsection, subsectionHeight); listingStandard.GapLine(); listingStandard.EnumSelector("LimitModeAmountTotal_title".Translate(), ref LimitModeAmountTotal, "LimitModeAmount_option_", valueTooltipPostfix: null, tooltip: "LimitModeAmountTotal_desc".Translate(), onChange: onChange); switch (LimitModeAmountTotal) { case LimitModeAmountOfSidearms.AbsoluteWeight: listingStandard.SliderLabeled("MaximumMassAmountAbsolute_title".Translate(), ref LimitModeAmountTotal_AbsoluteMass, 0, InferredValues.maxCapacity, decimalPlaces: 1, valueSuffix: " kg", onChange: onChange); break; case LimitModeAmountOfSidearms.RelativeWeight: listingStandard.SliderLabeled("MaximumMassAmountRelative_title".Translate(), ref LimitModeAmountTotal_RelativeMass, 0, 1, displayMult: 100, valueSuffix: "%", onChange: onChange); break; case LimitModeAmountOfSidearms.Slots: listingStandard.Spinner("MaximumSlots_title".Translate(), ref LimitModeAmountTotal_Slots, min: 1, tooltip: "MaximumSlots_desc".Translate(), onChange: onChange); break; case LimitModeAmountOfSidearms.None: break; } } { Color save = GUI.color; GUI.color = Color.gray; listingStandard.Label("LimitCarryInfo_title".Translate()); GUI.color = save; } break; case OptionsTab.Spawning: { var subsection = listingStandard.BeginHiddenSection(out float subsectionHeight); subsection.ColumnWidth = (maxWidth - ColumnGap) / 2; subsection.SliderLabeled("SidearmSpawnChance_title".Translate(), ref SidearmSpawnChance, 0, 1, displayMult: 100, valueSuffix: "%", tooltip: "SidearmSpawnChance_desc".Translate(), onChange: onChange); subsection.SliderLabeled("SidearmSpawnChanceDropoff_title".Translate(), ref SidearmSpawnChanceDropoff, 0, 1, displayMult: 100, valueSuffix: "%", tooltip: "SidearmSpawnChanceDropoff_desc".Translate(), onChange: onChange); subsection.NewHiddenColumn(ref subsectionHeight); subsection.SliderLabeled("SidearmBudgetMultiplier_title".Translate(), ref SidearmBudgetMultiplier, 0, 1, displayMult: 100, valueSuffix: "%", tooltip: "SidearmBudgetMultiplier_desc".Translate(), onChange: onChange); subsection.SliderLabeled("SidearmBudgetDropoff_title".Translate(), ref SidearmBudgetDropoff, 0, 1, displayMult: 100, valueSuffix: "%", tooltip: "SidearmBudgetDropoff_desc".Translate(), onChange: onChange); listingStandard.EndHiddenSection(subsection, subsectionHeight); } break; case OptionsTab.Misc: { var subsection = listingStandard.BeginHiddenSection(out float subsectionHeight); subsection.ColumnWidth = (maxWidth - ColumnGap) / 2; subsection.EnumSelector("ColonistDefaultWeaponMode_title".Translate(), ref ColonistDefaultWeaponMode, "PrimaryWeaponMode_option_", valueTooltipPostfix: null, tooltip: "ColonistDefaultWeaponMode_desc".Translate(), onChange: onChange); subsection.EnumSelector("NPCDefaultWeaponMode_title".Translate(), ref NPCDefaultWeaponMode, "PrimaryWeaponMode_option_", valueTooltipPostfix: null, tooltip: "NPCDefaultWeaponMode_desc".Translate(), onChange: onChange); subsection.EnumSelector("DropMode_title".Translate(), ref FumbleMode, "DropMode_option_", valueTooltipPostfix: null, tooltip: "DropMode_desc".Translate(), onChange: onChange); Text.Anchor = TextAnchor.MiddleLeft; subsection.Label("FumbleRecoveryChance_title".Translate()); Text.Anchor = TextAnchor.MiddleCenter; var rect = subsection.GetRect(100f); Widgets.DrawBoxSolid(rect, Color.black); var innerRect = rect.ContractedBy(2f); CurveEditorPublic.DoCurveEditor(innerRect, FumbleRecoveryChance, displayMult: 100, valueSuffix: "%", onChange: onChange); Color save = GUI.color; GUI.color = Color.gray; subsection.Label("FumbleRecoveryChance_hint".Translate()); GUI.color = save; subsection.NewHiddenColumn(ref subsectionHeight); subsection.CheckboxLabeled("ReEquipOutOfCombat_title".Translate(), ref ReEquipOutOfCombat, "ReEquipOutOfCombat_desc".Translate(), onChange: onChange); if (ReEquipOutOfCombat) { subsection.CheckboxLabeled("ReEquipBest_title".Translate(), ref ReEquipBest, "ReEquipBest_desc".Translate(), onChange: onChange); subsection.CheckboxLabeled("ReEquipInCombat_title".Translate(), ref ReEquipInCombat, "ReEquipInCombat_desc".Translate(), onChange: onChange); } subsection.GapLine(); subsection.CheckboxLabeled("SkipDangerousWeapons_title".Translate(), ref SkipDangerousWeapons, "SkipDangerousWeapons_desc".Translate(), onChange: onChange); subsection.CheckboxLabeled("SkipEMPWeapons_title".Translate(), ref SkipEMPWeapons, "SkipEMPWeapons_desc".Translate(), onChange: onChange); subsection.GapLine(); subsection.CheckboxLabeled("PreserveInventoryInCaravans_title".Translate(), ref PreserveInventoryInCaravans, "PreserveInventoryInCaravans_desc".Translate(), onChange: onChange); subsection.CheckboxLabeled("HideSidearmsInCaravanDialogs_title".Translate(), ref HideSidearmsInCaravanDialogs, "HideSidearmsInCaravanDialogs_desc".Translate(), onChange: onChange); subsection.GapLine(); subsection.CheckboxLabeled("ShowAlertsMissingSidearm_title".Translate(), ref ShowAlertsMissingSidearm, "ShowAlertsMissingSidearm_desc".Translate(), onChange: onChange); listingStandard.EndHiddenSection(subsection, subsectionHeight); } break; } cachedScrollHeight = listingStandard.CurHeight; listingStandard.End(); if (needToScroll) { Widgets.EndScrollView(); } //GUI.EndGroup(); if (change) { ApplyPreset(SettingsPreset.Custom); } GUI.color = colorSave; Text.Anchor = anchorSave; }