public override float DoWindowContents( Rect rect ) { var standardListing = new Listing_Standard( rect ); { var descTR = description.Translate(); var descHeight = Text.CalcHeight( descTR, standardListing.ColumnWidth ); var descRect = standardListing.GetRect( descHeight ); CCL_Widgets.Label( descRect, descTR, Color.gray, GameFont.Small, TextAnchor.UpperLeft ); standardListing.Gap(); for( var index = 0; index < populationOverrides.Length; index++ ) { var storytellerLabel = populationOverrides[ index ].storytellerDef.LabelCap; var storytellerRect = standardListing.GetRect( Text.CalcHeight( storytellerLabel, standardListing.ColumnWidth ) ); CCL_Widgets.Label( storytellerRect, storytellerLabel, Color.white, GameFont.Small, TextAnchor.UpperLeft ); DrawValueGetter( ref standardListing, ref populationOverrides[ index ].desiredPopulationMin, minPopLabel, minPopTip ); DrawValueGetter( ref standardListing, ref populationOverrides[ index ].desiredPopulationMax, maxPopLabel, maxPopTip ); DrawValueGetter( ref standardListing, ref populationOverrides[ index ].desiredPopulationCritical, critPopLabel, critPopTip ); standardListing.Gap(); } } return standardListing.CurHeight; }
protected void fillPageMain(Listing_Standard listing) { //listing.DoHeading("General settings"); if (listing.DoTextButton( Translator.Translate("PSI.Settings.IconSet") + PSI.settings.iconSet)) { List<FloatMenuOption> options = new List<FloatMenuOption>(); foreach (string setname in PSI.iconSets) { options.Add(new FloatMenuOption(setname, () => { PSI.settings.iconSet = setname; PSI.materials = new Materials(setname); PSI.materials.reloadTextures(true); })); } Find.LayerStack.Add((Layer)new Layer_FloatMenu(options, false)); } if (listing.DoTextButton(Translator.Translate("PSI.Settings.LoadPresetButton"))) { string[] presetList = {}; String path2 = GenFilePaths.CoreModsFolderPath + "/Pawn State Icons/Presets/Complete/"; if (Directory.Exists(path2)) presetList = Directory.GetFiles(path2, "*.cfg"); List<FloatMenuOption> options = new List<FloatMenuOption>(); foreach (string setname in presetList) { options.Add(new FloatMenuOption(Path.GetFileNameWithoutExtension(setname), () => { try { PSI.settings = XmlLoader.ItemFromXmlFile<ModSettings>(setname, true); PSI.saveSettings(); PSI.reinit(); } catch (IOException) { Log.Error(Translator.Translate("PSI.Settings.LoadPreset.UnableToLoad") + setname); } })); } Find.LayerStack.Add((Layer)new Layer_FloatMenu(options, false)); } listing.DoGap(); DoHeading(listing,"PSI.Settings.Advanced"); if (listing.DoTextButton(Translator.Translate("PSI.Settings.VisibilityButton"))) page = "showhide"; if (listing.DoTextButton(Translator.Translate("PSI.Settings.ArrangementButton"))) page = "arrange"; if (listing.DoTextButton(Translator.Translate("PSI.Settings.SensitivityButton"))) page = "limits"; }
protected override void FillTab() { var marker = SelMarker; Text.Font = GameFont.Small; var listing = new Listing_Standard( new Rect( 10f, 10f, this.size.x - 20f, this.size.y - 20f ) ); { #region Marker Name var nameRect = listing.GetRect( 30f ); nameRect.width /= 2.0f; Widgets.Label( nameRect, Data.Strings.RoomMarkerName.Translate() ); nameRect.x += nameRect.width; marker.markerName = Widgets.TextField( nameRect, marker.markerName.Substring( 0, Math.Min( marker.markerName.Length, 20 ) ) ); listing.Gap(); #endregion #region Marker Type var typeGroupRect = listing.GetRect( 2 * 28f + 20f); Widgets.DrawMenuSection( typeGroupRect, true ); var position = typeGroupRect.ContractedBy( 10f ); GUI.BeginGroup( position ); { var allowRect = new Rect( 0.0f, 0.0f, position.width, 30f ); var localValue = SelMarker.AllowPrisoners; ITab_Restricted.DoLabelCheckbox( ref allowRect, Data.Strings.AllowPrisoners, ref localValue ); SelMarker.AllowPrisoners = localValue; localValue = SelMarker.AllowSlaves; ITab_Restricted.DoLabelCheckbox( ref allowRect, Data.Strings.AllowSlaves, ref localValue ); SelMarker.AllowSlaves = localValue; } GUI.EndGroup(); listing.Gap(); #endregion } listing.End(); }
protected override void FillTab() { //ConceptDatabase.KnowledgeDemonstrated(ConceptDefOf.PrisonerTab, KnowledgeAmount.GuiFrame); Text.Font = GameFont.Small; Rect rect = new Rect(0f, 20f, size.x, size.y-20).ContractedBy(10f); var listingStandard = new Listing_Standard(rect); { var tryImprove = SelPawn.ImproveRelationship(); var tryRecruit = SelPawn.TryRecruit(); listingStandard.OverrideColumnWidth = size.x; listingStandard.DoLabelCheckbox("ShouldTryToRecruit".Translate(), ref tryRecruit); listingStandard.DoLabelCheckbox("ImproveRelationship".Translate(), ref tryImprove); listingStandard.DoLabel(txtRecruitmentDifficulty + ": " + MakeDifficultyRelative(SelPawn).ToString("##0")); listingStandard.DoLabel(txtRecruitmentPenalty + ": " + SelPawn.RecruitPenalty().ToString("##0")); listingStandard.DoLabel("Faction goodwill: " + SelPawn.Faction.ColonyGoodwill.ToString("##0")); SelPawn.guest.interactionMode = tryRecruit ? PrisonerInteractionMode.AttemptRecruit : tryImprove ? PrisonerInteractionMode.Chat : PrisonerInteractionMode.NoInteraction; } listingStandard.End(); }
public static void DrawCustomStorytellerInterface(Rect rect, ref StorytellerDef chosenStoryteller, ref DifficultyDef difficulty, Listing_Standard infoListing) { //if (chosenStoryteller.defName != "StorytellerPacks") return; Rect storytellerPacksButton = new Rect(140f, rect.height - 50f, 190f, 38f); if (Widgets.ButtonText(storytellerPacksButton, "Storyteller Packs")) { Window_StorytellerPacks window = new Window_StorytellerPacks(); Find.WindowStack.TryRemove(window.GetType()); Find.WindowStack.Add(window); } }
public override void DoWindowContents(Rect inRect) { const float categoryPadding = 10f; const float categoryInset = 30f; const float radioLabelInset = 40f; const float mainListingSpacing = 6f; const float subListingSpacing = 6f; const float subListingLabelWidth = 100f; const float subListingRowHeight = 30f; const float checkboxListingWidth = 280f; const float listingColumnSpacing = 17f; const string shiftTip = "Hold Shift while starting up to prevent the quickstart."; var settings = QuickstartController.Settings; var mainListing = new Listing_Standard(); mainListing.verticalSpacing = mainListingSpacing; mainListing.Begin(inRect); Text.Font = GameFont.Medium; mainListing.Label("Quickstart settings"); Text.Font = GameFont.Small; mainListing.GapLine(); mainListing.Gap(); OperationModeRadioButton(mainListing, radioLabelInset, "Quickstart off", settings, QuickstartSettings.QuickstartMode.Disabled, "Quickstart functionality is disabled.\nThe game starts normally."); OperationModeRadioButton(mainListing, radioLabelInset, "Quickstart: load save file", settings, QuickstartSettings.QuickstartMode.LoadMap, "Load the selected saved game right after launch.\n" + shiftTip); var expectedHeight = categoryPadding * 2 + (subListingRowHeight + subListingSpacing) * 1; MakeSubListing(mainListing, 0, expectedHeight, categoryPadding, categoryInset, subListingSpacing, (sub, width) => { sub.ColumnWidth = subListingLabelWidth; Text.Anchor = TextAnchor.MiddleLeft; var rect = sub.GetRect(subListingRowHeight); Widgets.Label(rect, "Save file:"); Text.Anchor = TextAnchor.UpperLeft; sub.NewColumn(); sub.ColumnWidth = width - subListingLabelWidth - listingColumnSpacing; MakeSelectSaveButton(sub, settings); }); OperationModeRadioButton(mainListing, radioLabelInset, "Quickstart: generate map", settings, QuickstartSettings.QuickstartMode.GenerateMap, "Generate a new map right after launch.\nWorks the same as using the \"quicktest\" command line option.\n" + shiftTip); expectedHeight = categoryPadding * 2 + (subListingRowHeight + subListingSpacing) * 2; MakeSubListing(mainListing, 0, expectedHeight, categoryPadding, categoryInset, subListingSpacing, (sub, width) => { sub.ColumnWidth = subListingLabelWidth; Text.Anchor = TextAnchor.MiddleLeft; var rect = sub.GetRect(subListingRowHeight); Widgets.Label(rect, "Scenario:"); rect = sub.GetRect(subListingRowHeight); Widgets.Label(rect, "Map size:"); Text.Anchor = TextAnchor.UpperLeft; sub.NewColumn(); sub.ColumnWidth = width - subListingLabelWidth - listingColumnSpacing; MakeSelectScenarioButton(sub, settings); MakeSelectMapSizeButton(sub, settings); }); expectedHeight = categoryPadding * 2 + (subListingRowHeight + subListingSpacing) * 3; MakeSubListing(mainListing, checkboxListingWidth, expectedHeight, categoryPadding, 0f, subListingSpacing, (sub, width) => { sub.CheckboxLabeled("Abort quickstart on error", ref settings.StopOnErrors, "Prevent quickstart if errors are detected during startup."); sub.CheckboxLabeled("Abort quickstart on warning", ref settings.StopOnWarnings, "Prevent quickstart if warnings are detected during startup."); sub.CheckboxLabeled("Ignore version & mod config mismatch", ref settings.BypassSafetyDialog, "Skip the mod config mismatch dialog and load all saved games regardless."); }); mainListing.End(); Text.Anchor = TextAnchor.UpperLeft; var btnSize = new Vector2(180f, 40f); var buttonYStart = inRect.height - btnSize.y; if (Widgets.ButtonText(new Rect(inRect.x, buttonYStart, btnSize.x, btnSize.y), "Generate map now")) { Close(); QuickstartController.InitateMapGeneration(); } if (Widgets.ButtonText(new Rect(inRect.width - btnSize.x, buttonYStart, btnSize.x, btnSize.y), "Close")) { Close(); } }
public override void DoSettingsWindowContents(Rect inRect) { var leftRect = new Rect(inRect.x, inRect.y, inRect.width * 0.65f, inRect.height); var rightRect = new Rect((int)(inRect.x + inRect.width * 0.65f + 30f), inRect.y, inRect.width * 0.35f - 30f, inRect.height); var listing_options = new Listing_Standard(); listing_options.Begin(leftRect); listing_options.CheckboxLabeled("PrisonLabor_ShowNews".Translate(), ref showNews, "PrisonLabor_ShowNewsDesc".Translate()); listing_options.GapLine(); if (listing_options.ButtonTextLabeled("PrisonLabor_DefaultInterMode".Translate(), interactionModeList[defaultInteractionMode].LabelCap)) { defaultInteractionMode = defaultInteractionMode < interactionModeList.Count - 1 ? defaultInteractionMode + 1 : 0; } listing_options.GapLine(); listing_options.Label("PrisonLabor_AllowedWorkTypes".Translate(), -1f); listing_options.CheckboxLabeled(" " + "PrisonLabor_AllowAll".Translate(), ref allowAllWorktypes, "PrisonLabor_AllowAllWorkTypes".Translate()); if (!allowAllWorktypes) { if (listing_options.ButtonTextLabeled(" " + "PrisonLabor_AllowedWorkTypesL".Translate(), "PrisonLabor_Browse".Translate())) { Find.WindowStack.Add(new SelectWorkTypesDialog()); } } else { listing_options.Gap(); } listing_options.GapLine(); listing_options.CheckboxLabeled("PrisonLabor_MotivationMechanics".Translate(), ref enableMotivationMechanics, "PrisonLabor_MotivationWarning".Translate()); listing_options.GapLine(); listing_options.CheckboxLabeled("PrisonLabor_MotivationIcons".Translate(), ref enableMotivationIcons, "PrisonLabor_MotivationIconsDesc".Translate()); listing_options.GapLine(); listing_options.CheckboxLabeled("PrisonLabor_CanGrowAdvanced".Translate(), ref advancedGrowing, "PrisonLabor_CanGrowAdvancedDesc".Translate()); listing_options.GapLine(); listing_options.CheckboxLabeled("PrisonLabor_EnableRevolts".Translate(), ref enableRevolts, "PrisonLabor_EnableRevoltsDesc".Translate()); listing_options.GapLine(); listing_options.CheckboxLabeled("PrisonLabor_EnableSuicide".Translate(), ref enableSuicide, "PrisonLabor_EnableSuicideDesc".Translate()); listing_options.GapLine(); listing_options.CheckboxLabeled("PrisonLabor_ShowTreatmentHappiness".Translate(), ref showTreatmentHappiness, "PrisonLabor_ShowTreatmentHappinessDesc".Translate()); listing_options.Gap(); listing_options.Gap(); listing_options.Gap(); if (listing_options.ButtonTextLabeled("PrisonLabor_ButtonRemoveModFromSaveDesc".Translate(), "PrisonLabor_ButtonRemoveModFromSave".Translate())) { Find.WindowStack.Add(new SelectSaveForCleaningDialog()); } listing_options.End(); var listing_panel = new Listing_Standard(); listing_panel.Begin(rightRect); var heigh_temp = rightRect.width * 0.56f; GUI.DrawTexture(new Rect(0, 0, rightRect.width, heigh_temp), ContentFinder <Texture2D> .Get("Preview", true)); listing_panel.Gap(heigh_temp); listing_panel.Label("Prison Labor", -1f); listing_panel.Label("PrisonLabor_Version".Translate() + VersionUtility.versionString, -1f); listing_panel.GapLine(); listing_panel.Label("PrisonLabor_Difficulty".Translate() + difficulty, -1f); listing_panel.GapLine(); if (listing_panel.ButtonText("PrisonLabor_Defaults".Translate())) { PrisonLaborPrefs.RestoreToDefault(); Init(); } if (listing_panel.ButtonText("PrisonLabor_ShowNews".Translate())) { NewsWindow.ShowAll = true; NewsWindow.ForceShow(); } if (listing_panel.ButtonText("PrisonLabor_ReplayTurorialsButton".Translate())) { ReplayTutorialsWindow.Show(); } listing_panel.End(); Apply(); }
private void DoCheckbox( ref Listing_Standard listing, ref bool value, string labelKey ) { var originalFont = Text.Font; var originalAnchor = Text.Anchor; var rect = listing.GetRect( entrySize ); var label = labelKey.Translate(); var labelWidth = rect.width - entrySize - innerPadding; var labelHeight = Text.CalcHeight( label, labelWidth ); if( labelHeight > entrySize ) { rect.height = labelHeight; listing.Gap( labelHeight - entrySize ); } Text.Font = fontCheckbox; Text.Anchor = TextAnchor.MiddleLeft; Vector2 checkVec = new Vector2( rect.x, rect.y ); Rect labelRect = new Rect( rect.x + entrySize + innerPadding, rect.y, labelWidth, rect.height ); Widgets.Checkbox( checkVec, ref value ); Widgets.Label( labelRect, label ); Text.Anchor = originalAnchor; Text.Font = originalFont; listing.Gap(); }
private void DrawValueGetter( ref Listing_Standard listing, ref float value, string labelKey, string tipKey ) { var baseRect = listing.GetRect( entrySize + innerPadding ); var labelRect = new Rect( baseRect ); var entryRect = new Rect( baseRect ); labelRect.width -= textEntrySize; entryRect.x += labelRect.width; entryRect.width = textEntrySize; labelRect.width -= innerPadding; var valInt = (int)value; var buffer = valInt.ToString(); CCL_Widgets.Label( labelRect, labelKey.Translate(), Color.gray, GameFont.Small, TextAnchor.MiddleRight, tipKey.Translate() ); var result = Widgets.TextField( entryRect, buffer ); if( int.TryParse( result, out valInt ) ) { value = valInt; } }
private void DoHeading(Listing_Standard listing,String translator_key, bool translate = true) { Text.Font = GameFont.Medium; listing.DoLabel(translate?Translator.Translate(translator_key):translator_key); Text.Font = GameFont.Small; }
public virtual void DoWindowContents(Listing_Standard listing) { Driver.DoWindowContents(listing); }
public override void DoWindowContents(Rect inRect) { var listRect = new Rect(inRect.x, inRect.y + 10f, inRect.width, inRect.height - 50f); var contentRect = new Rect(0f, 0f, inRect.width - 20f, 24f * workTypes.Count()); Widgets.BeginScrollView(listRect, ref this.position, contentRect, true); var listing_Standard = new Listing_Standard(); listing_Standard.Begin(contentRect); WorkTypeDef workTypeClicked = null; foreach (var workDef in workTypes.Keys) { string label = workDef.labelShort, tooltip = workDef.description; var lineHeight = Text.LineHeight; var checkOn = workTypes[workDef]; //workTypes.TryGetValue(workDef, out checkOn); var rect = listing_Standard.GetRect(lineHeight); if (!tooltip.NullOrEmpty()) { if (Mouse.IsOver(rect)) { Widgets.DrawHighlight(rect); } TooltipHandler.TipRegion(rect, tooltip); } var anchor = Text.Anchor; Text.Anchor = TextAnchor.MiddleLeft; Widgets.Label(rect, label); if (Widgets.ButtonInvisible(rect, false)) { workTypeClicked = workDef; if (checkOn) { SoundDefOf.Checkbox_TurnedOn.PlayOneShotOnCamera(null); } else { SoundDefOf.Checkbox_TurnedOff.PlayOneShotOnCamera(null); } } var color = GUI.color; Texture2D image; if (checkOn) { image = Widgets.CheckboxOnTex; } else { image = Widgets.CheckboxOffTex; } var position = new Rect(rect.x + rect.width - 24f, rect.y, 24f, 24f); GUI.DrawTexture(position, image); Text.Anchor = anchor; listing_Standard.Gap(listing_Standard.verticalSpacing); } if (workTypeClicked != null) { workTypes[workTypeClicked] = !workTypes[workTypeClicked]; Apply(workTypes); } maxH = listing_Standard.CurHeight; listing_Standard.End(); Widgets.EndScrollView(); }
public override void DoWindowContents(Rect inRect) { Listing_Standard listing_Standard = new Listing_Standard(); listing_Standard.Begin(inRect.AtZero()); // Icon if (factionDef.FactionIcon) { var rectIcon = listing_Standard.GetRect(64); var center = rectIcon.center.x; rectIcon.xMin = center - 32; rectIcon.xMax = center + 32; GUI.DrawTexture(rectIcon, factionDef.FactionIcon); } // Title Text.Font = GameFont.Medium; Text.Anchor = TextAnchor.MiddleCenter; listing_Standard.Label("VanillaFactionsExpanded.FactionTitle".Translate(new NamedArgument(factionDef.LabelCap, "FactionName"))); listing_Standard.GapLine(); // Description Text.Font = GameFont.Small; Text.Anchor = TextAnchor.UpperLeft; var modName = GetModName(); listing_Standard.Label("VanillaFactionsExpanded.ModInfo".Translate(new NamedArgument(modName, "ModName"))); if (factionDef.hidden) { GUI.color = colorCoreMod; listing_Standard.Label("VanillaFactionsExpanded.HiddenFactionInfo".Translate()); if (factionDef.requiredCountAtGameStart > 0) { listing_Standard.Label("VanillaFactionsExpanded.RequiredFactionInfo".Translate(new NamedArgument(modName, "ModName"))); } } GUI.color = new Color(1f, 0.3f, 0.35f); if (!factionDef.canMakeRandomly && factionDef.requiredCountAtGameStart <= 0) { listing_Standard.Label("VanillaFactionsExpanded.NonSpawningFactionInfo".Translate()); } GUI.color = Color.white; listing_Standard.Gap(40); listing_Standard.Label("VanillaFactionsExpanded.FactionSelectOption".Translate()); listing_Standard.Gap(60); // Options if (factionDef.hidden) { if (listing_Standard.ButtonText("VanillaFactionsExpanded.FactionButtonAdd".Translate())) { SpawnWithoutBases(); } } else { if (listing_Standard.ButtonText("VanillaFactionsExpanded.FactionButtonAddFull".Translate())) { SpawnWithBases(); } } if (listing_Standard.ButtonText("VanillaFactionsExpanded.FactionButtonSkip".Translate())) { Skip(); } GUI.color = new Color(1f, 0.3f, 0.35f); if (listing_Standard.ButtonText("VanillaFactionsExpanded.FactionButtonIgnore".Translate())) { Ignore(); } GUI.color = Color.white; listing_Standard.End(); }
public void DoWindowContents(Rect rect) { Listing_Standard options = new Listing_Standard(); Color defaultColor = new Color(100, 65, 164); options.Begin(rect); Text.Font = GameFont.Medium; Text.Anchor = TextAnchor.MiddleCenter; GUI.color = Color.magenta; options.Label("TwitchToolkitSettingsTitle".Translate()); GUI.color = defaultColor; Text.Font = GameFont.Small; Text.Anchor = TextAnchor.UpperLeft; options.GapLine(); options.Gap(); options.ColumnWidth = rect.width / 3; // Left column if (options.ButtonText("TwitchToolkitChat".Translate())) { currentTab = SettingsTab.Chat; } if (options.ButtonText("TwitchToolkitCoins".Translate())) { currentTab = SettingsTab.Coins; } if (options.ButtonText("Storyteller")) { currentTab = SettingsTab.Storyteller; } if (options.ButtonText("Patches")) { currentTab = SettingsTab.Patches; } // Middle column options.NewColumn(); options.Gap(53f); if (options.ButtonText("TwitchToolkitStore".Translate())) { currentTab = SettingsTab.Store; } if (options.ButtonText("TwitchToolkitKarma".Translate())) { currentTab = SettingsTab.Karma; } if (options.ButtonText("TwitchToolkitCommands".Translate())) { currentTab = SettingsTab.Commands; } if (options.ButtonText("TwitchToolkitCooldowns".Translate())) { currentTab = SettingsTab.Cooldowns; } // Right Column options.NewColumn(); options.Gap(53f); if (options.ButtonText("TwitchToolkitOptions".Translate())) { currentTab = SettingsTab.Options; } if (options.ButtonText("TwitchToolkitViewers".Translate())) { currentTab = SettingsTab.Viewers; } if (options.ButtonText("TwitchToolkitIntegrations".Translate())) { currentTab = SettingsTab.Integrations; } if (options.ButtonText("Votes")) { currentTab = SettingsTab.Votes; } options.End(); Listing_Standard gapline = new Listing_Standard(); Rect gapliRect = new Rect(rect.x, rect.y, rect.width, rect.height); gapline.Begin(gapliRect); gapline.Gap(); gapline.End(); Rect optionsRect = rect; optionsRect.y = 145; optionsRect.height = 620f; optionsRect.yMax = 765f; Rect scrollViewer = new Rect(optionsRect); scrollViewer.height -= 145f; scrollViewer.yMax -= 145f; Rect viewRect = new Rect(0, 0, rect.width - 100f, 430f); viewRect.width -= 25f; if (currentTab == SettingsTab.Karma) { viewRect.height += 250f; } if (currentTab == SettingsTab.Votes) { viewRect.height = (DefDatabase <VotingIncident> .AllDefs.Count() * 30f) + 35f; } Listing_Standard optionsListing = new Listing_Standard(); optionsListing.Begin(optionsRect); optionsListing.BeginScrollView(scrollViewer, ref scrollVector2, ref viewRect); switch (currentTab) { case SettingsTab.Coins: Settings_Coins.DoWindowContents(viewRect, optionsListing); break; case SettingsTab.Storyteller: Settings_Storyteller.DoWindowContents(viewRect, optionsListing); break; case SettingsTab.Patches: Settings_Patches.DoWindowContents(viewRect, optionsListing); break; case SettingsTab.Store: Settings_Store.DoWindowContents(viewRect, optionsListing); break; case SettingsTab.Karma: Settings_Karma.DoWindowContents(viewRect, optionsListing); break; case SettingsTab.Commands: Settings_Commands.DoWindowContents(viewRect, optionsListing); break; case SettingsTab.Cooldowns: Settings_Cooldowns.DoWindowContents(viewRect, optionsListing); break; case SettingsTab.Options: Settings_Options.DoWindowContents(viewRect, optionsListing); break; case SettingsTab.Viewers: Settings_Viewers.DoWindowContents(viewRect, optionsListing); break; case SettingsTab.Integrations: Settings_Integrations.DoWindowContents(viewRect, optionsListing); break; case SettingsTab.Votes: Settings_VoteWeights.DoWindowContents(viewRect, optionsListing); break; default: Settings_Chat.DoWindowContents(viewRect, optionsListing); break; } optionsListing.EndScrollView(ref viewRect); optionsListing.End(); }
// public static float horHeadOffset; protected override void DoBasicSettingsMenu(Listing_Standard listing) { base.DoBasicSettingsMenu(listing); // listing_Standard.CheckboxLabeled("Equipment", ref Equipment); // listing_Standard.Label(horHeadOffset.ToString("N2") + " - " + verHeadOffset.ToString("N2")); // horHeadOffset = listing_Standard.Slider(horHeadOffset, -1f, 1f); // verHeadOffset = listing_Standard.Slider(verHeadOffset, -1f, 1f); listing.Label(this.BodyAnimDef.offCenterX.ToString("N2")); this.BodyAnimDef.offCenterX = listing.Slider(this.BodyAnimDef.offCenterX, -0.2f, 0.2f); if (listing.ButtonText(EditorPosecycle?.LabelCap)) { List <string> exists = new List <string>(); List <FloatMenuOption> list = new List <FloatMenuOption>(); this.BodyAnimDef.poseCycles.Clear(); foreach (PoseCycleDef posecycle in (from bsm in DefDatabase <PoseCycleDef> .AllDefs orderby bsm.LabelCap select bsm) .TakeWhile(current => this.BodyAnimDef.PoseCycleType != "None") .Where(current => current.PoseCycleType == this.BodyAnimDef.PoseCycleType)) { list.Add(new FloatMenuOption(posecycle.LabelCap, delegate { EditorPosecycle = posecycle; })); exists.Add(posecycle.locomotionUrgency.ToString()); this.BodyAnimDef.poseCycles.Add(posecycle); } string[] names = Enum.GetNames(typeof(LocomotionUrgency)); for (int index = 0; index < names.Length; index++) { string name = names[index]; LocomotionUrgency myenum = (LocomotionUrgency)Enum.ToObject(typeof(LocomotionUrgency), index); if (exists.Contains(myenum.ToString())) { continue; } list.Add( new FloatMenuOption( "Add new " + this.BodyAnimDef.PoseCycleType + "_" + myenum, delegate { PoseCycleDef newCycle = new PoseCycleDef(); newCycle.defName = newCycle.label = this.BodyAnimDef.PoseCycleType + "_" + name; newCycle.locomotionUrgency = myenum; newCycle.PoseCycleType = this.BodyAnimDef.PoseCycleType; GameComponent_FacialStuff.BuildPoseCycles(newCycle); EditorPosecycle = newCycle; this.BodyAnimDef.poseCycles.Add(newCycle); })); } Find.WindowStack.Add(new FloatMenu(list)); } listing.Gap(); string configFolder = DefPath; if (listing.ButtonText("Export BodyDef")) { string filePath = configFolder + "/BodyAnimDefs/" + this.BodyAnimDef.defName + ".xml"; Find.WindowStack.Add( Dialog_MessageBox.CreateConfirmation( "Confirm overwriting " + filePath, delegate { ExportAnimDefs.Defs animDef = new ExportAnimDefs.Defs(this.BodyAnimDef); DirectXmlSaver.SaveDataObject( animDef, filePath); }, true)); // BodyAnimDef animDef = this.bodyAnimDef; } if (listing.ButtonText("Export PoseCycle")) { string path = configFolder + "/PoseCycleDefs/" + EditorPosecycle?.defName + ".xml"; Find.WindowStack.Add( Dialog_MessageBox.CreateConfirmation( "Confirm overwriting " + path, delegate { ExportPoseCycleDefs.Defs cycle = new ExportPoseCycleDefs.Defs(EditorPosecycle); DirectXmlSaver.SaveDataObject( cycle, path); }, true)); } }
public void DoWindowContents(Rect wrect) { float days; float hours; // wrect.yMin += 15f; // wrect.yMax -= 15f; var options = new Listing_Standard(); // var outRect = new Rect(wrect.x, wrect.y, wrect.width, wrect.height); // Size of viewed area var scrollRect = new Rect(0f, 0f, wrect.width - 16f, wrect.height * 1.5f); // Size of content data Widgets.BeginScrollView(outRect, ref scrollPosition, scrollRect, true); options.Begin(scrollRect); Header(options, "Performance_Settings".Translate(), false); if (degradation) { options.CheckboxLabeled("TF_alertToolNeedsReplacing".Translate(), ref alertToolNeedsReplacing, "TF_alertToolNeedsReplacing_tooltip".Translate()); if (alertToolNeedsReplacing) { options.Gap(); days = Mathf.FloorToInt((float)alertToolNeedsReplacing_Delay / GenDate.TicksPerDay); hours = ((float)alertToolNeedsReplacing_Delay - days * GenDate.TicksPerDay) / GenDate.TicksPerHour; options.Label("TF_alertToolNeedsReplacing_Delay".Translate() + $"\t{days} " + "DaysLower".Translate() + $" {hours.ToString("F02")} " + "HoursLower".Translate(), tooltip: "TF_alertToolNeedsReplacing_Delay_tooltip".Translate()); alertToolNeedsReplacing_Delay = Mathf.RoundToInt(options.Slider(alertToolNeedsReplacing_Delay, 1, GenDate.TicksPerDay)); options.Gap(); days = Mathf.FloorToInt(alertToolNeedsReplacing_Treshold); hours = alertToolNeedsReplacing_Treshold % 1f * 24f; options.Label("TF_alertToolNeedsReplacing_Treshold".Translate() + $"\t{days} " + "DaysLower".Translate() + $" {hours.ToString("F02")} " + "HoursLower".Translate(), tooltip: "TF_alertToolNeedsReplacing_Treshold_tooltip".Translate()); alertToolNeedsReplacing_Treshold = options.Slider(alertToolNeedsReplacing_Treshold, 0.01f, 10f); } } if (optimization) { options.Gap(); days = Mathf.FloorToInt((float)optimizationDelay / GenDate.TicksPerDay); hours = ((float)optimizationDelay - days * GenDate.TicksPerDay) / GenDate.TicksPerHour; options.Label("TF_optimizationDelay".Translate() + $"\t{days} " + "DaysLower".Translate() + $" {hours.ToString("F02")} " + "HoursLower".Translate(), tooltip: "TF_optimizationDelay_tooltip".Translate()); optimizationDelay = Mathf.RoundToInt(options.Slider(optimizationDelay, GenDate.TicksPerHour, GenDate.TicksPerYear)); options.Gap(); days = Mathf.FloorToInt((float)mapTrackerDelay_StoredTools / GenDate.TicksPerDay); hours = ((float)mapTrackerDelay_StoredTools - days * GenDate.TicksPerDay) / GenDate.TicksPerHour; options.Label("TF_mapTrackerDelay_Stored".Translate() + $"\t{days} " + "DaysLower".Translate() + $" {hours.ToString("F02")} " + "HoursLower".Translate(), tooltip: "TF_mapTrackerDelay_Stored_tooltip".Translate()); mapTrackerDelay_StoredTools = Mathf.RoundToInt(options.Slider(mapTrackerDelay_StoredTools, GenDate.TicksPerHour, GenDate.TicksPerYear)); days = Mathf.FloorToInt((float)mapTrackerDelay_UseableTools / GenDate.TicksPerDay); hours = ((float)mapTrackerDelay_UseableTools - days * GenDate.TicksPerDay) / GenDate.TicksPerHour; options.Label("TF_mapTrackerDelay_Useable".Translate() + $"\t{days} " + "DaysLower".Translate() + $" {hours.ToString("F02")} " + "HoursLower".Translate(), tooltip: "TF_mapTrackerDelay_Useable_tooltip".Translate()); mapTrackerDelay_UseableTools = Mathf.RoundToInt(options.Slider(mapTrackerDelay_UseableTools, GenDate.TicksPerHour, GenDate.TicksPerYear)); if (mapTrackerDelay_UseableTools > mapTrackerDelay_StoredTools) { mapTrackerDelay_UseableTools = mapTrackerDelay_StoredTools; } } if (opportunisticTakeTool) { options.Gap(); if (ModsConfig.IsActive("fluffy.colonymanager")) { options.CheckboxLabeled("TF_opportunisticTakeTool_calcPath".Translate(), ref opportunisticTakeTool_calcPath, "TF_opportunisticTakeTool_calcPath_tooltip".Translate()); } else { options.CheckboxLabeled("TF_opportunisticTakeTool_calcPath".Translate(), ref opportunisticTakeTool_calcPath, "TF_opportunisticTakeTool_calcPath_tooltip".Translate()); } } if (!degradation && !optimization && !opportunisticTakeTool) { GUI.color = Color.gray; options.Label("NoPerformanceTweaks".Translate()); GUI.color = Color.white; } Header(options, "Gameplay_Settings".Translate(), false); options.CheckboxLabeled("TF_degredation".Translate(), ref degradation, "TF_degredation_tooltip".Translate()); if (degradation) { options.Gap(); options.Label("TF_degredationFactor".Translate() + $"\tx{degradationFactor.ToString("F02")}", tooltip: "TF_degredationFactor_tooltip".Translate()); degradationFactor = options.Slider(degradationFactor, 0.01f, 10f); options.Gap(); } options.Gap(); var equipString = equipTool ? "TF_equipTool_equip".Translate() : "TF_usefrominv".Translate(); options.CheckboxLabeled("TF_equipTool".Translate() + $": {equipString}", ref equipTool, "TF_equipTool_tooltip".Translate()); if (equipTool) { options.Gap(); options.CheckboxLabeled("TF_draw".Translate(), ref draw, "TF_draw_tooltip".Translate()); } options.Gap(); options.CheckboxLabeled("TF_equipDelay".Translate(), ref equipDelay, "TF_equipDelay_tooltip".Translate()); if (equipDelay) { options.Gap(); options.Label("TF_equipDelayFactor".Translate() + $"\tx{equipDelayFactor.ToString("F02")}", tooltip: "TF_equipDelayFactor_tooltip".Translate()); equipDelayFactor = options.Slider(equipDelayFactor, 0.01f, 10); } options.Gap(); options.CheckboxLabeled("TF_optimization".Translate(), ref optimization, "TF_optimization_tooltip".Translate()); options.Gap(); options.CheckboxLabeled("TF_opportunisticToolJobs".Translate(), ref opportunisticToolJobs, "TF_opportunisticToolJobs_tooltip".Translate()); if (opportunisticToolJobs) { options.Gap(); options.CheckboxLabeled("TF_opportunisticReturnTool".Translate(), ref opportunisticReturnTool, "TF_opportunisticReturnTool_tooltip".Translate()); options.Gap(); options.CheckboxLabeled("TF_opportunisticTakeTool".Translate(), ref opportunisticTakeTool, "TF_opportunisticTakeTool_tooltip".Translate()); } options.End(); Widgets.EndScrollView(); // Mod.GetSettings<Settings>().Write(); }
public override void DoWindowContents(Rect inRect) { Listing_Standard listing_Standard = new Listing_Standard(); listing_Standard.ColumnWidth = 200f; listing_Standard.Begin(inRect.AtZero()); Text.Font = GameFont.Medium; listing_Standard.Label("MapSize".Translate(), -1f, null); Text.Font = GameFont.Small; IEnumerable <int> enumerable = Dialog_AdvancedGameConfig.MapSizes.AsEnumerable <int>(); if (Prefs.TestMapSizes) { enumerable = enumerable.Concat(Dialog_AdvancedGameConfig.TestMapSizes); } foreach (int num in enumerable) { if (num == 200) { listing_Standard.Label("MapSizeSmall".Translate(), -1f, null); } else if (num == 250) { listing_Standard.Gap(10f); listing_Standard.Label("MapSizeMedium".Translate(), -1f, null); } else if (num == 300) { listing_Standard.Gap(10f); listing_Standard.Label("MapSizeLarge".Translate(), -1f, null); } else if (num == 350) { listing_Standard.Gap(10f); listing_Standard.Label("MapSizeExtreme".Translate(), -1f, null); } string label = "MapSizeDesc".Translate(new object[] { num, num * num }); if (listing_Standard.RadioButton(label, Find.GameInitData.mapSize == num, 0f, null)) { Find.GameInitData.mapSize = num; } } listing_Standard.NewColumn(); Text.Font = GameFont.Medium; listing_Standard.Label("MapStartSeason".Translate(), -1f, null); Text.Font = GameFont.Small; listing_Standard.Label(string.Empty, -1f, null); if (listing_Standard.RadioButton("MapStartSeasonDefault".Translate(), Find.GameInitData.startingSeason == Season.Undefined, 0f, null)) { Find.GameInitData.startingSeason = Season.Undefined; } if (listing_Standard.RadioButton(Season.Spring.LabelCap(), Find.GameInitData.startingSeason == Season.Spring, 0f, null)) { Find.GameInitData.startingSeason = Season.Spring; } if (listing_Standard.RadioButton(Season.Summer.LabelCap(), Find.GameInitData.startingSeason == Season.Summer, 0f, null)) { Find.GameInitData.startingSeason = Season.Summer; } if (listing_Standard.RadioButton(Season.Fall.LabelCap(), Find.GameInitData.startingSeason == Season.Fall, 0f, null)) { Find.GameInitData.startingSeason = Season.Fall; } if (listing_Standard.RadioButton(Season.Winter.LabelCap(), Find.GameInitData.startingSeason == Season.Winter, 0f, null)) { Find.GameInitData.startingSeason = Season.Winter; } listing_Standard.NewColumn(); Text.Font = GameFont.Medium; listing_Standard.Label("Notice".Translate(), -1f, null); Text.Font = GameFont.Small; listing_Standard.Label(string.Empty, -1f, null); bool flag = false; if (this.selTile >= 0 && Find.GameInitData.startingSeason != Season.Undefined) { float y = Find.WorldGrid.LongLatOf(this.selTile).y; if (GenTemperature.AverageTemperatureAtTileForTwelfth(this.selTile, Find.GameInitData.startingSeason.GetFirstTwelfth(y)) < 3f) { listing_Standard.Label("MapTemperatureDangerWarning".Translate(), -1f, null); flag = true; } } if (Find.GameInitData.mapSize > 280) { listing_Standard.Label("MapSizePerformanceWarning".Translate(), -1f, null); flag = true; } if (!flag) { listing_Standard.None(); } listing_Standard.End(); }
public virtual void DoWindowContents(Listing_Standard listing) { }
public void DoContent(Rect canvas) { Widgets.DrawMenuSection(canvas); if (Job != null) { // leave some space for bottom buttons. float bottomButtonsHeight = 30f; float bottomButtonsGap = 6f; canvas.height = canvas.height - bottomButtonsHeight - bottomButtonsGap; // bottom buttons Rect bottomButtons = new Rect(canvas.xMin, canvas.height + bottomButtonsGap, canvas.width, bottomButtonsHeight); GUI.BeginGroup(bottomButtons); // add / remove to the stack Rect add = new Rect(bottomButtons.width * .75f, 0f, bottomButtons.width / 4f - 6f, bottomButtons.height); if (Source == SourceOptions.Current) { if (Widgets.TextButton(add, "FM.Delete".Translate())) { Manager.JobStack.Delete(Job); Job = null; RefreshSourceList(); return; // hopefully that'll just skip to the next tick without any further errors? } TooltipHandler.TipRegion(add, "FMP.DeleteBillTooltip".Translate()); } else { if (Job.Trigger.IsValid) { if (Widgets.TextButton(add, "FM.Manage".Translate())) { Manager.JobStack.Add(Job); Source = SourceOptions.Current; RefreshSourceList(); SourceFilter = ""; } TooltipHandler.TipRegion(add, "FMP.ManageBillTooltip".Translate()); } else { TextAnchor oldAnchor = Text.Anchor; Color oldColor = GUI.color; Text.Anchor = TextAnchor.MiddleCenter; GUI.color = new Color(.6f, .6f, .6f); Widgets.DrawBox(add); GUI.Label(add, "FMP.NoThreshold".Translate()); Text.Anchor = oldAnchor; GUI.color = oldColor; TooltipHandler.TipRegion(add, "FMP.NoThresholdTooltip".Translate()); } } GUI.EndGroup(); GUI.BeginGroup(canvas); Text.Anchor = TextAnchor.MiddleCenter; Text.Font = GameFont.Medium; Rect recta = new Rect(0f, 0f, canvas.width, 50f); Widgets.Label(recta, Job.Bill.LabelCap); Text.Anchor = TextAnchor.UpperLeft; Text.Font = GameFont.Small; Rect rect2 = new Rect(6f, 50f, canvas.width * .3f, canvas.height - 50f); Listing_Standard listingStandard = new Listing_Standard(rect2); if (Job.Bill.suspended) { if (listingStandard.DoTextButton("Suspended".Translate())) { Job.Bill.suspended = false; } } else if (listingStandard.DoTextButton("NotSuspended".Translate())) { Job.Bill.suspended = true; } string billStoreModeLabel = ("BillStoreMode_" + Job.Bill.storeMode).Translate(); if (listingStandard.DoTextButton(billStoreModeLabel)) { List<FloatMenuOption> list = (from BillStoreMode mode in Enum.GetValues(typeof (BillStoreMode)) select new FloatMenuOption(("BillStoreMode_" + mode).Translate(), delegate { Job.Bill.storeMode = mode; })).ToList(); Find.WindowStack.Add(new FloatMenu(list)); } // other stuff listingStandard.DoGap(); listingStandard.DoLabel("IngredientSearchRadius".Translate() + ": " + Job.Bill.ingredientSearchRadius.ToString("#####0")); Job.Bill.ingredientSearchRadius = Mathf.RoundToInt(listingStandard.DoSlider(Job.Bill.ingredientSearchRadius, 0f, 250f)); if (Job.Bill.recipe.workSkill != null) { listingStandard.DoLabel("MinimumSkillLevel".Translate(Job.Bill.recipe.workSkill.label.ToLower()) + ": " + Job.Bill.minSkillLevel.ToString("#####0")); Job.Bill.minSkillLevel = Mathf.RoundToInt(listingStandard.DoSlider(Job.Bill.minSkillLevel, 0f, 20f)); } // draw threshold config Job.Trigger.DrawThresholdConfig(ref listingStandard); Job.BillGivers.DrawBillGiverConfig(ref listingStandard); listingStandard.End(); // ingredient picker Rect rect3 = new Rect(rect2.xMax + 6f, 50f, canvas.width * .4f, canvas.height - 50f); ThingFilterUI.DoThingFilterConfigWindow(rect3, ref BillScrollPosition, Job.Bill.ingredientFilter, Job.Bill.recipe.fixedIngredientFilter, 4); // description Rect rect4 = new Rect(rect3.xMax + 6f, rect3.y + 30f, canvas.width - rect3.xMax - 12f, canvas.height - 50f); StringBuilder stringBuilder = new StringBuilder(); // add mainproduct line stringBuilder.AppendLine("FMP.MainProduct".Translate(Job.MainProduct.Label, Job.MainProduct.Count)); stringBuilder.AppendLine(); if (Job.Bill.recipe.description != null) { stringBuilder.AppendLine(Job.Bill.recipe.description); stringBuilder.AppendLine(); } stringBuilder.AppendLine("WorkAmount".Translate() + ": " + Job.Bill.recipe.WorkAmountTotal(null).ToStringWorkAmount()); stringBuilder.AppendLine(); foreach (IngredientCount ingredientCount in Job.Bill.recipe.ingredients) { if (!ingredientCount.filter.Summary.NullOrEmpty()) { stringBuilder.AppendLine(Job.Bill.recipe.IngredientValueGetter.BillRequirementsDescription(ingredientCount)); } } stringBuilder.AppendLine(); string text4 = Job.Bill.recipe.IngredientValueGetter.ExtraDescriptionLine(); if (text4 != null) { stringBuilder.AppendLine(text4); stringBuilder.AppendLine(); } stringBuilder.AppendLine("MinimumSkills".Translate()); stringBuilder.AppendLine(Job.Bill.recipe.MinSkillString); Text.Font = GameFont.Small; string text5 = stringBuilder.ToString(); if (Text.CalcHeight(text5, rect4.width) > rect4.height) { Text.Font = GameFont.Tiny; } Widgets.Label(rect4, text5); Text.Font = GameFont.Small; if (Job.Bill.recipe.products.Count == 1) { Widgets.InfoCardButton(rect4.x, rect3.y, Job.Bill.recipe.products[0].thingDef); } } GUI.EndGroup(); }
public static void DoSettingsWindowContents(Rect rect) { Listing_Standard listingStandard = new Listing_Standard(); listingStandard.Begin(rect); listingStandard.Gap(10f); listingStandard.CheckboxLabeled("HMI_showTextileInfo".Translate(), ref showTextileInfo, "HMI_showTextileInfo_ToolTip".Translate()); listingStandard.Gap(10f); listingStandard.CheckboxLabeled("HMI_showApparelArmorStats".Translate(), ref showApparelArmorStats, "HMI_showApparelArmorStats_ToolTip".Translate()); listingStandard.Gap(10f); listingStandard.CheckboxLabeled("HMI_showWorkTableSpeedFactor".Translate(), ref showWorkTableSpeedFactor, "HMI_showWorkTableSpeedFactor_ToolTip".Translate()); listingStandard.Gap(10f); listingStandard.CheckboxLabeled("HMI_showBedStats".Translate(), ref showBedStats, "HMI_showBedStats_ToolTip".Translate()); listingStandard.Gap(10f); listingStandard.CheckboxLabeled("HMI_showAmmoStats".Translate(), ref showAmmoStats, "HMI_showAmmoStats_ToolTip".Translate()); listingStandard.Gap(10f); listingStandard.CheckboxLabeled("HMI_showLoadedAmmoStats".Translate(), ref showLoadedAmmoStats, "HMI_showLoadedAmmoStats_ToolTip".Translate()); listingStandard.Gap(10f); listingStandard.CheckboxLabeled("HMI_showColonistSuppression".Translate(), ref showColonistSuppression, "HMI_showColonistSuppression_ToolTip".Translate()); listingStandard.Gap(10f); listingStandard.CheckboxLabeled("HMI_showColonistSuppressionNeeds".Translate(), ref showColonistSuppressionNeeds, "HMI_showColonistSuppressionNeeds_ToolTip".Translate()); listingStandard.Gap(10f); listingStandard.CheckboxLabeled("HMI_tinyNeedsSupperssionBar".Translate(), ref tinyNeedsSupperssionBar, "HMI_tinyNeedsSupperssionBar_ToolTip".Translate()); listingStandard.Gap(10f); listingStandard.CheckboxLabeled("HMI_showEnemySuppression".Translate(), ref showEnemySuppression, "HMI_showEnemySuppression_ToolTip".Translate()); listingStandard.Gap(10f); listingStandard.CheckboxLabeled("HMI_showMovingSpeed".Translate(), ref showMovingSpeed, "HMI_showMovingSpeed_ToolTip".Translate()); listingStandard.Gap(10f); Rect reset = listingStandard.GetRect(Text.LineHeight); reset.width /= 4f; bool resetButton = Widgets.ButtonText(reset, "HMI_ResetButton".Translate()); if (resetButton) { MoreInfo_Settings.showTextileInfo = true; MoreInfo_Settings.showApparelArmorStats = true; MoreInfo_Settings.showWorkTableSpeedFactor = true; MoreInfo_Settings.showBedStats = true; MoreInfo_Settings.showAmmoStats = true; MoreInfo_Settings.showLoadedAmmoStats = true; MoreInfo_Settings.showColonistSuppression = true; MoreInfo_Settings.showColonistSuppressionNeeds = true; MoreInfo_Settings.tinyNeedsSupperssionBar = false; MoreInfo_Settings.showEnemySuppression = false; MoreInfo_Settings.showMovingSpeed = true; } listingStandard.Gap(10f); listingStandard.End(); }
protected void fillPageArrangement(Listing_Standard listing) { DoHeading(listing, "PSI.Settings.Arrangement.Header"); if (listing.DoTextButton(Translator.Translate("PSI.Settings.LoadPresetButton"))) { string[] presetList = { }; String path2 = GenFilePaths.CoreModsFolderPath + "/Pawn State Icons/Presets/Position/"; if (Directory.Exists(path2)) presetList = Directory.GetFiles(path2, "*.cfg"); List<FloatMenuOption> options = new List<FloatMenuOption>(); foreach (string setname in presetList) { options.Add(new FloatMenuOption(Path.GetFileNameWithoutExtension(setname), () => { try { ModSettings settings = XmlLoader.ItemFromXmlFile<ModSettings>(setname, true); PSI.settings.iconDistanceX = settings.iconDistanceX; PSI.settings.iconDistanceY = settings.iconDistanceY; PSI.settings.iconOffsetX = settings.iconOffsetX; PSI.settings.iconOffsetY = settings.iconOffsetY; PSI.settings.iconsHorizontal = settings.iconsHorizontal; PSI.settings.iconsScreenScale = settings.iconsScreenScale; PSI.settings.iconsInColumn = settings.iconsInColumn; PSI.settings.iconSize = settings.iconSize; } catch (IOException) { Log.Error(Translator.Translate("PSI.Settings.LoadPreset.UnableToLoad") + setname); } })); } Find.LayerStack.Add((Layer)new Layer_FloatMenu(options, false)); } int labelNum = (int)(PSI.settings.iconSize * 4.5f); if (labelNum > 8) labelNum = 8; else if (labelNum < 0) labelNum = 0; listing.DoLabel(Translator.Translate("PSI.Settings.Arrangement.IconSize") + Translator.Translate("PSI.Settings.SizeLabel."+labelNum)); PSI.settings.iconSize = listing.DoSlider(PSI.settings.iconSize, 0.5f, 2.0f); listing.DoLabel(Translator.Translate("PSI.Settings.Arrangement.IconPosition") + (int)(PSI.settings.iconDistanceX * 100) + " , " + (int)(PSI.settings.iconDistanceY * 100)); PSI.settings.iconDistanceX = listing.DoSlider(PSI.settings.iconDistanceX, -2.0f, 2.0f); PSI.settings.iconDistanceY = listing.DoSlider(PSI.settings.iconDistanceY, -2.0f, 2.0f); listing.DoLabel(Translator.Translate("PSI.Settings.Arrangement.IconOffset") + (int)(PSI.settings.iconOffsetX * 100) + " , " + (int)(PSI.settings.iconOffsetY * 100)); PSI.settings.iconOffsetX = listing.DoSlider(PSI.settings.iconOffsetX, -2.0f, 2.0f); PSI.settings.iconOffsetY = listing.DoSlider(PSI.settings.iconOffsetY, -2.0f, 2.0f); listing.DoLabelCheckbox(Translator.Translate("PSI.Settings.Arrangement.Horizontal"), ref PSI.settings.iconsHorizontal); listing.DoLabelCheckbox(Translator.Translate("PSI.Settings.Arrangement.ScreenScale"), ref PSI.settings.iconsScreenScale); listing.DoLabel(Translator.Translate("PSI.Settings.Arrangement.IconsPerColumn") + PSI.settings.iconsInColumn); PSI.settings.iconsInColumn = (int)listing.DoSlider(PSI.settings.iconsInColumn, 1.0f, 9.0f); if (listing.DoTextButton(Translator.Translate("PSI.Settings.ReturnButton"))) page = "main"; }
public static void DoSettingsWindowContents(Rect rect) { Rect scroll = new Rect(5f, 45f, 430, rect.height); Rect view = new Rect(0, 45, 400, 800); Widgets.BeginScrollView(scroll, ref scrollPosition, view, true); Listing_Standard ls = new Listing_Standard(); ls.Begin(view); ls.TextFieldNumericLabeled <float>( "ImpassableMapMaker.WorldMapMovementDifficulty".Translate(), ref MovementDifficulty, ref movementDifficultyBuffer, 1f, 100f); if (ls.ButtonText("ImpassableMapMaker.Default".Translate())) { MovementDifficulty = DEFAULT_MOVEMENT_DIFFICULTY; movementDifficultyBuffer = DEFAULT_MOVEMENT_DIFFICULTY.ToString(); } ls.GapLine(GAP_SIZE); ls.Label("ImpassableMapMaker.MountainShape".Translate()); if (ls.RadioButton("ImpassableMapMaker.ShapeSquare".Translate(), shape == ImpassableShape.Square)) { shape = ImpassableShape.Square; } if (ls.RadioButton("ImpassableMapMaker.ShapeRound".Translate(), shape == ImpassableShape.Round)) { shape = ImpassableShape.Round; } ls.Gap(GAP_SIZE); ls.CheckboxLabeled("ImpassableMapMaker.ScatteredRocks".Translate(), ref ScatteredRocks); ls.GapLine(GAP_SIZE); ls.CheckboxLabeled("ImpassableMapMaker.HasMiddleArea".Translate(), ref HasMiddleArea); ls.Gap(6); if (HasMiddleArea) { ls.Label("ImpassableMapMaker.MiddleAreaShape".Translate()); ls.Gap(2); if (ls.RadioButton("ImpassableMapMaker.ShapeSquare".Translate(), OpenAreaShape == ImpassableShape.Square)) { OpenAreaShape = ImpassableShape.Square; } if (ls.RadioButton("ImpassableMapMaker.ShapeRound".Translate(), OpenAreaShape == ImpassableShape.Round)) { OpenAreaShape = ImpassableShape.Round; } ls.Gap(2); ls.Label("ImpassableMapMaker.OpenAreaSize".Translate()); if (OpenAreaShape == ImpassableShape.Square) { ls.Label("ImpassableMapMaker.Width".Translate() + ": " + OpenAreaSizeZ); OpenAreaSizeZ = (int)ls.Slider(OpenAreaSizeZ, 40, 75); ls.Label("ImpassableMapMaker.Height".Translate() + ": " + OpenAreaSizeX); OpenAreaSizeX = (int)ls.Slider(OpenAreaSizeX, 40, 75); } else { ls.Label("ImpassableMapMaker.Radius".Translate() + ": " + OpenAreaSizeZ); OpenAreaSizeX = (int)ls.Slider(OpenAreaSizeX, 40, 75); OpenAreaSizeZ = OpenAreaSizeX; } if (ls.ButtonText("ImpassableMapMaker.Default".Translate())) { OpenAreaSizeX = DEFAULT_OPEN_AREA_SIZE; OpenAreaSizeZ = DEFAULT_OPEN_AREA_SIZE; } ls.Gap(GAP_SIZE); ls.Label("ImpassableMapMaker.OpenAreaMaxOffsetFromMiddle".Translate() + ": " + percentOffset.ToString("N1") + "%"); percentOffset = ls.Slider(percentOffset, 0, 25); if (ls.ButtonText("ImpassableMapMaker.Default".Translate())) { percentOffset = DEFAULT_PERCENT_OFFSET; } ls.Gap(GAP_SIZE); ls.Label("ImpassableMapMaker.MiddleOpeningWallSmoothnes".Translate()); ls.Label("<< " + "ImpassableMapMaker.Smooth".Translate() + " -- " + "ImpassableMapMaker.Rough".Translate() + " >>"); MiddleWallSmoothness = (int)ls.Slider(MiddleWallSmoothness, 0, 20); if (ls.ButtonText("ImpassableMapMaker.Default".Translate())) { MiddleWallSmoothness = 10; } ls.GapLine(GAP_SIZE); } if (shape == ImpassableShape.Square) { ls.Label("ImpassableMapMaker.EdgeBuffer".Translate() + ": " + PeremeterBuffer.ToString()); ls.Label("<< " + "ImpassableMapMaker.Smaller".Translate() + " -- " + "ImpassableMapMaker.Larger".Translate() + " >>"); PeremeterBuffer = (int)ls.Slider(PeremeterBuffer, 3, 30); if (ls.ButtonText("ImpassableMapMaker.Default".Translate())) { PeremeterBuffer = DEFAULT_PEREMETER_BUFFER; } ls.Label("ImpassableMapMaker.EdgeBufferWarning".Translate()); ls.GapLine(GAP_SIZE); } ls.CheckboxLabeled("ImpassableMapMaker.IncludeQuarySpot".Translate(), ref IncludeQuarySpot); if (IncludeQuarySpot) { ls.Label("<< " + "ImpassableMapMaker.Smaller".Translate() + " -- " + "ImpassableMapMaker.Larger".Translate() + " >>"); QuarySize = (int)ls.Slider(QuarySize, 3, 20); StringBuilder sb = new StringBuilder("("); sb.Append(QuarySize.ToString()); sb.Append(", "); sb.Append(QuarySize.ToString()); sb.Append(")"); ls.Label(sb.ToString()); if (ls.ButtonText("ImpassableMapMaker.Default".Translate())) { QuarySize = DEFAULT_QUARY_SIZE; } } ls.End(); Widgets.EndScrollView(); }
protected void fillPageLimits(Listing_Standard listing) { DoHeading(listing, "PSI.Settings.Sensitivity.Header"); if (listing.DoTextButton(Translator.Translate("PSI.Settings.LoadPresetButton"))) { string[] presetList = { }; String path2 = GenFilePaths.CoreModsFolderPath + "/Pawn State Icons/Presets/Sensitivity/"; if (Directory.Exists(path2)) presetList = Directory.GetFiles(path2, "*.cfg"); List<FloatMenuOption> options = new List<FloatMenuOption>(); foreach (string setname in presetList) { options.Add(new FloatMenuOption(Path.GetFileNameWithoutExtension(setname), () => { try { ModSettings settings = XmlLoader.ItemFromXmlFile<ModSettings>(setname, true); PSI.settings.limit_bleedMult = settings.limit_bleedMult; PSI.settings.limit_diseaseLess = settings.limit_diseaseLess; PSI.settings.limit_EfficiencyLess = settings.limit_EfficiencyLess; PSI.settings.limit_FoodLess = settings.limit_FoodLess; PSI.settings.limit_MoodLess = settings.limit_MoodLess; PSI.settings.limit_RestLess = settings.limit_RestLess; PSI.settings.limit_apparelHealthLess = settings.limit_apparelHealthLess; PSI.settings.limit_tempComfortOffset = settings.limit_tempComfortOffset; } catch (IOException) { Log.Error(Translator.Translate("PSI.Settings.LoadPreset.UnableToLoad") + setname); } })); } Find.LayerStack.Add((Layer)new Layer_FloatMenu(options, false)); } listing.DoGap(); listing.DoLabel(Translator.Translate("PSI.Settings.Sensitivity.Bleeding") + Translator.Translate("PSI.Settings.Sensitivity.Bleeding." + Math.Round( PSI.settings.limit_bleedMult - 0.25 ))); PSI.settings.limit_bleedMult = listing.DoSlider(PSI.settings.limit_bleedMult, 0.5f, 5.0f); listing.DoLabel(Translator.Translate("PSI.Settings.Sensitivity.Injured") + ((int)(PSI.settings.limit_EfficiencyLess * 100)) + "%"); PSI.settings.limit_EfficiencyLess = listing.DoSlider(PSI.settings.limit_EfficiencyLess, 0.01f, 0.99f); listing.DoLabel(Translator.Translate("PSI.Settings.Sensitivity.Food") + ((int)(PSI.settings.limit_FoodLess * 100)) + "%"); PSI.settings.limit_FoodLess = listing.DoSlider(PSI.settings.limit_FoodLess, 0.01f, 0.99f); listing.DoLabel(Translator.Translate("PSI.Settings.Sensitivity.Mood") + ((int)(PSI.settings.limit_MoodLess * 100)) + "%"); PSI.settings.limit_MoodLess = listing.DoSlider(PSI.settings.limit_MoodLess, 0.01f, 0.99f); listing.DoLabel(Translator.Translate("PSI.Settings.Sensitivity.Rest") + ((int)(PSI.settings.limit_RestLess * 100)) + "%"); PSI.settings.limit_RestLess = listing.DoSlider(PSI.settings.limit_RestLess, 0.01f, 0.99f); listing.DoLabel(Translator.Translate("PSI.Settings.Sensitivity.ApparelHealth") + ((int)(PSI.settings.limit_apparelHealthLess * 100)) + "%"); PSI.settings.limit_apparelHealthLess = listing.DoSlider(PSI.settings.limit_apparelHealthLess, 0.01f, 0.99f); listing.DoLabel(Translator.Translate("PSI.Settings.Sensitivity.Temperature") + ((int)(PSI.settings.limit_tempComfortOffset)) + "C"); PSI.settings.limit_tempComfortOffset = listing.DoSlider(PSI.settings.limit_tempComfortOffset, -10f, 10f); if (listing.DoTextButton(Translator.Translate("PSI.Settings.ReturnButton"))) page = "main"; }
public override void DoWindowContents(Rect inRect) { const float mainListingSpacing = 6f; var btnSize = new Vector2(140f, 40f); var buttonYStart = inRect.height - btnSize.y; var ev = Event.current; if (Widgets.ButtonText(new Rect(0, buttonYStart, btnSize.x, btnSize.y), "OCity_Dialog_CreateWorld_BtnOk".Translate()) || ev.isKey && ev.type == EventType.keyDown && ev.keyCode == KeyCode.Return) { int ii; if (string.IsNullOrEmpty(InputSeed) || !int.TryParse(InputDifficulty, out ii) || ii < 0 || ii > 2 || !int.TryParse(InputPlanetCoverage, out ii) || ii < 5 || ii > 100 ) { Find.WindowStack.Add(new Dialog_Message("OCity_Dialog_CreateWorld_Err".Translate(), "OCity_Dialog_CreateWorld_Err2".Translate(), null, null)); } else { ResultOK = true; Close(); } } if (Widgets.ButtonText(new Rect(inRect.width - btnSize.x, buttonYStart, btnSize.x, btnSize.y), "OCity_Dialog_CreateWorld_BtnCancel".Translate())) { Close(); } var mainListing = new Listing_Standard(); mainListing.verticalSpacing = mainListingSpacing; mainListing.Begin(inRect); Text.Font = GameFont.Medium; mainListing.Label(TitleText); Text.Font = GameFont.Small; mainListing.GapLine(); mainListing.Gap(); var textEditSize = new Vector2(150f, 25f); var rect = new Rect(0, 70f, inRect.width, textEditSize.y); Widgets.Label(rect, "OCity_Dialog_CreateWorld_Seed".Translate()); rect.y += textEditSize.y; GUI.SetNextControlName("StartTextField"); InputSeed = GUI.TextField(rect, InputSeed, 100); rect.y += textEditSize.y; /* * Widgets.Label(rect, "Общее количество осадков"); * rect.y += textEditSize.y; * Input = GUI.TextField(rect, Input, 100); * rect.y += textEditSize.y; */ /* * Widgets.Label(rect, "Общая темпиратура"); * rect.y += textEditSize.y; * Input = GUI.TextField(rect, Input, 100); * rect.y += textEditSize.y; */ Widgets.Label(rect, "OCity_Dialog_CreateWorld_Difficulty".Translate()); rect.y += textEditSize.y; InputDifficulty = GUI.TextField(rect, InputDifficulty, 1); rect.y += textEditSize.y; //это уже не надо, каждый выбирает при старте //Widgets.Label(rect, "OCity_Dialog_CreateWorld_MapSize".Translate()); //rect.y += textEditSize.y; //InputMapSize = GUI.TextField(rect, InputMapSize, 3); //rect.y += textEditSize.y; Widgets.Label(rect, "OCity_Dialog_CreateWorld_PercentWorld".Translate()); rect.y += textEditSize.y; InputPlanetCoverage = GUI.TextField(rect, InputPlanetCoverage, 3); rect.y += textEditSize.y; if (NeedFockus) { NeedFockus = false; GUI.FocusControl("StartTextField"); } mainListing.End(); }
public abstract void DrawThresholdConfig(ref Listing_Standard listing);
private void DoConfigControls(Rect rect) { Listing_Standard listing_Standard = new Listing_Standard(); listing_Standard.ColumnWidth = 200f; listing_Standard.Begin(rect); if (listing_Standard.ButtonText("Load".Translate(), null)) { Find.WindowStack.Add(new Dialog_ScenarioList_Load(delegate(Scenario loadedScen) { this.curScen = loadedScen; this.seedIsValid = false; })); } if (listing_Standard.ButtonText("Save".Translate(), null)) { if (Page_ScenarioEditor.CheckAllPartsCompatible(this.curScen)) { Find.WindowStack.Add(new Dialog_ScenarioList_Save(this.curScen)); } } if (listing_Standard.ButtonText("RandomizeSeed".Translate(), null)) { SoundDefOf.Tick_Tiny.PlayOneShotOnCamera(null); this.RandomizeSeedAndScenario(); this.seedIsValid = true; } if (this.seedIsValid) { listing_Standard.Label("Seed".Translate().CapitalizeFirst(), -1f, null); string a = listing_Standard.TextEntry(this.seed, 1); if (a != this.seed) { this.seed = a; this.curScen = ScenarioMaker.GenerateNewRandomScenario(this.seed); } } else { listing_Standard.Gap(Text.LineHeight + Text.LineHeight + 2f); } listing_Standard.CheckboxLabeled("EditMode".Translate().CapitalizeFirst(), ref this.editMode, null); if (this.editMode) { this.seedIsValid = false; if (listing_Standard.ButtonText("AddPart".Translate(), null)) { this.OpenAddScenPartMenu(); } if (SteamManager.Initialized && (this.curScen.Category == ScenarioCategory.CustomLocal || this.curScen.Category == ScenarioCategory.SteamWorkshop)) { if (listing_Standard.ButtonText(Workshop.UploadButtonLabel(this.curScen.GetPublishedFileId()), null)) { if (Page_ScenarioEditor.CheckAllPartsCompatible(this.curScen)) { AcceptanceReport acceptanceReport = this.curScen.TryUploadReport(); if (!acceptanceReport.Accepted) { Messages.Message(acceptanceReport.Reason, MessageTypeDefOf.RejectInput, false); } else { SoundDefOf.Tick_High.PlayOneShotOnCamera(null); Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmSteamWorkshopUpload".Translate(), delegate { SoundDefOf.Tick_High.PlayOneShotOnCamera(null); Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmContentAuthor".Translate(), delegate { SoundDefOf.Tick_High.PlayOneShotOnCamera(null); Workshop.Upload(this.curScen); }, true, null)); }, true, null)); } } } } } listing_Standard.End(); }
public override float DoWindowContents( Rect rect ) { #region Save State var originalFont = Text.Font; #endregion var listing = new Listing_Standard( rect ); { listing.ColumnWidth = rect.width; #region MCM description DoLabel( ref listing, Data.Strings.MCMDescription ); #endregion #region Buy as colonists DoCheckbox( ref listing, ref Data.BoughtSlavesAsColonists, Data.Strings.MCMBoughtAsColonists ); #endregion #region Locked doors DoLabel( ref listing, Data.Strings.MCMLockedDoors ); #region Drafted can use locked doors DoCheckbox( ref listing, ref Data.LockedDoorsAllowDrafted, Data.Strings.MCMLockedDoorsAllowDrafted ); #endregion #region Wardens can use locked doors DoCheckbox( ref listing, ref Data.LockedDoorsAllowWardens, Data.Strings.MCMLockedDoorsAllowWardens ); #endregion #region Doctors can use locked doors DoCheckbox( ref listing, ref Data.LockedDoorsAllowDoctors, Data.Strings.MCMLockedDoorsAllowDoctors ); #endregion #endregion } listing.End(); #region Restore State Text.Font = originalFont; #endregion return listing.CurHeight; }
public override void DoWindowContents(Rect inRect) { AddRenameButton(inRect); AddRenamedLabel(); #region Origianl Text.Font = GameFont.Small; var rect2 = new Rect(0f, 50f, 180f, inRect.height - 50f); var listing_Standard = new Listing_Standard(rect2); if (bill.suspended) { if (listing_Standard.ButtonText("Suspended".Translate(), null)) { bill.suspended = false; } } else if (listing_Standard.ButtonText("NotSuspended".Translate(), null)) { bill.suspended = true; } #endregion AddAssignWorkerButton(listing_Standard); if (listing_Standard.ButtonText(bill.repeatMode.GetLabel(), null)) { BillRepeatModeUtility.MakeConfigFloatMenu(bill); } var label = ("BillStoreMode_" + bill.storeMode).Translate(); if (listing_Standard.ButtonText(label, null)) { var list = new List <FloatMenuOption>(); var enumerator = Enum.GetValues(typeof(BillStoreMode)).GetEnumerator(); { while (enumerator.MoveNext()) { var billStoreMode = (BillStoreMode)(byte)enumerator.Current; var smLocal = billStoreMode; list.Add(new FloatMenuOption(("BillStoreMode_" + billStoreMode).Translate(), delegate { bill.storeMode = smLocal; }, MenuOptionPriority.Default, null, null, 0f, null)); } } Find.WindowStack.Add(new FloatMenu(list)); } listing_Standard.Gap(12f); if (bill.repeatMode == BillRepeatMode.RepeatCount) { listing_Standard.Label("RepeatCount".Translate(bill.RepeatInfoText)); listing_Standard.IntSetter(ref bill.repeatCount, 1, "1", 42f); listing_Standard.IntAdjuster(ref bill.repeatCount, 1, 25, 1); // changed listing_Standard.IntAdjuster(ref bill.repeatCount, 10, 250, 1); } else if (bill.repeatMode == BillRepeatMode.TargetCount) { var text = "CurrentlyHave".Translate() + ": "; text += bill.recipe.WorkerCounter.CountProducts(bill); text += " / "; text += bill.targetCount >= 999999 ? "Infinite".Translate().ToLower() : bill.targetCount.ToString(); var text2 = bill.recipe.WorkerCounter.ProductsDescription(bill); if (!text2.NullOrEmpty()) { var text3 = text; text = string.Concat(text3, "\n", "CountingProducts".Translate(), ": ", text2); } listing_Standard.Label(text); // changed // todo : extract method listing_Standard.IntSetter(ref bill.targetCount, 1, "1", 42f); listing_Standard.IntAdjuster(ref bill.targetCount, 1, 25, 1); listing_Standard.IntAdjuster(ref bill.targetCount, 10, 250, 1); } listing_Standard.Gap(12f); listing_Standard.Label("IngredientSearchRadius".Translate() + ": " + bill.ingredientSearchRadius.ToString("F0")); bill.ingredientSearchRadius = listing_Standard.Slider(bill.ingredientSearchRadius, 3f, 100f, null); // changed if (bill.ingredientSearchRadius >= 100f) { bill.ingredientSearchRadius = 999f; } //listing_Standard.Gap(-4f); // °¸ ��»ף if (bill.recipe.workSkill != null) { listing_Standard.Label("AllowedSkillRange".Translate(bill.recipe.workSkill.label.ToLower())); listing_Standard.IntRange(ref bill.allowedSkillRange, 0, 20); } AddMinBarButton(listing_Standard); #region original listing_Standard.End(); var rect3 = new Rect(rect2.xMax + 6f, 50f, 280f, -1f); rect3.yMax = inRect.height - CloseButSize.y - 6f; ThingFilterUI.DoThingFilterConfigWindow(rect3, ref scrollPosition, bill.ingredientFilter, bill.recipe.fixedIngredientFilter, 4); var rect4 = new Rect(rect3.xMax + 6f, rect3.y + 30f, 0f, 0f); rect4.xMax = inRect.xMax; rect4.yMax = inRect.height - CloseButSize.y - 6f; var stringBuilder = new StringBuilder(); if (bill.recipe.description != null) { stringBuilder.AppendLine(bill.recipe.description); stringBuilder.AppendLine(); } stringBuilder.AppendLine("WorkAmount".Translate() + ": " + bill.recipe.WorkAmountTotal(null).ToStringWorkAmount()); stringBuilder.AppendLine(); for (var i = 0; i < bill.recipe.ingredients.Count; i++) { var ingredientCount = bill.recipe.ingredients[i]; if (!ingredientCount.filter.Summary.NullOrEmpty()) { stringBuilder.AppendLine(bill.recipe.IngredientValueGetter.BillRequirementsDescription(ingredientCount)); } } stringBuilder.AppendLine(); var text4 = bill.recipe.IngredientValueGetter.ExtraDescriptionLine(bill.recipe); if (text4 != null) { stringBuilder.AppendLine(text4); stringBuilder.AppendLine(); } stringBuilder.AppendLine("MinimumSkills".Translate()); stringBuilder.AppendLine(bill.recipe.MinSkillString); Text.Font = GameFont.Small; var text5 = stringBuilder.ToString(); if (Text.CalcHeight(text5, rect4.width) > rect4.height) { Text.Font = GameFont.Tiny; } Widgets.Label(rect4, text5); Text.Font = GameFont.Small; if (bill.recipe.products.Count == 1) { Widgets.InfoCardButton(rect4.x, rect3.y, bill.recipe.products[0].thingDef); } #endregion }
private void DisplayDetailedListPage(Rect rect) { GUI.BeginGroup(rect); // TODO: figure out how to do scroll view below titles var x = 0; var sourceButton = new Rect(0f, 6f, 200f, 35f); if (Widgets.ButtonText(sourceButton, Source.ToString().Translate())) { List <FloatMenuOption> options = new List <FloatMenuOption>(); if (Source != SourceOptions.Plants) { options.Add(new FloatMenuOption("Plants", delegate { Source = SourceOptions.Plants; IsDirty = true; })); } if (Source != SourceOptions.Animals) { options.Add(new FloatMenuOption("Animals", delegate { Source = SourceOptions.Animals; IsDirty = true; })); } Find.WindowStack.Add(new FloatMenu(options)); } var offset = true; List <PawnKindDef> pawnTypeList = DefDatabase <PawnKindDef> .AllDefs.Where(a => a.RaceProps.Animal).ToList(); var nameRect = new Rect(x, sourceButton.height + 50f, 175f, 30f); Text.Anchor = TextAnchor.MiddleCenter; Widgets.Label(nameRect, "Name"); TooltipHandler.TipRegion(nameRect, "ClickToSortByName"); Widgets.DrawHighlightIfMouseover(nameRect); Listing_Standard listing = new Listing_Standard(new Rect(nameRect.x, nameRect.yMax, nameRect.width, consList.Count() * 30)); foreach (var c in consList.Where(cc => cc.numTotal > 0)) { listing.Label(c.label.ToString()); } listing.Label("Total"); listing.End(); x += 175; List <String> headerNames = new List <String>() { "Total", "Adult", "Teen", "Baby", "Daily Consumption[nut]", "Daily Meals/Hay/Kibbles" }; var colWidth = (rect.width - x) / headerNames.Count; // loop from left column to rightmost column for (var i = 0; i < headerNames.Count; i++) { // draw title in each column var labelRect = new Rect(x + colWidth * i - colWidth / 2, sourceButton.height + 10 + (offset ? 10f : 40f), colWidth * 2, 30f); Widgets.DrawLine(new Vector2(x + colWidth * (i + 1) - colWidth / 2, sourceButton.height + 40f + (offset ? 5f : 35f)), new Vector2(x + colWidth * (i + 1) - colWidth / 2, sourceButton.height + 80f), Color.gray, 1); Widgets.Label(labelRect, headerNames[i]); // setting drawing rect for each column //listing = new Listing_Standard(new Rect(labelRect.x, nameRect.yMax, labelRect.width, consList.Count() * (Text.LineHeight + listing.verticalSpacing))); switch (i) { case 0: ///listing.End(); listing = new Listing_Standard(new Rect( labelRect.x + labelRect.width / 2f, nameRect.yMax, consList.Max(ccc => GUI.skin.label.CalcSize(new GUIContent(ccc.numTotal.ToString())).x) + 30, // 24 + 6 consList.Count() * (Text.LineHeight + listing.verticalSpacing))); break; case 1: //listing.Label(c.numAdult.ToString()); listing = new Listing_Standard(new Rect( labelRect.x + labelRect.width / 2f, nameRect.yMax, consList.Max(ccc => GUI.skin.label.CalcSize(new GUIContent(ccc.numAdult.ToString())).x) + 30, // 24 + 6 consList.Count() * (Text.LineHeight + listing.verticalSpacing))); break; case 2: //listing.Label(c.numTeen.ToString()); listing = new Listing_Standard(new Rect( labelRect.x + labelRect.width / 2f, nameRect.yMax, consList.Max(ccc => GUI.skin.label.CalcSize(new GUIContent(ccc.numTeen.ToString())).x) + 30, // 24 + 6 consList.Count() * (Text.LineHeight + listing.verticalSpacing))); break; case 3: //listing.Label(c.numInfant.ToString()); listing = new Listing_Standard(new Rect( labelRect.x + labelRect.width / 2f, nameRect.yMax, consList.Max(ccc => GUI.skin.label.CalcSize(new GUIContent(ccc.numInfant.ToString())).x) + 30, // 24 + 6 consList.Count() * (Text.LineHeight + listing.verticalSpacing))); break; case 4: //listing.Label(String.Format("{0:0.00}", c.totalNutr)); listing = new Listing_Standard(new Rect( labelRect.x + labelRect.width / 2f, nameRect.yMax, consList.Max(ccc => GUI.skin.label.CalcSize(new GUIContent(String.Format("{0:0.00}", ccc.numAdult))).x) + 30, // 24 + 6 consList.Count() * (Text.LineHeight + listing.verticalSpacing))); break; case 5: //listing.Label(String.Format("{0:0.0}", c.numFood)); listing = new Listing_Standard(new Rect( labelRect.x + labelRect.width / 2f, nameRect.yMax, consList.Max(ccc => GUI.skin.label.CalcSize(new GUIContent(String.Format("{0:0.0}", ccc.numFood))).x) + 30, // 24 + 6 consList.Count() * (Text.LineHeight + listing.verticalSpacing))); break; default: break; } // draw stats in each column below the title bool buf = false; foreach (var c in consList.Where(cc => cc.numTotal > 0)) { GUI.color = Color.white; switch (i) { case 0: listing.CheckboxLabeled(c.numTotal.ToString(), ref buf); break; case 1: listing.CheckboxLabeled(c.numAdult.ToString(), ref buf); break; case 2: listing.CheckboxLabeled(c.numTeen.ToString(), ref buf); break; case 3: listing.CheckboxLabeled(c.numInfant.ToString(), ref buf); break; case 4: listing.CheckboxLabeled(String.Format("{0:0.00}", c.totalNutr), ref buf); break; case 5: listing.CheckboxLabeled(String.Format("{0:0.0}", c.numFood), ref buf); break; } } // last row of total values switch (i) { case 0: listing.Label(consList.Sum(c => c.numTotal).ToString()); break; case 1: listing.Label(consList.Sum(c => c.numAdult).ToString()); break; case 2: listing.Label(consList.Sum(c => c.numTeen).ToString()); break; case 3: listing.Label(consList.Sum(c => c.numInfant).ToString()); break; case 4: listing.Label(String.Format("{0:0.00}", consList.Sum(c => c.totalNutr))); break; case 5: listing.Label(String.Format("{0:0.0}", consList.Sum(c => c.numFood))); break; } listing.End(); /* * if (Widgets.ButtonInvisible(defLabel)) * { * if (OrderBy == Order.Efficiency && OrderByCapDef == CapDefs[i]) * { * Asc = !Asc; * } * else * { * OrderBy = Order.Efficiency; * OrderByCapDef = CapDefs[i]; * Asc = true; * } * IsDirty = true; * } * //*/ TooltipHandler.TipRegion(labelRect, "ClickToSortBy" + (headerNames[i])); Widgets.DrawHighlightIfMouseover(labelRect); offset = !offset; } GUI.color = Color.gray; for (int k = 0; k < consList.Where(c => c.numTotal > 0).Count() + 1; k++) { Widgets.DrawLineHorizontal(0f, nameRect.yMax + k * (Text.LineHeight + listing.verticalSpacing), rect.width); } GUI.EndGroup(); }
public static void DoWindowContents(Rect inRect) { sexneed_decay_rate = Mathf.Clamp(sexneed_decay_rate, 0.0f, 10000.0f); cum_on_body_amount_adjust = Mathf.Clamp(cum_on_body_amount_adjust, 0.1f, 10f); nonFutaWomenRaping_MaxVulnerability = Mathf.Clamp(nonFutaWomenRaping_MaxVulnerability, 0.0f, 3.0f); rapee_MinVulnerability_human = Mathf.Clamp(rapee_MinVulnerability_human, 0.0f, 3.0f); //30f for top page description and bottom close button Rect outRect = new Rect(0f, 30f, inRect.width, inRect.height - 30f); //-16 for slider, height_modifier - additional height for options Rect viewRect = new Rect(0f, 0f, inRect.width - 16f, inRect.height + height_modifier); Listing_Standard listingStandard = new Listing_Standard(); listingStandard.maxOneColumn = true; listingStandard.ColumnWidth = viewRect.width / 2.05f; listingStandard.BeginScrollView(outRect, ref scrollPosition, ref viewRect); listingStandard.Begin(viewRect); listingStandard.Gap(4f); listingStandard.CheckboxLabeled("animal_on_animal_enabled".Translate(), ref animal_on_animal_enabled, "animal_on_animal_enabled_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("necrophilia_enabled".Translate(), ref necrophilia_enabled, "necrophilia_enabled_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("bestiality_enabled".Translate(), ref bestiality_enabled, "bestiality_enabled_desc".Translate()); listingStandard.Gap(10f); listingStandard.CheckboxLabeled("rape_enabled".Translate(), ref rape_enabled, "rape_enabled_desc".Translate()); if (rape_enabled) { listingStandard.Gap(3f); listingStandard.CheckboxLabeled(" " + "ColonistCanCP".Translate(), ref colonist_CP_rape, "ColonistCanCP_desc".Translate()); listingStandard.Gap(3f); listingStandard.CheckboxLabeled(" " + "VisitorsCanCP".Translate(), ref visitor_CP_rape, "VisitorsCanCP_desc".Translate()); listingStandard.Gap(3f); if (!bestiality_enabled) { GUI.contentColor = Color.grey; animal_CP_rape = false; } listingStandard.CheckboxLabeled(" " + "AnimalsCanCP".Translate(), ref animal_CP_rape, "AnimalsCanCP_desc".Translate()); if (!bestiality_enabled) { GUI.contentColor = Color.white; } listingStandard.Gap(3f); listingStandard.CheckboxLabeled(" " + "PrisonersBeating".Translate(), ref rape_beating, "PrisonersBeating_desc".Translate()); listingStandard.Gap(3f); listingStandard.CheckboxLabeled(" " + "GentlePrisonersBeating".Translate(), ref gentle_rape_beating, "GentlePrisonersBeating_desc".Translate()); } else { colonist_CP_rape = false; visitor_CP_rape = false; animal_CP_rape = false; rape_beating = false; } listingStandard.Gap(10f); listingStandard.CheckboxLabeled("STD_enabled".Translate(), ref stds_enabled, "STD_enabled_desc".Translate()); listingStandard.Gap(5f); if (stds_enabled) { listingStandard.CheckboxLabeled(" " + "STD_FromFloors".Translate(), ref std_floor, "STD_FromFloors_desc".Translate()); } else { std_floor = false; } listingStandard.Gap(5f); listingStandard.CheckboxLabeled("cum_filth".Translate(), ref cum_filth, "cum_filth_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("cum_on_body".Translate(), ref cum_on_body, "cum_on_body_desc".Translate()); listingStandard.Gap(5f); if (cum_on_body) { listingStandard.Label("cum_on_body_amount_adjust".Translate() + ": " + Math.Round(cum_on_body_amount_adjust * 100f, 0) + "%", -1f, "cum_on_body_amount_adjust_desc".Translate()); cum_on_body_amount_adjust = listingStandard.Slider(cum_on_body_amount_adjust, 0.1f, 10.0f); listingStandard.CheckboxLabeled("cum_overlays".Translate(), ref cum_overlays, "cum_overlays_desc".Translate()); } else { cum_overlays = false; } listingStandard.Gap(5f); listingStandard.CheckboxLabeled("sounds_enabled".Translate(), ref sounds_enabled, "sounds_enabled_desc".Translate()); listingStandard.Gap(10f); listingStandard.CheckboxLabeled("RPG_hero_control_name".Translate(), ref RPG_hero_control, "RPG_hero_control_desc".Translate()); listingStandard.Gap(5f); if (RPG_hero_control) { listingStandard.CheckboxLabeled("RPG_hero_control_HC_name".Translate(), ref RPG_hero_control_HC, "RPG_hero_control_HC_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("RPG_hero_control_Ironman_name".Translate(), ref RPG_hero_control_Ironman, "RPG_hero_control_Ironman_desc".Translate()); listingStandard.Gap(5f); } else { RPG_hero_control_HC = false; RPG_hero_control_Ironman = false; } listingStandard.NewColumn(); listingStandard.Gap(4f); GUI.contentColor = Color.white; if (sexneed_decay_rate < 2.5f) { overdrive = false; listingStandard.Label("sexneed_decay_rate_name".Translate() + ": " + Math.Round(sexneed_decay_rate * 100f, 0) + "%", -1f, "sexneed_decay_rate_desc".Translate()); sexneed_decay_rate = listingStandard.Slider(sexneed_decay_rate, 0.0f, 5.0f); } else if (sexneed_decay_rate <= 5.0f && !overdrive) { GUI.contentColor = Color.yellow; listingStandard.Label("sexneed_decay_rate_name".Translate() + ": " + Math.Round(sexneed_decay_rate * 100f, 0) + "% [Not recommended]", -1f, "sexneed_decay_rate_desc".Translate()); sexneed_decay_rate = listingStandard.Slider(sexneed_decay_rate, 0.0f, 5.0f); if (sexneed_decay_rate == 5.0f) { GUI.contentColor = Color.red; if (listingStandard.ButtonText("OVERDRIVE")) { overdrive = true; } } GUI.contentColor = Color.white; } else { GUI.contentColor = Color.red; listingStandard.Label("sexneed_decay_rate_name".Translate() + ": " + Math.Round(sexneed_decay_rate * 100f, 0) + "% [WARNING: UNSAFE]", -1f, "sexneed_decay_rate_desc".Translate()); GUI.contentColor = Color.white; sexneed_decay_rate = listingStandard.Slider(sexneed_decay_rate, 0.0f, 10000.0f); } listingStandard.Label("SexMinimumAge".Translate() + ": " + sex_minimum_age, -1f, "SexMinimumAge_desc".Translate()); sex_minimum_age = (int)listingStandard.Slider(sex_minimum_age, 0, 100); listingStandard.Label("SexFreeForAllAge".Translate() + ": " + sex_free_for_all_age, -1f, "SexFreeForAllAge_desc".Translate()); sex_free_for_all_age = (int)listingStandard.Slider(sex_free_for_all_age, 0, 100); if (rape_enabled) { listingStandard.Label("NonFutaWomenRaping_MaxVulnerability".Translate() + ": " + (int)(nonFutaWomenRaping_MaxVulnerability * 100), -1f, "NonFutaWomenRaping_MaxVulnerability_desc".Translate()); nonFutaWomenRaping_MaxVulnerability = listingStandard.Slider(nonFutaWomenRaping_MaxVulnerability, 0.0f, 3.0f); listingStandard.Label("Rapee_MinVulnerability_human".Translate() + ": " + (int)(rapee_MinVulnerability_human * 100), -1f, "Rapee_MinVulnerability_human_desc".Translate()); rapee_MinVulnerability_human = listingStandard.Slider(rapee_MinVulnerability_human, 0.0f, 3.0f); } listingStandard.Gap(20f); listingStandard.CheckboxLabeled("NymphTamed".Translate(), ref NymphTamed, "NymphTamed_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("NymphWild".Translate(), ref NymphWild, "NymphWild_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("NymphRaidEasy".Translate(), ref NymphRaidEasy, "NymphRaidEasy_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("NymphRaidHard".Translate(), ref NymphRaidHard, "NymphRaidHard_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("NymphPermanentManhunter".Translate(), ref NymphPermanentManhunter, "NymphPermanentManhunter_desc".Translate()); listingStandard.Gap(5f); // Save compatibility check for 1.9.7 // This can probably be safely removed at a later date, I doubt many players use old saves for long. if (male_nymph_chance > 1.0f || futa_nymph_chance > 1.0f || futa_natives_chance > 1.0f || futa_spacers_chance > 1.0f) { male_nymph_chance = 0.0f; futa_nymph_chance = 0.0f; futa_natives_chance = 0.0f; futa_spacers_chance = 0.0f; } listingStandard.CheckboxLabeled("FemaleFuta".Translate(), ref FemaleFuta, "FemaleFuta_desc".Translate()); listingStandard.CheckboxLabeled("MaleTrap".Translate(), ref MaleTrap, "MaleTrap_desc".Translate()); listingStandard.Label("male_nymph_chance".Translate() + ": " + (int)(male_nymph_chance * 100) + "%", -1f, "male_nymph_chance_desc".Translate()); male_nymph_chance = listingStandard.Slider(male_nymph_chance, 0.0f, 1.0f); if (FemaleFuta || MaleTrap) { listingStandard.Label("futa_nymph_chance".Translate() + ": " + (int)(futa_nymph_chance * 100) + "%", -1f, "futa_nymph_chance_desc".Translate()); futa_nymph_chance = listingStandard.Slider(futa_nymph_chance, 0.0f, 1.0f); } if (FemaleFuta || MaleTrap) { listingStandard.Label("futa_natives_chance".Translate() + ": " + (int)(futa_natives_chance * 100) + "%", -1f, "futa_natives_chance_desc".Translate()); futa_natives_chance = listingStandard.Slider(futa_natives_chance, 0.0f, 1.0f); listingStandard.Label("futa_spacers_chance".Translate() + ": " + (int)(futa_spacers_chance * 100) + "%", -1f, "futa_spacers_chance_desc".Translate()); futa_spacers_chance = listingStandard.Slider(futa_spacers_chance, 0.0f, 1.0f); } listingStandard.EndScrollView(ref viewRect); listingStandard.End(); }
public override void DoWindowContents(Rect inRect) { Rect rect = inRect.AtZero(); rect.yMax -= 45f; Listing_Standard listing_Standard = new Listing_Standard(); listing_Standard.ColumnWidth = (rect.width - 34f) / 3f; listing_Standard.Begin(rect); Text.Font = GameFont.Medium; listing_Standard.Label("Audiovisuals".Translate(), -1f); Text.Font = GameFont.Small; listing_Standard.Gap(12f); listing_Standard.Gap(12f); listing_Standard.Label("GameVolume".Translate(), -1f); Prefs.VolumeGame = listing_Standard.Slider(Prefs.VolumeGame, 0f, 1f); listing_Standard.Label("MusicVolume".Translate(), -1f); Prefs.VolumeMusic = listing_Standard.Slider(Prefs.VolumeMusic, 0f, 1f); listing_Standard.Label("AmbientVolume".Translate(), -1f); Prefs.VolumeAmbient = listing_Standard.Slider(Prefs.VolumeAmbient, 0f, 1f); if (listing_Standard.ButtonTextLabeled("Resolution".Translate(), Dialog_Options.ResToString(Screen.width, Screen.height))) { Find.WindowStack.Add(new Dialog_ResolutionPicker()); } bool customCursorEnabled = Prefs.CustomCursorEnabled; listing_Standard.CheckboxLabeled("CustomCursor".Translate(), ref customCursorEnabled, null); Prefs.CustomCursorEnabled = customCursorEnabled; bool fullScreen = Screen.fullScreen; bool flag = fullScreen; listing_Standard.CheckboxLabeled("Fullscreen".Translate(), ref fullScreen, null); if (fullScreen != flag) { ResolutionUtility.SafeSetFullscreen(fullScreen); } listing_Standard.Label("UIScale".Translate(), -1f); float[] uIScales = Dialog_Options.UIScales; for (int i = 0; i < uIScales.Length; i++) { float num = uIScales[i]; if (listing_Standard.RadioButton(num.ToString() + "x", Prefs.UIScale == num, 8f)) { if (!ResolutionUtility.UIScaleSafeWithResolution(num, Screen.width, Screen.height)) { Messages.Message("MessageScreenResTooSmallForUIScale".Translate(), MessageTypeDefOf.RejectInput); } else { ResolutionUtility.SafeSetUIScale(num); } } } listing_Standard.Gap(12f); bool hatsOnlyOnMap = Prefs.HatsOnlyOnMap; listing_Standard.CheckboxLabeled("HatsShownOnlyOnMap".Translate(), ref hatsOnlyOnMap, null); if (hatsOnlyOnMap != Prefs.HatsOnlyOnMap) { PortraitsCache.Clear(); } Prefs.HatsOnlyOnMap = hatsOnlyOnMap; listing_Standard.NewColumn(); Text.Font = GameFont.Medium; listing_Standard.Label("Gameplay".Translate(), -1f); Text.Font = GameFont.Small; listing_Standard.Gap(12f); listing_Standard.Gap(12f); if (listing_Standard.ButtonText("KeyboardConfig".Translate(), null)) { Find.WindowStack.Add(new Dialog_KeyBindings()); } if (listing_Standard.ButtonText("ChooseLanguage".Translate(), null)) { if (Current.ProgramState == ProgramState.Playing) { Messages.Message("ChangeLanguageFromMainMenu".Translate(), MessageTypeDefOf.RejectInput); } else { List <FloatMenuOption> list = new List <FloatMenuOption>(); foreach (LoadedLanguage current in LanguageDatabase.AllLoadedLanguages) { LoadedLanguage localLang = current; list.Add(new FloatMenuOption(localLang.FriendlyNameNative, delegate { LanguageDatabase.SelectLanguage(localLang); }, MenuOptionPriority.Default, null, null, 0f, null, null)); } Find.WindowStack.Add(new FloatMenu(list)); } } if ((Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor) && listing_Standard.ButtonText("OpenSaveGameDataFolder".Translate(), null)) { Application.OpenURL(GenFilePaths.SaveDataFolderPath); } bool adaptiveTrainingEnabled = Prefs.AdaptiveTrainingEnabled; listing_Standard.CheckboxLabeled("LearningHelper".Translate(), ref adaptiveTrainingEnabled, null); Prefs.AdaptiveTrainingEnabled = adaptiveTrainingEnabled; if (listing_Standard.ButtonText("ResetAdaptiveTutor".Translate(), null)) { Messages.Message("AdaptiveTutorIsReset".Translate(), MessageTypeDefOf.TaskCompletion); PlayerKnowledgeDatabase.ResetPersistent(); } bool runInBackground = Prefs.RunInBackground; listing_Standard.CheckboxLabeled("RunInBackground".Translate(), ref runInBackground, null); Prefs.RunInBackground = runInBackground; bool edgeScreenScroll = Prefs.EdgeScreenScroll; listing_Standard.CheckboxLabeled("EdgeScreenScroll".Translate(), ref edgeScreenScroll, null); Prefs.EdgeScreenScroll = edgeScreenScroll; bool pauseOnLoad = Prefs.PauseOnLoad; listing_Standard.CheckboxLabeled("PauseOnLoad".Translate(), ref pauseOnLoad, null); Prefs.PauseOnLoad = pauseOnLoad; bool pauseOnUrgentLetter = Prefs.PauseOnUrgentLetter; listing_Standard.CheckboxLabeled("PauseOnUrgentLetter".Translate(), ref pauseOnUrgentLetter, null); Prefs.PauseOnUrgentLetter = pauseOnUrgentLetter; bool showRealtimeClock = Prefs.ShowRealtimeClock; listing_Standard.CheckboxLabeled("ShowRealtimeClock".Translate(), ref showRealtimeClock, null); Prefs.ShowRealtimeClock = showRealtimeClock; bool plantWindSway = Prefs.PlantWindSway; listing_Standard.CheckboxLabeled("PlantWindSway".Translate(), ref plantWindSway, null); Prefs.PlantWindSway = plantWindSway; int maxNumberOfPlayerHomes = Prefs.MaxNumberOfPlayerHomes; listing_Standard.Label("MaxNumberOfPlayerHomes".Translate(new object[] { maxNumberOfPlayerHomes }), -1f); int num2 = Mathf.RoundToInt(listing_Standard.Slider((float)maxNumberOfPlayerHomes, 1f, 5f)); Prefs.MaxNumberOfPlayerHomes = num2; if (maxNumberOfPlayerHomes != num2 && num2 > 1) { TutorUtility.DoModalDialogIfNotKnown(ConceptDefOf.MaxNumberOfPlayerHomes); } if (listing_Standard.ButtonTextLabeled("TemperatureMode".Translate(), Prefs.TemperatureMode.ToStringHuman())) { List <FloatMenuOption> list2 = new List <FloatMenuOption>(); foreach (TemperatureDisplayMode localTmode2 in Enum.GetValues(typeof(TemperatureDisplayMode))) { TemperatureDisplayMode localTmode = localTmode2; list2.Add(new FloatMenuOption(localTmode.ToString(), delegate { Prefs.TemperatureMode = localTmode; }, MenuOptionPriority.Default, null, null, 0f, null, null)); } Find.WindowStack.Add(new FloatMenu(list2)); } float autosaveIntervalDays = Prefs.AutosaveIntervalDays; string text = "Days".Translate(); string text2 = "Day".Translate().ToLower(); if (listing_Standard.ButtonTextLabeled("AutosaveInterval".Translate(), autosaveIntervalDays + " " + ((autosaveIntervalDays != 1f) ? text : text2))) { List <FloatMenuOption> list3 = new List <FloatMenuOption>(); if (Prefs.DevMode) { list3.Add(new FloatMenuOption("0.125 " + text + "(debug)", delegate { Prefs.AutosaveIntervalDays = 0.125f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); list3.Add(new FloatMenuOption("0.25 " + text + "(debug)", delegate { Prefs.AutosaveIntervalDays = 0.25f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); } list3.Add(new FloatMenuOption("0.5 " + text + string.Empty, delegate { Prefs.AutosaveIntervalDays = 0.5f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); list3.Add(new FloatMenuOption(1.ToString() + " " + text2, delegate { Prefs.AutosaveIntervalDays = 1f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); list3.Add(new FloatMenuOption(3.ToString() + " " + text, delegate { Prefs.AutosaveIntervalDays = 3f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); list3.Add(new FloatMenuOption(7.ToString() + " " + text, delegate { Prefs.AutosaveIntervalDays = 7f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); list3.Add(new FloatMenuOption(14.ToString() + " " + text, delegate { Prefs.AutosaveIntervalDays = 14f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); Find.WindowStack.Add(new FloatMenu(list3)); } if (Current.ProgramState == ProgramState.Playing && Current.Game.Info.permadeathMode && Prefs.AutosaveIntervalDays > 1f) { GUI.color = Color.red; listing_Standard.Label("MaxPermadeathAutosaveIntervalInfo".Translate(new object[] { 1f }), -1f); GUI.color = Color.white; } if (Current.ProgramState == ProgramState.Playing && listing_Standard.ButtonText("ChangeStoryteller".Translate(), "OptionsButton-ChooseStoryteller") && TutorSystem.AllowAction("ChooseStoryteller")) { Find.WindowStack.Add(new Page_SelectStorytellerInGame()); } if (listing_Standard.ButtonTextLabeled("ShowAnimalNames".Translate(), Prefs.AnimalNameMode.ToStringHuman())) { List <FloatMenuOption> list4 = new List <FloatMenuOption>(); foreach (AnimalNameDisplayMode localMode2 in Enum.GetValues(typeof(AnimalNameDisplayMode))) { AnimalNameDisplayMode localMode = localMode2; list4.Add(new FloatMenuOption(localMode.ToStringHuman(), delegate { Prefs.AnimalNameMode = localMode; }, MenuOptionPriority.Default, null, null, 0f, null, null)); } Find.WindowStack.Add(new FloatMenu(list4)); } bool devMode = Prefs.DevMode; listing_Standard.CheckboxLabeled("DevelopmentMode".Translate(), ref devMode, null); Prefs.DevMode = devMode; if (Prefs.DevMode) { bool resetModsConfigOnCrash = Prefs.ResetModsConfigOnCrash; listing_Standard.CheckboxLabeled("ResetModsConfigOnCrash".Translate(), ref resetModsConfigOnCrash, null); Prefs.ResetModsConfigOnCrash = resetModsConfigOnCrash; bool logVerbose = Prefs.LogVerbose; listing_Standard.CheckboxLabeled("LogVerbose".Translate(), ref logVerbose, null); Prefs.LogVerbose = logVerbose; } listing_Standard.NewColumn(); Text.Font = GameFont.Medium; listing_Standard.Label(string.Empty, -1f); Text.Font = GameFont.Small; listing_Standard.Gap(12f); listing_Standard.Gap(12f); if (listing_Standard.ButtonText("ModSettings".Translate(), null)) { Find.WindowStack.Add(new Dialog_ModSettings()); } listing_Standard.Label(string.Empty, -1f); listing_Standard.Label("NamesYouWantToSee".Translate(), -1f); Prefs.PreferredNames.RemoveAll(new Predicate <string>(GenText.NullOrEmpty)); for (int j = 0; j < Prefs.PreferredNames.Count; j++) { string name = Prefs.PreferredNames[j]; PawnBio pawnBio = (from b in SolidBioDatabase.allBios where b.name.ToString() == name select b).FirstOrDefault <PawnBio>(); if (pawnBio == null) { name += " [N]"; } else { PawnBioType bioType = pawnBio.BioType; if (bioType != PawnBioType.BackstoryInGame) { if (bioType == PawnBioType.PirateKing) { name += " [PK]"; } } else { name += " [B]"; } } Rect rect2 = listing_Standard.GetRect(24f); Widgets.Label(rect2, name); Rect butRect = new Rect(rect2.xMax - 24f, rect2.y, 24f, 24f); if (Widgets.ButtonImage(butRect, TexButton.DeleteX)) { Prefs.PreferredNames.RemoveAt(j); SoundDefOf.TickLow.PlayOneShotOnCamera(null); } } if (Prefs.PreferredNames.Count < 6 && listing_Standard.ButtonText("AddName".Translate() + "...", null)) { Find.WindowStack.Add(new Dialog_AddPreferredName()); } listing_Standard.End(); }
internal void DoSettingsWindowContents(Rect inRect) { bool didDraw = false; Rect previewRect = inRect.RightPartPixels(inRect.width - 250f).TopPart(0.6f).ContractedBy(5f); //Widgets.DrawBox(previewRect); if (Current.ProgramState == ProgramState.Playing) { var selector = Find.Selector; if (selector != null && selector.NumSelected > 0 && selector.SelectedObjects[0] is Pawn) { Pawn pawn = selector.SelectedObjects[0] as Pawn; float width = (1 - 0.375f) * (630f + extraTabWidth); width += 10f; Rect rect = previewRect; if (rect.width > width) { float diff = rect.width - width; rect.x += diff / 2f; rect.width = width; } Widgets.DrawWindowBackground(rect); rect = rect.ContractedBy(5f); HealthCardUtility.DrawHediffListing(rect, pawn, true); didDraw = true; } } if (!didDraw) { Widgets.NoneLabelCenteredVertically(previewRect.ContractedBy(10f), "settings_selectExamplePawnIngame".Translate()); } Listing_Standard listingStandard = new Listing_Standard(); listingStandard.Begin(inRect.LeftPartPixels(250f).TopPart(0.6f)); listingStandard.ColumnWidth = 250f; //listingStandard.ColumnWidth -= 30f; bool localEnabled = Enabled; listingStandard.CheckboxLabeled("settings_IsEnabled".Translate(), ref localEnabled, "settings_IsEnabled_tooltip".Translate()); Enabled = localEnabled; listingStandard.GapLine(); listingStandard.CheckboxLabeled("settings_replacingPartInBodypart".Translate(), ref replacingPartInBodypart, "settings_replacingPartInBodypart_tooltip".Translate()); listingStandard.CheckboxLabeled("settings_italicizeMissing".Translate(), ref italicizeMissing, "settings_italicizeMissing_tooltip".Translate()); listingStandard.CheckboxLabeled("settings_evenOddHighlights".Translate(), ref evenOddHighlights, "settings_evenOddHighlights_tooltip".Translate()); listingStandard.CheckboxLabeled("settings_verticalSeparator".Translate(), ref verticalSeparator, "settings_verticalSeparator_tooltip".Translate()); listingStandard.CheckboxLabeled("settings_horizontalSeparator".Translate(), ref horizontalSeparator, "settings_horizontalSeparator_tooltip".Translate()); listingStandard.CheckboxLabeled("settings_internalSeparator".Translate(), ref internalSeparator, "settings_internalSeparator_tooltip".Translate()); listingStandard.CheckboxLabeled("settings_separatorNightMode".Translate(), ref separatorNightMode, "settings_separatorNightMode_tooltip".Translate()); listingStandard.CheckboxLabeled("settings_tendPrioritySort".Translate(), ref tendPrioritySort, "settings_tendPrioritySort_tooltip".Translate()); listingStandard.CheckboxLabeled("settings_bodypartHealthbars".Translate(), ref bodypartHealthbars, "settings_bodypartHealthbars_tooltip".Translate()); listingStandard.CheckboxLabeled("settings_bleedingIcons".Translate(), ref bleedingIcons, "settings_bleedingIcons_tooltip".Translate()); listingStandard.CheckboxLabeled("settings_tendingIcons".Translate(), ref tendingIcons, "settings_tendingIcons_tooltip".Translate()); listingStandard.End(); Listing_Standard listingStandardWide = new Listing_Standard(); listingStandardWide.Begin(inRect.BottomPart(0.4f)); listingStandardWide.ColumnWidth = (inRect.width - 17f) / 2f; listingStandardWide.EnumSelector(ref severityBarMode, "settings_severityBars".Translate(), valueLabelPrefix: "SeverityBarMode_", tooltip: "settings_severityBars_tooltip".Translate()); listingStandardWide.EnumSelector(ref severityBarsPosition, "settings_severityBarPosition".Translate(), valueLabelPrefix: "BarPosition_", tooltip: "settings_severityBarPosition_tooltip".Translate()); listingStandardWide.CheckboxLabeled("settings_severityBarHighContrast".Translate(), ref severityBarHighContrast, "settings_severityBarHighContrast_tooltip".Translate()); listingStandardWide.CheckboxLabeled("settings_showHiddenProgressConditions".Translate(), ref showHiddenProgressConditions, "settings_showHiddenProgressConditions_tooltip".Translate()); listingStandardWide.NewColumn(); //listingStandardWide.ColumnWidth = 400; listingStandardWide.Label($"{"settings_extraTabWidth".Translate()}: {extraTabWidth.ToString("F0")}px"); extraTabWidth = (int)listingStandardWide.Slider(extraTabWidth, 0, 300); listingStandardWide.Label($"{"settings_extraTabHeight".Translate()}: {extraTabHeight.ToString("F0")}px"); extraTabHeight = (int)listingStandardWide.Slider(extraTabHeight, 0, 200); listingStandardWide.End(); }
protected override void FillTab() { Rect outRect = new Rect(0f, 0f, WinSize.x, WinSize.y).ContractedBy(10f); Rect rect = new Rect(0f, 0f, outRect.width - 16f, Mathf.Max(lastDrawnHeight, outRect.height)); Widgets.BeginScrollView(outRect, ref scrollPosition, rect); Text.Font = GameFont.Medium; Widgets.Label(rect, base.SelTile.biome.LabelCap); Rect rect2 = rect; rect2.yMin += 35f; rect2.height = 99999f; Text.Font = GameFont.Small; Listing_Standard listing_Standard = new Listing_Standard(); listing_Standard.verticalSpacing = 0f; listing_Standard.Begin(rect2); Tile selTile = base.SelTile; int selTileID = base.SelTileID; listing_Standard.Label(selTile.biome.description); listing_Standard.Gap(8f); listing_Standard.GapLine(); if (!selTile.biome.implemented) { listing_Standard.Label(selTile.biome.LabelCap + " " + "BiomeNotImplemented".Translate()); } listing_Standard.LabelDouble("Terrain".Translate(), selTile.hilliness.GetLabelCap()); if (selTile.Roads != null) { listing_Standard.LabelDouble("Road".Translate(), selTile.Roads.Select((Tile.RoadLink roadlink) => roadlink.road.label).Distinct().ToCommaList(useAnd: true) .CapitalizeFirst()); } if (selTile.Rivers != null) { listing_Standard.LabelDouble("River".Translate(), selTile.Rivers.MaxBy((Tile.RiverLink riverlink) => riverlink.river.degradeThreshold).river.LabelCap); } if (!Find.World.Impassable(selTileID)) { StringBuilder stringBuilder = new StringBuilder(); string rightLabel = (WorldPathGrid.CalculatedMovementDifficultyAt(selTileID, perceivedStatic: false, null, stringBuilder) * Find.WorldGrid.GetRoadMovementDifficultyMultiplier(selTileID, -1, stringBuilder)).ToString("0.#"); if (WorldPathGrid.WillWinterEverAffectMovementDifficulty(selTileID) && WorldPathGrid.GetCurrentWinterMovementDifficultyOffset(selTileID) < 2f) { stringBuilder.AppendLine(); stringBuilder.AppendLine(); stringBuilder.Append(" ("); stringBuilder.Append("MovementDifficultyOffsetInWinter".Translate("+" + 2f.ToString("0.#"))); stringBuilder.Append(")"); } listing_Standard.LabelDouble("MovementDifficulty".Translate(), rightLabel, stringBuilder.ToString()); } if (selTile.biome.canBuildBase) { listing_Standard.LabelDouble("StoneTypesHere".Translate(), (from rt in Find.World.NaturalRockTypesIn(selTileID) select rt.label).ToCommaList(useAnd: true).CapitalizeFirst()); } listing_Standard.LabelDouble("Elevation".Translate(), selTile.elevation.ToString("F0") + "m"); listing_Standard.GapLine(); listing_Standard.LabelDouble("AvgTemp".Translate(), GenTemperature.GetAverageTemperatureLabel(selTileID)); listing_Standard.LabelDouble("OutdoorGrowingPeriod".Translate(), Zone_Growing.GrowingQuadrumsDescription(selTileID)); listing_Standard.LabelDouble("Rainfall".Translate(), selTile.rainfall.ToString("F0") + "mm"); if (selTile.biome.foragedFood != null && selTile.biome.forageability > 0f) { listing_Standard.LabelDouble("Forageability".Translate(), selTile.biome.forageability.ToStringPercent() + " (" + selTile.biome.foragedFood.label + ")"); } else { listing_Standard.LabelDouble("Forageability".Translate(), "0%"); } listing_Standard.LabelDouble("AnimalsCanGrazeNow".Translate(), VirtualPlantsUtility.EnvironmentAllowsEatingVirtualPlantsNowAt(selTileID) ? "Yes".Translate() : "No".Translate()); listing_Standard.GapLine(); listing_Standard.LabelDouble("AverageDiseaseFrequency".Translate(), string.Format("{0} {1}", (60f / selTile.biome.diseaseMtbDays).ToString("F1"), "PerYear".Translate())); listing_Standard.LabelDouble("TimeZone".Translate(), GenDate.TimeZoneAt(Find.WorldGrid.LongLatOf(selTileID).x).ToStringWithSign()); StringBuilder stringBuilder2 = new StringBuilder(); Rot4 rot = Find.World.CoastDirectionAt(selTileID); if (rot.IsValid) { stringBuilder2.AppendWithComma(("HasCoast" + rot.ToString()).Translate()); } if (Find.World.HasCaves(selTileID)) { stringBuilder2.AppendWithComma("HasCaves".Translate()); } if (stringBuilder2.Length > 0) { listing_Standard.LabelDouble("SpecialFeatures".Translate(), stringBuilder2.ToString().CapitalizeFirst()); } if (Prefs.DevMode) { listing_Standard.LabelDouble("Debug world tile ID", selTileID.ToString()); } lastDrawnHeight = rect2.y + listing_Standard.CurHeight; listing_Standard.End(); Widgets.EndScrollView(); }
public static void Dialog_FloatSlider(this Listing_Standard list, string desc, string format, ref float value, float min, float max, float multiplier = 1f) { list.Label(desc.Translate(string.Format("{0:" + format + "}", value * multiplier))); value = list.Slider(value, min, max); }
protected override void FillTab() { var compPrisoner = this.SelPawn.TryGetComp<CompPrisoner>(); if( compPrisoner == null ) { throw new Exception( "ITab_Pawn_Prisoner on non-human!" ); } bool isSlave = this.SelPawn.IsSlaveOfColony(); bool isColonist = ( ( !this.SelPawn.IsPrisonerOfColony )&& ( compPrisoner.wasArrested ) ); ConceptDatabase.KnowledgeDemonstrated( ConceptDefOf.PrisonerTab, KnowledgeAmount.GuiFrame ); Text.Font = GameFont.Small; var iTabInnerRect = new Rect( 0.0f, 0.0f, this.size.x, 9999f ).ContractedBy( innerBorder ); var iTabListing = new Listing_Standard( iTabInnerRect ); { #region Debug // Window will automagically grow in height if needed if( Prefs.DevMode ) { var textFont = Text.Font; Text.Font = GameFont.Tiny; var devRect = iTabListing.GetRect( ( isColonist ? 4f : isSlave ? 5f : 6f ) * 16f ); devRect.height = 20f; Widgets.Label( devRect, "Debug Info:" ); devRect.y += 16f; if( !isColonist ) { Widgets.Label( devRect, string.Format( "MTB Prison break (days): {0}", (int) PrisonBreakUtility.InitiatePrisonBreakMtbDays( this.SelPawn ) ) ); devRect.y += 16f; Widgets.Label( devRect, string.Format( "Odds of escape attempt: {0}", (int) ( 100f * this.SelPawn.EscapeProbability() ) ) ); devRect.y += 16f; Widgets.Label( devRect, string.Format( "Mood: {0}", (int) ( 100f * this.SelPawn.needs.mood.CurLevel ) ) ); devRect.y += 16f; Widgets.Label( devRect, string.Format( "Sight (actual/thought): {0}/{1}", this.SelPawn.CanBeSeenByColony(), this.SelPawn.ThinksTheyCanBeSeenByColony() ) ); devRect.y += 16f; } else { Widgets.Label( devRect, string.Format( "wasArrested/Release: {0}", compPrisoner.wasArrested) ); devRect.y += 16f; Widgets.Label( devRect, string.Format( "Release/Current: {0}/{1}", compPrisoner.releaseAfterTick, Find.TickManager.TicksGame ) ); devRect.y += 16f; } #region Prisoner Recruitment Difficulty if( !isSlave ) { Widgets.Label( devRect, Data.Strings.RecruitmentDifficulty.Translate() + ": " + this.SelPawn.RecruitDifficulty( Faction.OfPlayer, false ).ToString( "##0" ) ); devRect.y += 16f; } #endregion Text.Font = textFont; Widgets.DrawLineHorizontal( 0f, iTabListing.CurHeight, iTabListing.ColumnWidth ); iTabListing.Gap( innerBorder ); } #endregion #region Original Slave Faction and Role if( isSlave ) { var textFont = Text.Font; Text.Font = GameFont.Tiny; iTabListing.Label( Data.Strings.FactionLabel.Translate( compPrisoner.originalFaction.Name ) ); iTabListing.Label( Data.Strings.PawnKindLabel.Translate( compPrisoner.originalPawnKind.LabelCap ) ); Text.Font = textFont; } #endregion #region Prisoner/Slave Interaction Options if( !isColonist ) { var interactionsRect = iTabListing.GetRect( innerBorder * 2f + 28f * ( isSlave ? 4 : 6 ) ); Widgets.DrawMenuSection( interactionsRect, true ); var interactionsInnerRect = interactionsRect.ContractedBy( innerBorder ); GUI.BeginGroup( interactionsInnerRect ); { var optionRect = new Rect( 0.0f, 0.0f, interactionsInnerRect.width, 30f ); #region Core Options foreach( PrisonerInteractionMode mode in Enum.GetValues( typeof( PrisonerInteractionMode ) ) ) { // Can't recruit slaves and they have their own release mechanism bool showThis = ( ( !isSlave ) || ( ( mode != PrisonerInteractionMode.AttemptRecruit ) && ( mode != PrisonerInteractionMode.Release ) ) ); if( showThis ) { if( Widgets.RadioButtonLabeled( optionRect, mode.GetLabel(), this.SelPawn.guest.interactionMode == mode ) ) { this.SelPawn.guest.interactionMode = mode; } optionRect.y += 28f; } } #endregion #region Prisoner Specific Options if( !isSlave ) { // Enslave prisoner if( Widgets.RadioButtonLabeled( optionRect, Data.Strings.Enslave.Translate(), this.SelPawn.guest.interactionMode == Data.PIM.EnslavePrisoner ) ) { this.SelPawn.guest.interactionMode = Data.PIM.EnslavePrisoner; } optionRect.y += 28f; } #endregion #region Slave Specific Options if( isSlave ) { // Free slave if( Widgets.RadioButtonLabeled( optionRect, Data.Strings.FreeSlave.Translate(), this.SelPawn.guest.interactionMode == Data.PIM.FreeSlave ) ) { this.SelPawn.guest.interactionMode = Data.PIM.FreeSlave; } optionRect.y += 28f; } #endregion } GUI.EndGroup(); iTabListing.Gap( innerBorder ); } #endregion #region Transer Pawn if( !isColonist ) { #region [Cancel] Transfer Button var transferOrCancelRect = iTabListing.GetRect( 30f ); #region Transfer to a valid Marker or Prison Cell if( !compPrisoner.ShouldBeTransfered ) { if( Widgets.ButtonText( transferOrCancelRect, Data.Strings.TransferPrisoner.Translate() ) ) { var floatMenuOptions = this.TransferTargetFloatMenuOptions(); if( ( floatMenuOptions.Count == 0 ) || ( ( floatMenuOptions.Count == 1 ) && ( floatMenuOptions[ 0 ].Label == Data.Strings.PrisonCell.Translate() ) && ( this.SelPawn.GetRoom() == this.SelPawn.ownership.OwnedBed.GetRoom() ) ) ) { floatMenuOptions.Add( new FloatMenuOption( Data.Strings.InstallMarker.Translate(), (Action) null ) ); } Find.WindowStack.Add( (Window) new FloatMenu( floatMenuOptions ) ); } else { this.cachedMarkers = null; } } #endregion #region Cancel Transfer if( compPrisoner.ShouldBeTransfered ) { if( Widgets.ButtonText( transferOrCancelRect, Data.Strings.CancelTransfer.Translate() ) ) { compPrisoner.haulTarget = null; } } #endregion iTabListing.Gap( innerBorder ); #endregion #region Transfer Target var transferTargetRect = iTabListing.GetRect( 30f ); var style = new GUIStyle( Text.CurTextFieldStyle ); style.alignment = TextAnchor.MiddleCenter; string label = string.Empty; if( compPrisoner.haulTarget != null ) { if( compPrisoner.haulTarget is Building_RoomMarker ) { label = ( (Building_RoomMarker) compPrisoner.haulTarget ).markerName; } else if( compPrisoner.haulTarget is Building_Bed ) { label = Data.Strings.PrisonCell.Translate(); } } GUI.Label( transferTargetRect, label, style ); iTabListing.Gap( innerBorder ); #endregion #region Restraints var restraintsRect = iTabListing.GetRect( innerBorder * 2f + 28f * 2f ); Widgets.DrawMenuSection( restraintsRect, true ); var restraintsInnerRect = restraintsRect.ContractedBy( innerBorder ); GUI.BeginGroup( restraintsInnerRect ); { var restrainRect = new Rect( 0.0f, 0.0f, restraintsInnerRect.width, 30f ); Widgets.CheckboxLabeled( restrainRect, Data.Strings.RestrainCuff.Translate(), ref compPrisoner.ShouldBeCuffed ); restrainRect.y += 28f; Widgets.CheckboxLabeled( restrainRect, Data.Strings.RestrainShackle.Translate(), ref compPrisoner.ShouldBeShackled ); restrainRect.y += 28f; } GUI.EndGroup(); #endregion } #endregion #region Food if( !isColonist ) { var getsFood = this.SelPawn.guest.GetsFood; iTabListing.CheckboxLabeled( Data.Strings.GetsFood.Translate(), ref getsFood, (string) null ); this.SelPawn.guest.GetsFood = getsFood; } #endregion #region Medicine if( !isColonist ) { var medicalCareRect = iTabListing.GetRect( 28f ); medicalCareRect.width = MedicalCareUtility.CareSetterWidth; MedicalCareUtility.MedicalCareSetter( medicalCareRect, ref this.SelPawn.playerSettings.medCare ); } #endregion } iTabListing.End(); tabHeight = iTabListing.CurHeight; }
public static void Dialog_Label(this Listing_Standard list, string text) { list.Gap(); list.GapLine(); list.Label(text.Translate()); }
protected void fillPageShowHide(Listing_Standard listing) { listing.OverrideColumnWidth = 230; DoHeading(listing, "PSI.Settings.Visibility.Header"); listing.OverrideColumnWidth = 95; listing.DoLabelCheckbox(Translator.Translate("PSI.Settings.Visibility.TargetPoint"), ref PSI.settings.showTargetPoint); listing.DoLabelCheckbox(Translator.Translate("PSI.Settings.Visibility.Aggressive"), ref PSI.settings.showAggressive); listing.DoLabelCheckbox(Translator.Translate("PSI.Settings.Visibility.Dazed"), ref PSI.settings.showDazed); listing.DoLabelCheckbox(Translator.Translate("PSI.Settings.Visibility.Leave"), ref PSI.settings.showLeave); listing.DoLabelCheckbox(Translator.Translate("PSI.Settings.Visibility.Draft"), ref PSI.settings.showDraft); listing.DoLabelCheckbox(Translator.Translate("PSI.Settings.Visibility.Idle"), ref PSI.settings.showIdle); listing.DoLabelCheckbox(Translator.Translate("PSI.Settings.Visibility.Unarmed"), ref PSI.settings.showUnarmed); listing.DoLabelCheckbox(Translator.Translate("PSI.Settings.Visibility.Hungry"), ref PSI.settings.showHungry); listing.DoLabelCheckbox(Translator.Translate("PSI.Settings.Visibility.Sad"), ref PSI.settings.showSad); listing.DoLabelCheckbox(Translator.Translate("PSI.Settings.Visibility.Tired"), ref PSI.settings.showTired); listing.DoLabelCheckbox(Translator.Translate("PSI.Settings.Visibility.Disease"), ref PSI.settings.showDisease); listing.OverrideColumnWidth = 230; if (listing.DoTextButton(Translator.Translate("PSI.Settings.ReturnButton"))) page = "main"; listing.OverrideColumnWidth = 95; listing.NewColumn(); DoHeading(listing, " ", false); DoHeading(listing, " ", false); listing.DoLabelCheckbox(Translator.Translate("PSI.Settings.Visibility.Injury"), ref PSI.settings.showEffectiveness); listing.DoLabelCheckbox(Translator.Translate("PSI.Settings.Visibility.Bloodloss"), ref PSI.settings.showBloodloss); listing.DoLabelCheckbox(Translator.Translate("PSI.Settings.Visibility.Hot"), ref PSI.settings.showHot); listing.DoLabelCheckbox(Translator.Translate("PSI.Settings.Visibility.Cold"), ref PSI.settings.showCold); listing.DoLabelCheckbox(Translator.Translate("PSI.Settings.Visibility.Naked"), ref PSI.settings.showNaked); listing.DoLabelCheckbox(Translator.Translate("PSI.Settings.Visibility.Drunk"), ref PSI.settings.showDrunk); listing.DoLabelCheckbox(Translator.Translate("PSI.Settings.Visibility.ApparelHealth"), ref PSI.settings.showApparelHealth); listing.DoLabelCheckbox(Translator.Translate("PSI.Settings.Visibility.Pacific"), ref PSI.settings.showPacific); }
private void MinimapHeader( Listing_Standard listing, MiniMap.MiniMap minimap ) { var str = minimap.LabelCap; listing.Label( str ); listing.Gap( 6 ); listing.Indent(); }
protected override void FillWindow(UnityEngine.Rect inRect) { if (optionsDialog == null) return; //base.FillWindow(inRect); Rect optionsRect = optionsDialog.winRect; this.winRect = new Rect(optionsRect.xMax - 240, optionsRect.yMin, 240, optionsRect.height); Listing_Standard listing = new Listing_Standard(inRect); DoHeading(listing, "Pawn State Icons", false); listing.OverrideColumnWidth = this.winRect.width; //if (page == "main") fillPageMain(listing); if (page == "showhide") fillPageShowHide(listing); else if (page == "arrange") fillPageArrangement(listing); else if (page == "limits") fillPageLimits(listing); else fillPageMain(listing); listing.End(); }
/// <summary> /// Draws the mod configuration window contents. /// </summary> /// <returns>The final height of the window rect.</returns> /// <param name="rect">Rect</param> public override float DoWindowContents( Rect rect ) { var listing = new Listing_Standard( rect ); { listing.ColumnWidth = rect.width - 4f; #region Main Toggle var toggleLabel = "MiniMap.MCMToggleMain".Translate(); listing.CheckboxLabeled( toggleLabel, ref MiniMap.MiniMapController.visible ); listing.Gap(); #endregion #region Handle all MiniMaps and Overlays foreach( var minimap in Controller.Data.MiniMaps ) { if( minimap.IsOrHasIConfigurable ) { var iMinimap = minimap as IConfigurable; #region Minimap Header MinimapHeader( listing, minimap ); #endregion #region Handle MiniMap IConfigurable if( iMinimap != null ) { #region Minimap IConfigurable var iMinimapRect = new Rect( listing.Indentation(), listing.CurHeight, listing.ColumnWidth, 9999f ); GUI.BeginGroup( iMinimapRect ); var iMinimapHeight = iMinimap.DrawMCMRegion( iMinimapRect.AtZero() ); GUI.EndGroup(); listing.Gap( iMinimapHeight + 6f ); #endregion } #endregion #region Handle all MiniMap Overlays foreach( var overlay in minimap.overlayWorkers ) { var iOverlay = overlay as IConfigurable; #region Handle Overlay IConfigurable if( iOverlay != null ) { #region Overlay Header OverlayHeader( listing, overlay ); #endregion #region Overlay IConfigurable var iOverlayRect = new Rect( listing.Indentation(), listing.CurHeight, listing.ColumnWidth, 9999f ); GUI.BeginGroup( iOverlayRect ); var iOverlayHeight = iOverlay.DrawMCMRegion( iOverlayRect.AtZero() ); GUI.EndGroup(); listing.Gap( iOverlayHeight + 6f ); listing.Undent(); #endregion } #endregion } #endregion #region Final Undentation listing.Gap(); listing.Undent(); #endregion } } #endregion } listing.End(); return listing.CurHeight; }
private void DrawExtras(Rect rect) { Widgets.DrawMenuSection(rect); Listing_Standard listing = new Listing_Standard(rect.ContractedBy(5f)); listing.DoLabelCheckbox("ExplodeOnDeath".Translate(), ref _bp.ExplodeOnDeath); if (_bp.ExplodeOnDeath) { listing.DoLabel("ExplosionRadius".Translate(_bp.ExplosionRadius.ToString("0.0"))); _bp.ExplosionRadius = listing.DoSlider(_bp.ExplosionRadius, 0.9f, 3.9f); } listing.DoLabel("StartingSkill".Translate(_bp.StartingSkillLevel)); _bp.StartingSkillLevel = (int)listing.DoSlider(_bp.StartingSkillLevel, 1, 20); if (listing.DoTextButtonLabeled("SkillPassion".Translate(), _bp.SkillPassion.ToString())) { List<FloatMenuOption> list = new List<FloatMenuOption>(); foreach (Passion p in Enum.GetValues(typeof(Passion))) { if (p != _bp.SkillPassion) { FloatMenuOption option = new FloatMenuOption(p.ToString(), () => _bp.SkillPassion = p); list.Add(option); } } Find.LayerStack.Add(new Layer_FloatMenu(list)); } listing.End(); }
public override void DrawThresholdConfig(ref Listing_Standard listing) { // target threshold listing.DoGap(); listing.DoLabel("FMP.Threshold".Translate() + ":"); listing.DoLabel("FMP.ThresholdCount".Translate(CurCount, Count)); // TODO: implement trade screen sliders - they're so pretty! :D Count = Mathf.RoundToInt(listing.DoSlider(Count, 0, MaxUpperThreshold)); listing.DoGap(6f); if (listing.DoTextButton("FMP.ThresholdDetails".Translate())) { Find.WindowStack.Add(DetailsWindow); } }
public static void AddLabeledCheckbox(this Listing_Standard listing_Standard, string label, ref bool settingsValue) { listing_Standard.Gap(ListingStandardHelper.Gap); listing_Standard.CheckboxLabeled(label, ref settingsValue, null); }
public override void DrawColumns( Listing_Standard listing, float physicalHeight, bool overridden = false ) { #region Owner Settings var ownerToggleMainRect = listing.GetRect( 1 * GenUI.ListSpacing + GenUI.Pad * 2f ); Widgets.DrawMenuSection( ownerToggleMainRect, true ); var ownerTogglePosition = ownerToggleMainRect.ContractedBy( GenUI.Pad ); GUI.BeginGroup( ownerTogglePosition ); { var ownerToggleRect = new Rect( 0.0f, 0.0f, ownerTogglePosition.width, GenUI.ListSpacing + GenUI.GapTiny ); bool localValue = false; localValue = UserOnlyOwners; ITab_Restricted.DoLabelCheckbox( ref ownerToggleRect, Data.Strings.OwnableOnlyOwners, ref localValue, overridden ); UserOnlyOwners = localValue; } GUI.EndGroup(); listing.Gap(); if( !UserOnlyOwners ) { return; } #endregion #region Draw List of Owners listing.NewColumn(); #region Transfer, Clear buttons var buttonRect = listing.GetRect( GenUI.ListSpacing - GenUI.GapTiny ); buttonRect.x += buttonRect.width - GenUI.ListSpacing - GenUI.GapTiny; buttonRect.width = GenUI.ListSpacing - GenUI.GapTiny; if( CCL_Widgets.ButtonImage( buttonRect, Data.Icons.TransferOwners, "=", Data.Strings.OwnableAssign.Translate() ) ) { drawOwnerSwap = true; } buttonRect.x -= GenUI.ListSpacing; if( CCL_Widgets.ButtonImage( buttonRect, Data.Icons.ClearOwners, "0", Data.Strings.OwnableReset.Translate() ) ) { RebuildOwners( true ); } listing.Gap(); #endregion #region Draw list of owners var ownerHeight = physicalHeight - listing.CurHeight; var ownerRect = listing.GetRect( ownerHeight ); Widgets.DrawMenuSection( ownerRect, true ); ITab_Restricted.DrawOwnerScroll( ownerRect, ref vecCurrentOwners, Owners.ToList(), OwnerScrollRemoveOwner ); #endregion #endregion #region Draw list of potential owners if( drawOwnerSwap ) { listing.NewColumn(); #region Back button buttonRect = listing.GetRect( GenUI.ListSpacing - GenUI.GapTiny ); buttonRect.width = GenUI.ListSpacing - GenUI.GapTiny; if( CCL_Widgets.ButtonImage( buttonRect, Data.Icons.BackArrow, "<", Data.Strings.OwnableBack.Translate() ) ) { drawOwnerSwap = false; } listing.Gap(); #endregion #region Draw list ownerHeight = physicalHeight - listing.CurHeight; ownerRect = listing.GetRect( ownerHeight ); Widgets.DrawMenuSection( ownerRect, true ); ITab_Restricted.DrawOwnerScroll( ownerRect, ref vecPotentialOwners, potentialOwners, OwnerScrollAddOwner ); #endregion } #endregion }
private void OverlayHeader( Listing_Standard listing, MiniMap.MiniMapOverlay overlay ) { var str = overlay.LabelCap; listing.Label( str ); listing.Gap( 6 ); listing.Indent(); }
public static void AddHorizontalLine(this Listing_Standard listing_Standard, float?gap = null) { listing_Standard.Gap(gap ?? ListingStandardHelper.lineGap); listing_Standard.GapLine(gap ?? ListingStandardHelper.lineGap); }
public static Rect GetRect(this Listing_Standard listing_Standard, float?height = null) { return(listing_Standard.GetRect(height ?? Text.LineHeight)); }
public static void AddLabeledRadioList(this Listing_Standard listing_Standard, string header, string[] labels, ref string val, float?headerHeight = null) { listing_Standard.Gap(ListingStandardHelper.Gap); listing_Standard.AddLabelLine(header, headerHeight); listing_Standard.AddRadioList(ListingStandardHelper.GenerateLabeledRadioValues(labels), ref val, null); }
public override void DrawColumns( Listing_Standard listing, float physicalHeight, bool overridden = false ) { #region Restriction Settings var restrictionsRect = listing.GetRect( 5 * ( GenUI.ListSpacing - GenUI.GapTiny ) + GenUI.Pad * 2f ); Widgets.DrawMenuSection( restrictionsRect, true ); var restrictedPosition = restrictionsRect.ContractedBy( GenUI.Pad ); GUI.BeginGroup( restrictedPosition ); { var restrictionRect = new Rect( 0.0f, 0.0f, restrictedPosition.width, GenUI.ListSpacing + GenUI.GapTiny ); bool localValue = false; localValue = UserAllowPrisoners; ITab_Restricted.DoLabelCheckbox( ref restrictionRect, Data.Strings.AllowPrisoners, ref localValue, overridden ); UserAllowPrisoners = localValue; localValue = UserAllowSlaves; ITab_Restricted.DoLabelCheckbox( ref restrictionRect, Data.Strings.AllowSlaves, ref localValue, overridden ); UserAllowSlaves = localValue; localValue = UserAllowGuests; ITab_Restricted.DoLabelCheckbox( ref restrictionRect, Data.Strings.AllowGuests, ref localValue, overridden ); UserAllowGuests = localValue; localValue = UserAllowColonists; ITab_Restricted.DoLabelCheckbox( ref restrictionRect, Data.Strings.AllowColonists, ref localValue, overridden ); UserAllowColonists = localValue; localValue = UserAllowAnimals; ITab_Restricted.DoLabelCheckbox( ref restrictionRect, Data.Strings.AllowAnimals, ref localValue, overridden ); UserAllowAnimals = localValue; } GUI.EndGroup(); listing.Gap(); #endregion }
public static void AddLabeledRadioList <T>(this Listing_Standard listing_Standard, string header, Dictionary <string, T> dict, ref T val, float?headerHeight = null) { listing_Standard.Gap(ListingStandardHelper.Gap); listing_Standard.AddLabelLine(header, headerHeight); listing_Standard.AddRadioList(ListingStandardHelper.GenerateLabeledRadioValues <T>(dict), ref val, null); }
protected override void FillTab() { Text.Font = GameFont.Small; var columnsNeeded = 1; var listingRect = new Rect( 0f, 0f, this.size.x, 9999f ).ContractedBy( GenUI.Gap ); var listing = new Listing_Standard( listingRect ); { listing.ColumnWidth = Data.DefaultColumnWidth; #region Security Header listing.Label( Data.Strings.DoorRestrictions.Translate() ); var curY = listing.CurHeight; Widgets.DrawLine( new Vector2( 0f, curY ), new Vector2( Data.DefaultColumnWidth, curY ), Color.white, 1.0f ); listing.Gap( GenUI.Pad ); #endregion #region Do Comps var columnIndex = 0; var highestEnforced = HighestPriorityEnforced(); foreach( var comp in Comps ) { if( comp.ColumnIndex != columnIndex ) { listing.NewColumn(); columnIndex = comp.ColumnIndex; } var colNeeds = comp.ColumnIndex + comp.ColumnWidth; if( colNeeds > columnsNeeded ) { columnsNeeded = colNeeds; } comp.DrawColumns( listing, defaultHeight - GenUI.Gap * 2f, comp.Priority < highestEnforced ); } #endregion } listing.End(); #region Finalize ITab var newSize = new Vector2( GenUI.Gap + ( columnsNeeded * Data.DefaultColumnWidth ) + ( ( columnsNeeded - 1 ) * Listing_Standard.ColumnSpacing ) + GenUI.Gap, defaultHeight ); if( newSize != this.size ) { this.size = newSize; this.UpdateSize(); } #endregion }
public override void DoWindowContents(Rect inRect) { Text.Font = GameFont.Medium; Rect rect = new Rect(0f, 0f, 400f, 50f); Widgets.Label(rect, this.bill.LabelCap); float width = (float)((int)((inRect.width - 34f) / 3f)); Rect rect2 = new Rect(0f, 80f, width, inRect.height - 80f); Rect rect3 = new Rect(rect2.xMax + 17f, 50f, width, inRect.height - 50f - this.CloseButSize.y); Rect rect4 = new Rect(rect3.xMax + 17f, 50f, 0f, inRect.height - 50f - this.CloseButSize.y); rect4.xMax = inRect.xMax; Text.Font = GameFont.Small; Listing_Standard listing_Standard = new Listing_Standard(); listing_Standard.Begin(rect3); Listing_Standard listing_Standard2 = listing_Standard.BeginSection((float)Dialog_BillConfig.RepeatModeSubdialogHeight); if (listing_Standard2.ButtonText(this.bill.repeatMode.LabelCap, null)) { BillRepeatModeUtility.MakeConfigFloatMenu(this.bill); } listing_Standard2.Gap(12f); if (this.bill.repeatMode == BillRepeatModeDefOf.RepeatCount) { listing_Standard2.Label("RepeatCount".Translate(this.bill.repeatCount), -1f, null); listing_Standard2.IntEntry(ref this.bill.repeatCount, ref this.repeatCountEditBuffer, 1); } else if (this.bill.repeatMode == BillRepeatModeDefOf.TargetCount) { string text = "CurrentlyHave".Translate() + ": "; text += this.bill.recipe.WorkerCounter.CountProducts(this.bill); text += " / "; text += ((this.bill.targetCount >= 999999) ? "Infinite".Translate().ToLower() : this.bill.targetCount.ToString()); string str = this.bill.recipe.WorkerCounter.ProductsDescription(this.bill); if (!str.NullOrEmpty()) { string text2 = text; text = string.Concat(new string[] { text2, "\n", "CountingProducts".Translate(), ": ", str.CapitalizeFirst() }); } listing_Standard2.Label(text, -1f, null); int targetCount = this.bill.targetCount; listing_Standard2.IntEntry(ref this.bill.targetCount, ref this.targetCountEditBuffer, this.bill.recipe.targetCountAdjustment); this.bill.unpauseWhenYouHave = Mathf.Max(0, this.bill.unpauseWhenYouHave + (this.bill.targetCount - targetCount)); ThingDef producedThingDef = this.bill.recipe.ProducedThingDef; if (producedThingDef != null) { if (producedThingDef.IsWeapon || producedThingDef.IsApparel) { listing_Standard2.CheckboxLabeled("IncludeEquipped".Translate(), ref this.bill.includeEquipped, null); } if (producedThingDef.IsApparel && producedThingDef.apparel.careIfWornByCorpse) { listing_Standard2.CheckboxLabeled("IncludeTainted".Translate(), ref this.bill.includeTainted, null); } Widgets.Dropdown <Bill_Production, Zone_Stockpile>(listing_Standard2.GetRect(30f), this.bill, (Bill_Production b) => b.includeFromZone, (Bill_Production b) => this.GenerateStockpileInclusion(), (this.bill.includeFromZone != null) ? "IncludeSpecific".Translate(this.bill.includeFromZone.label) : "IncludeFromAll".Translate(), null, null, null, null, false); Widgets.FloatRange(listing_Standard2.GetRect(28f), 975643279, ref this.bill.hpRange, 0f, 1f, "HitPoints", ToStringStyle.PercentZero); if (producedThingDef.HasComp(typeof(CompQuality))) { Widgets.QualityRange(listing_Standard2.GetRect(28f), 1098906561, ref this.bill.qualityRange); } if (producedThingDef.MadeFromStuff) { listing_Standard2.CheckboxLabeled("LimitToAllowedStuff".Translate(), ref this.bill.limitToAllowedStuff, null); } } } if (this.bill.repeatMode == BillRepeatModeDefOf.TargetCount) { listing_Standard2.CheckboxLabeled("PauseWhenSatisfied".Translate(), ref this.bill.pauseWhenSatisfied, null); if (this.bill.pauseWhenSatisfied) { listing_Standard2.Label("UnpauseWhenYouHave".Translate() + ": " + this.bill.unpauseWhenYouHave.ToString("F0"), -1f, null); listing_Standard2.IntEntry(ref this.bill.unpauseWhenYouHave, ref this.unpauseCountEditBuffer, this.bill.recipe.targetCountAdjustment); if (this.bill.unpauseWhenYouHave >= this.bill.targetCount) { this.bill.unpauseWhenYouHave = this.bill.targetCount - 1; this.unpauseCountEditBuffer = this.bill.unpauseWhenYouHave.ToStringCached(); } } } listing_Standard.EndSection(listing_Standard2); listing_Standard.Gap(12f); Listing_Standard listing_Standard3 = listing_Standard.BeginSection((float)Dialog_BillConfig.StoreModeSubdialogHeight); string text3 = string.Format(this.bill.GetStoreMode().LabelCap, (this.bill.GetStoreZone() == null) ? string.Empty : this.bill.GetStoreZone().SlotYielderLabel()); if (this.bill.GetStoreZone() != null && !this.bill.recipe.WorkerCounter.CanPossiblyStoreInStockpile(this.bill, this.bill.GetStoreZone())) { text3 += string.Format(" ({0})", "IncompatibleLower".Translate()); Text.Font = GameFont.Tiny; } if (listing_Standard3.ButtonText(text3, null)) { Text.Font = GameFont.Small; List <FloatMenuOption> list = new List <FloatMenuOption>(); foreach (BillStoreModeDef current in from bsm in DefDatabase <BillStoreModeDef> .AllDefs orderby bsm.listOrder select bsm) { if (current == BillStoreModeDefOf.SpecificStockpile) { List <SlotGroup> allGroupsListInPriorityOrder = this.bill.billStack.billGiver.Map.haulDestinationManager.AllGroupsListInPriorityOrder; int count = allGroupsListInPriorityOrder.Count; for (int i = 0; i < count; i++) { SlotGroup group = allGroupsListInPriorityOrder[i]; Zone_Stockpile zone_Stockpile = group.parent as Zone_Stockpile; if (zone_Stockpile != null) { if (!this.bill.recipe.WorkerCounter.CanPossiblyStoreInStockpile(this.bill, zone_Stockpile)) { list.Add(new FloatMenuOption(string.Format("{0} ({1})", string.Format(current.LabelCap, group.parent.SlotYielderLabel()), "IncompatibleLower".Translate()), null, MenuOptionPriority.Default, null, null, 0f, null, null)); } else { list.Add(new FloatMenuOption(string.Format(current.LabelCap, group.parent.SlotYielderLabel()), delegate { this.bill.SetStoreMode(BillStoreModeDefOf.SpecificStockpile, (Zone_Stockpile)group.parent); }, MenuOptionPriority.Default, null, null, 0f, null, null)); } } } } else { BillStoreModeDef smLocal = current; list.Add(new FloatMenuOption(smLocal.LabelCap, delegate { this.bill.SetStoreMode(smLocal, null); }, MenuOptionPriority.Default, null, null, 0f, null, null)); } } Find.WindowStack.Add(new FloatMenu(list)); } Text.Font = GameFont.Small; listing_Standard.EndSection(listing_Standard3); listing_Standard.Gap(12f); Listing_Standard listing_Standard4 = listing_Standard.BeginSection((float)Dialog_BillConfig.WorkerSelectionSubdialogHeight); Widgets.Dropdown <Bill_Production, Pawn>(listing_Standard4.GetRect(30f), this.bill, (Bill_Production b) => b.pawnRestriction, (Bill_Production b) => this.GeneratePawnRestrictionOptions(), (this.bill.pawnRestriction != null) ? this.bill.pawnRestriction.LabelShortCap : "AnyWorker".Translate(), null, null, null, null, false); if (this.bill.pawnRestriction == null && this.bill.recipe.workSkill != null) { listing_Standard4.Label("AllowedSkillRange".Translate(this.bill.recipe.workSkill.label), -1f, null); listing_Standard4.IntRange(ref this.bill.allowedSkillRange, 0, 20); } listing_Standard.EndSection(listing_Standard4); listing_Standard.End(); Rect rect5 = rect4; rect5.yMin = rect5.yMax - (float)Dialog_BillConfig.IngredientRadiusSubdialogHeight; rect4.yMax = rect5.yMin - 17f; bool flag = this.bill.GetStoreZone() == null || this.bill.recipe.WorkerCounter.CanPossiblyStoreInStockpile(this.bill, this.bill.GetStoreZone()); Rect rect6 = rect4; ThingFilter ingredientFilter = this.bill.ingredientFilter; ThingFilter fixedIngredientFilter = this.bill.recipe.fixedIngredientFilter; int openMask = 4; IEnumerable <ThingDef> forceHiddenDefs = null; List <SpecialThingFilterDef> forceHiddenSpecialFilters = this.bill.recipe.forceHiddenSpecialFilters; List <ThingDef> premultipliedSmallIngredients = this.bill.recipe.GetPremultipliedSmallIngredients(); ThingFilterUI.DoThingFilterConfigWindow(rect6, ref this.thingFilterScrollPosition, ingredientFilter, fixedIngredientFilter, openMask, forceHiddenDefs, forceHiddenSpecialFilters, false, premultipliedSmallIngredients, this.bill.Map); bool flag2 = this.bill.GetStoreZone() == null || this.bill.recipe.WorkerCounter.CanPossiblyStoreInStockpile(this.bill, this.bill.GetStoreZone()); if (flag && !flag2) { Messages.Message("MessageBillValidationStoreZoneInsufficient".Translate(this.bill.LabelCap, this.bill.billStack.billGiver.LabelShort.CapitalizeFirst(), this.bill.GetStoreZone().label), this.bill.billStack.billGiver as Thing, MessageTypeDefOf.RejectInput, false); } Listing_Standard listing_Standard5 = new Listing_Standard(); listing_Standard5.Begin(rect5); string str2 = "IngredientSearchRadius".Translate().Truncate(rect5.width * 0.6f, null); string str3 = (this.bill.ingredientSearchRadius != 999f) ? this.bill.ingredientSearchRadius.ToString("F0") : "Unlimited".Translate().Truncate(rect5.width * 0.3f, null); listing_Standard5.Label(str2 + ": " + str3, -1f, null); this.bill.ingredientSearchRadius = listing_Standard5.Slider(this.bill.ingredientSearchRadius, 3f, 100f); if (this.bill.ingredientSearchRadius >= 100f) { this.bill.ingredientSearchRadius = 999f; } listing_Standard5.End(); Listing_Standard listing_Standard6 = new Listing_Standard(); listing_Standard6.Begin(rect2); if (this.bill.suspended) { if (listing_Standard6.ButtonText("Suspended".Translate(), null)) { this.bill.suspended = false; SoundDefOf.Click.PlayOneShotOnCamera(null); } } else if (listing_Standard6.ButtonText("NotSuspended".Translate(), null)) { this.bill.suspended = true; SoundDefOf.Click.PlayOneShotOnCamera(null); } StringBuilder stringBuilder = new StringBuilder(); if (this.bill.recipe.description != null) { stringBuilder.AppendLine(this.bill.recipe.description); stringBuilder.AppendLine(); } stringBuilder.AppendLine("WorkAmount".Translate() + ": " + this.bill.recipe.WorkAmountTotal(null).ToStringWorkAmount()); for (int j = 0; j < this.bill.recipe.ingredients.Count; j++) { IngredientCount ingredientCount = this.bill.recipe.ingredients[j]; if (!ingredientCount.filter.Summary.NullOrEmpty()) { stringBuilder.AppendLine(this.bill.recipe.IngredientValueGetter.BillRequirementsDescription(this.bill.recipe, ingredientCount)); } } stringBuilder.AppendLine(); string text4 = this.bill.recipe.IngredientValueGetter.ExtraDescriptionLine(this.bill.recipe); if (text4 != null) { stringBuilder.AppendLine(text4); stringBuilder.AppendLine(); } if (!this.bill.recipe.skillRequirements.NullOrEmpty <SkillRequirement>()) { stringBuilder.AppendLine("MinimumSkills".Translate()); stringBuilder.AppendLine(this.bill.recipe.MinSkillString); } Text.Font = GameFont.Small; string text5 = stringBuilder.ToString(); if (Text.CalcHeight(text5, rect2.width) > rect2.height) { Text.Font = GameFont.Tiny; } listing_Standard6.Label(text5, -1f, null); Text.Font = GameFont.Small; listing_Standard6.End(); if (this.bill.recipe.products.Count == 1) { ThingDef thingDef = this.bill.recipe.products[0].thingDef; Widgets.InfoCardButton(rect2.x, rect4.y, thingDef, GenStuff.DefaultStuffFor(thingDef)); } }
private void DoLabel( ref Listing_Standard listing, string labelKey ) { var originalFont = Text.Font; var originalAnchor = Text.Anchor; var label = labelKey.Translate(); var rect = listing.GetRect( entrySize ); var labelHeight = Text.CalcHeight( label, rect.width ); if( labelHeight > entrySize ) { rect.height = labelHeight; listing.Gap( labelHeight - entrySize ); } Text.Font = fontCheckbox; Text.Anchor = TextAnchor.MiddleLeft; Widgets.Label( rect, label ); Text.Anchor = originalAnchor; Text.Font = originalFont; listing.Gap(); }
public static void DoWindowContents(Rect inRect) { dialogOpen = true; float padding = 15f; //float vertLimit = 0.75f; float footer = 60f; Rect leftSide = new Rect(inRect.x, inRect.y, (inRect.width - padding) / 2, inRect.height - footer); Vector2 rightStart = new Vector2(leftSide.max.x + padding, inRect.y); Rect rigthSide = new Rect(rightStart, leftSide.size); string resetBtnText = "Reset"; float resetBtnWidth = resetBtnText.GetWidthCached() * 2; Vector2 resetBtnPos = new Vector2((inRect.max.x - resetBtnWidth) / 2, inRect.max.y - footer); Vector2 resetBtnSize = new Vector2(resetBtnWidth, footer); Rect resetButtonRect = new Rect(resetBtnPos, resetBtnSize); Listing_Standard leftColumn = new Listing_Standard(); leftColumn.Begin(leftSide); //Outdoors need acceleration string label = $"{"IndoorsNoNaturalLightPenalty".Translate()}: {IndoorsNoNaturalLightPenalty.ToStringDecimalIfSmall()}x"; string desc = "IndoorsNoNaturalLightPenaltyDesc".Translate(); leftColumn.Label(label, -1f, desc); IndoorsNoNaturalLightPenalty = leftColumn.Slider(IndoorsNoNaturalLightPenalty, 1f, 10f); leftColumn.Gap(); //Light transmission through windows string labelNoteOnSkylights = (HarmonyPatcher.DubsSkylights || HarmonyPatcher.TransparentRoofs) ? $"\n({"LightTransmissionIncludesRoofs".Translate()})" : null; string label2 = $"{"LightTransmission".Translate()}: {LightTransmission.ToStringPercent()}{labelNoteOnSkylights}"; string desc2 = "LightTransmissionDesc".Translate(); leftColumn.Label(label2, -1f, desc2); LightTransmission = leftColumn.Slider(LightTransmission, 0f, 1f); leftColumn.Gap(); //Temperature comfort range for auto-ventilation string label3 = "ComfortableTemperature".Translate(); string desc3 = "ComfortableTemperatureDesc".Translate(); leftColumn.Label(label3, -1f, desc3); ValidateAndSetupComfortTemp(); leftColumn.IntRange(ref _comfortTemp, -40, 100); //Beauty sensitivity reduction if (IsBeautyOn) { leftColumn.Gap(); string label4 = $"{"BeautySensitivityReduction".Translate()}: {BeautySensitivityReduction.ToStringPercent()}"; string desc4 = "BeautySensitivityReductionDesc".Translate(); leftColumn.Label(label4, -1f, desc4); BeautySensitivityReduction = leftColumn.Slider(BeautySensitivityReduction, 0f, 1f); leftColumn.CheckboxLabeled("BeautyFromBuildings".Translate(), ref BeautyFromBuildings, "BeautyFromBuildingsDesc".Translate()); } leftColumn.End(); Listing_Standard rightColumn = new Listing_Standard(); //Wall link options rightColumn.Begin(rigthSide); rightColumn.Label($"{"LinkOptionsLabel".Translate()} ({"RequiresRestart".Translate()}):"); rightColumn.GapLine(); rightColumn.CheckboxLabeled("LinkWindowsAndWalls".Translate(), ref LinkWindows); if (LoadedModManager.RunningModsListForReading.Any(x => x.Name.Contains("RimFridge"))) { rightColumn.CheckboxLabeled("LinkFridgesAndWalls".Translate(), ref LinkVents); } else { rightColumn.CheckboxLabeled("LinkVentsAndWalls".Translate(), ref LinkVents); } //Better Pawn Control Alarm options if (HarmonyPatcher.BetterPawnControl) { rightColumn.Gap(); rightColumn.Label("AlarmOptionsLabel".Translate()); rightColumn.GapLine(); rightColumn.CheckboxLabeled("AlarmReactDefault".Translate(), ref AlarmReactDefault); } rightColumn.End(); Listing_Standard bottomBar = new Listing_Standard(); bottomBar.Begin(resetButtonRect); bottomBar.Gap(24f); if (bottomBar.ButtonText(resetBtnText, null)) { Reset(); } bottomBar.End(); dialogOpen = false; }
public virtual void DrawColumns( Listing_Standard listing, float physicalHeight, bool overridden = false ) { }
public void DrawBillGiverConfig(ref Listing_Standard listing) { listing.DoGap(); // workstation info listing.DoLabel("FMP.BillGivers".Translate()); listing.DoLabel("FMP.BillGiversCount".Translate(GetPotentialBillGivers.Count, GetAssignedBillGivers.Count)); string potentialString = String.Join("\n", GetPotentialBillGivers.Select(b => b.LabelCap).ToArray()); string assignedString = String.Join("\n", GetAssignedBillGivers.Select(b => b.LabelCap).ToArray()); string stationsTooltip = "FMP.BillGiversTooltip".Translate(potentialString, assignedString); // todo, fix that tooltip. Possible? // TooltipHandler.TipRegion(stations, stationsTooltip); // workstation selector if (listing.DoTextButton("FMP.BillGiversDetails".Translate())) { Find.WindowStack.Add(DetailsWindow); } }