public override void DoWindowContents(Rect inRect) { if (!checkedForBackup || !haveBackup) { Helper.Log("checking for backup"); MakeSureSaveExists(); return; } Listing_Standard ls = new Listing_Standard(); ls.Begin(inRect); ls.Label(storeIncident.label.CapitalizeFirst()); ls.Gap(); if (storeIncident.cost > 0) { storeIncident.abbreviation = ls.TextEntryLabeled("Purchase Code:", storeIncident.abbreviation); ls.Gap(); ls.AddLabeledNumericalTextField <int>("Cost", ref storeIncident.cost); ls.SliderLabeled("Max times per " + ToolkitSettings.EventCooldownInterval + " ingame day(s)", ref storeIncident.eventCap, storeIncident.eventCap.ToString(), 0, 15); if (variableIncident && storeIncidentVariables.maxWager > 0) { ls.Gap(); ls.SliderLabeled("Maximum coin wager", ref storeIncidentVariables.maxWager, storeIncidentVariables.cost.ToString(), storeIncident.cost, 20000f); } ls.Gap(); ls.AddLabeledRadioList("Karma Type", karmaTypeStrings, ref setKarmaType); storeIncident.karmaType = (KarmaType)Enum.Parse(typeof(KarmaType), setKarmaType); ls.Gap(); if (ls.ButtonTextLabeled("Disable Store Incident", "Disable")) { storeIncident.cost = -10; } } ls.Gap(); if (storeIncident.defName == "Item") { ls.SliderLabeled("Max times per " + ToolkitSettings.EventCooldownInterval + " ingame day(s)", ref storeIncident.eventCap, storeIncident.eventCap.ToString(), 0, 15); ls.Gap(); } if (storeIncident.defName != "Item" && ls.ButtonTextLabeled("Reset to Default", "Reset")) { Store_IncidentEditor.LoadBackup(storeIncident); if (storeIncident.cost < 1) { storeIncident.cost = 50; } MakeSureSaveExists(true); } if (storeIncident.defName == "Item" && ls.ButtonTextLabeled("Edit item prices", "Edit")) { Type type = typeof(StoreItemsWindow); Find.WindowStack.TryRemove(type); Window window = new StoreItemsWindow(); Find.WindowStack.Add(window); } ls.End(); }
/*private static void InitTexturePlant(ThingDef def, string pathPart, int val, bool immature, bool leafless) * { * if (val > 0 && def.plant != null) * { * string path = pathPart + "_V" + val; * def.graphicData.texPath = path; * if (immature) * { * Traverse.Create(def.plant).Field("immatureGraphicPath").SetValue(path + "_Immature"); * } * if (leafless) * { * Traverse.Create(def.plant).Field("leaflessGraphicPath").SetValue(path + "_Leafless"); * } * Traverse.Create(def.graphicData).Method("Init").GetValue(); * def.plant.PostLoadSpecial(def); * } * }*/ public void DoWindowContents(Rect rect) { Listing_Standard ls = new Listing_Standard(); ls.Begin(rect); ls.Gap(GapHeight); // Backup original values TextAnchor backupAnchor = Text.Anchor; Text.Anchor = TextAnchor.MiddleLeft; // Item - Meal if (ls.ButtonTextLabeled("CTP_Meal".Translate(), ("CTP_Meal_" + valueMeal).Translate())) { List <FloatMenuOption> menuEntries = new List <FloatMenuOption>(); menuEntries.Add(new FloatMenuOption(("CTP_Meal_0").Translate(), delegate { SetTexture(ThingDefOf.MealSimple, PathMealSimple); SetTexture(ThingDefOf.MealFine, PathMealFine); SetTexture(ThingDefOf.MealLavish, PathMealLavish); SetTexture(ThingDefOf.MealNutrientPaste, PathMealNutrientPaste); SetTexture(ThingDefOf.MealSurvivalPack, PathMealSurvivalPack); valueMeal = 0; })); menuEntries.Add(new FloatMenuOption(("CTP_Meal_1").Translate(), delegate { SetTexture(ThingDefOf.MealSimple, PathMealSimple + "_V1"); SetTexture(ThingDefOf.MealFine, PathMealFine + "_V1"); SetTexture(ThingDefOf.MealLavish, PathMealLavish + "_V1"); SetTexture(ThingDefOf.MealNutrientPaste, PathMealNutrientPaste + "_V1"); SetTexture(ThingDefOf.MealSurvivalPack, PathMealSurvivalPack + "_V1"); valueMeal = 1; })); menuEntries.Add(new FloatMenuOption(("CTP_Meal_2").Translate(), delegate { SetTexture(ThingDefOf.MealSimple, PathMealSimple + "_V2"); SetTexture(ThingDefOf.MealFine, PathMealFine + "_V2"); SetTexture(ThingDefOf.MealLavish, PathMealLavish + "_V2"); SetTexture(ThingDefOf.MealNutrientPaste, PathMealNutrientPaste + "_V2"); SetTexture(ThingDefOf.MealSurvivalPack, PathMealSurvivalPack + "_V2"); valueMeal = 2; })); Find.WindowStack.Add(new FloatMenu(menuEntries)); } ls.Gap(GapHeight); if (ls.ButtonTextLabeled("CTP_RawBerries".Translate(), ("CTP_RawBerries_" + valueRawBerries).Translate())) { List <FloatMenuOption> menuEntries = new List <FloatMenuOption>(); menuEntries.Add(new FloatMenuOption(("CTP_RawBerries_0").Translate(), delegate { SetTexture(ThingDefOf.RawBerries, PathRawBerries); valueRawBerries = 0; })); menuEntries.Add(new FloatMenuOption(("CTP_RawBerries_1").Translate(), delegate { SetTexture(ThingDefOf.RawBerries, PathRawBerries + "_V1"); valueRawBerries = 1; })); Find.WindowStack.Add(new FloatMenu(menuEntries)); } ls.GapGapLine(GapHeight); // Item - Resource if (ls.ButtonTextLabeled("CTP_Medicine".Translate(), ("CTP_Medicine_" + valueMedicine).Translate())) { List <FloatMenuOption> menuEntries = new List <FloatMenuOption>(); menuEntries.Add(new FloatMenuOption(("CTP_Medicine_0").Translate(), delegate { SetTexture(ThingDefOf.MedicineHerbal, PathMedicineHerbal); SetTexture(ThingDefOf.MedicineIndustrial, PathMedicineIndustrial); SetTexture(ThingDefOf.MedicineUltratech, PathMedicineUltratech); valueMedicine = 0; })); menuEntries.Add(new FloatMenuOption(("CTP_Medicine_1").Translate(), delegate { SetTexture(ThingDefOf.MedicineHerbal, PathMedicineHerbal + "_V1"); SetTexture(ThingDefOf.MedicineIndustrial, PathMedicineIndustrial + "_V1"); SetTexture(ThingDefOf.MedicineUltratech, PathMedicineUltratech + "_V1"); valueMedicine = 1; })); menuEntries.Add(new FloatMenuOption(("CTP_Medicine_2").Translate(), delegate { SetTexture(ThingDefOf.MedicineHerbal, PathMedicineHerbal + "_V2"); SetTexture(ThingDefOf.MedicineIndustrial, PathMedicineIndustrial + "_V2"); SetTexture(ThingDefOf.MedicineUltratech, PathMedicineUltratech + "_V2"); valueMedicine = 2; })); menuEntries.Add(new FloatMenuOption(("CTP_Medicine_3").Translate(), delegate { SetTexture(ThingDefOf.MedicineHerbal, PathMedicineHerbal + "_V3"); SetTexture(ThingDefOf.MedicineIndustrial, PathMedicineIndustrial + "_V3"); SetTexture(ThingDefOf.MedicineUltratech, PathMedicineUltratech + "_V3"); valueMedicine = 3; })); Find.WindowStack.Add(new FloatMenu(menuEntries)); } ls.Gap(GapHeight); if (ls.ButtonTextLabeled("CTP_Silver".Translate(), ("CTP_Silver_" + valueSilver).Translate())) { List <FloatMenuOption> menuEntries = new List <FloatMenuOption>(); menuEntries.Add(new FloatMenuOption(("CTP_Silver_0").Translate(), delegate { SetTexture(ThingDefOf.Silver, PathSilver); valueSilver = 0; })); menuEntries.Add(new FloatMenuOption(("CTP_Silver_1").Translate(), delegate { SetTexture(ThingDefOf.Silver, PathSilver + "_V1"); valueSilver = 1; })); menuEntries.Add(new FloatMenuOption(("CTP_Silver_2").Translate(), delegate { SetTexture(ThingDefOf.Silver, PathSilver + "_V2"); valueSilver = 2; })); Find.WindowStack.Add(new FloatMenu(menuEntries)); } ls.Gap(GapHeight); if (ls.ButtonTextLabeled("CTP_Gold".Translate(), ("CTP_Gold_" + valueGold).Translate())) { List <FloatMenuOption> menuEntries = new List <FloatMenuOption>(); menuEntries.Add(new FloatMenuOption(("CTP_Gold_0").Translate(), delegate { SetTexture(ThingDefOf.Gold, PathGold); valueGold = 0; })); menuEntries.Add(new FloatMenuOption(("CTP_Gold_1").Translate(), delegate { SetTexture(ThingDefOf.Gold, PathGold + "_V1"); valueGold = 1; })); Find.WindowStack.Add(new FloatMenu(menuEntries)); } ls.GapGapLine(GapHeight); // Plant if (ls.ButtonTextLabeled("CTP_PlantBerry".Translate(), ("CTP_PlantBerry_" + valuePlantBerry).Translate())) { List <FloatMenuOption> menuEntries = new List <FloatMenuOption>(); menuEntries.Add(new FloatMenuOption(("CTP_PlantBerry_0").Translate(), delegate { SetTexture(ThingDefOf.Plant_Berry, PathPlantBerry); valuePlantBerry = 0; })); menuEntries.Add(new FloatMenuOption(("CTP_PlantBerry_1").Translate(), delegate { SetTexture(ThingDefOf.Plant_Berry, PathPlantBerry + "_V1"); valuePlantBerry = 1; })); Find.WindowStack.Add(new FloatMenu(menuEntries)); } ls.Gap(GapHeight); if (ls.ButtonTextLabeled("CTP_PlantHealroot".Translate(), ("CTP_PlantHealroot_" + valuePlantHealroot).Translate())) { List <FloatMenuOption> menuEntries = new List <FloatMenuOption>(); menuEntries.Add(new FloatMenuOption(("CTP_PlantHealroot_0").Translate(), delegate { SetTexture(ThingDefOf.Plant_Healroot, PathPlantHealroot); SetTexture(ThingDefOf.Plant_HealrootWild, PathPlantHealroot); valuePlantHealroot = 0; })); menuEntries.Add(new FloatMenuOption(("CTP_PlantHealroot_1").Translate(), delegate { SetTexture(ThingDefOf.Plant_Healroot, PathPlantHealroot + "_V1"); SetTexture(ThingDefOf.Plant_HealrootWild, PathPlantHealroot + "_V1"); valuePlantHealroot = 1; })); Find.WindowStack.Add(new FloatMenu(menuEntries)); } // Restore original values Text.Anchor = backupAnchor; ls.End(); }
public override void DoWindowContents(Rect inRect) { Rect rect = inRect.AtZero(); rect.yMax -= 35f; 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()); Text.Font = GameFont.Small; listing_Standard.Gap(); listing_Standard.Gap(); listing_Standard.Label("GameVolume".Translate()); Prefs.VolumeGame = listing_Standard.Slider(Prefs.VolumeGame, 0f, 1f); listing_Standard.Label("MusicVolume".Translate()); Prefs.VolumeMusic = listing_Standard.Slider(Prefs.VolumeMusic, 0f, 1f); listing_Standard.Label("AmbientVolume".Translate()); Prefs.VolumeAmbient = listing_Standard.Slider(Prefs.VolumeAmbient, 0f, 1f); if (listing_Standard.ButtonTextLabeled("Resolution".Translate(), ResToString(Screen.width, Screen.height))) { List <FloatMenuOption> list = new List <FloatMenuOption>(); foreach (Resolution item in from x in UnityGUIBugsFixer.ScreenResolutionsWithoutDuplicates where x.width >= 1024 && x.height >= 768 orderby x.width, x.height select x) { list.Add(new FloatMenuOption(ResToString(item.width, item.height), delegate { if (!ResolutionUtility.UIScaleSafeWithResolution(Prefs.UIScale, item.width, item.height)) { Messages.Message("MessageScreenResTooSmallForUIScale".Translate(), MessageTypeDefOf.RejectInput, historical: false); } else { ResolutionUtility.SafeSetResolution(item); } })); } if (!list.Any()) { list.Add(new FloatMenuOption("NoneBrackets".Translate(), null)); } Find.WindowStack.Add(new FloatMenu(list)); } if (listing_Standard.ButtonTextLabeled("UIScale".Translate(), Prefs.UIScale.ToString() + "x")) { List <FloatMenuOption> list2 = new List <FloatMenuOption>(); for (int i = 0; i < UIScales.Length; i++) { float scale = UIScales[i]; list2.Add(new FloatMenuOption(UIScales[i].ToString() + "x", delegate { if (scale != 1f && !ResolutionUtility.UIScaleSafeWithResolution(scale, Screen.width, Screen.height)) { Messages.Message("MessageScreenResTooSmallForUIScale".Translate(), MessageTypeDefOf.RejectInput, historical: false); } else { ResolutionUtility.SafeSetUIScale(scale); } })); } Find.WindowStack.Add(new FloatMenu(list2)); } bool checkOn = Prefs.CustomCursorEnabled; listing_Standard.CheckboxLabeled("CustomCursor".Translate(), ref checkOn); Prefs.CustomCursorEnabled = checkOn; bool checkOn2 = Screen.fullScreen; bool flag = checkOn2; listing_Standard.CheckboxLabeled("Fullscreen".Translate(), ref checkOn2); if (checkOn2 != flag) { ResolutionUtility.SafeSetFullscreen(checkOn2); } listing_Standard.Gap(); bool checkOn3 = Prefs.HatsOnlyOnMap; listing_Standard.CheckboxLabeled("HatsShownOnlyOnMap".Translate(), ref checkOn3); if (checkOn3 != Prefs.HatsOnlyOnMap) { PortraitsCache.Clear(); } Prefs.HatsOnlyOnMap = checkOn3; bool checkOn4 = Prefs.PlantWindSway; listing_Standard.CheckboxLabeled("PlantWindSway".Translate(), ref checkOn4); Prefs.PlantWindSway = checkOn4; bool checkOn5 = Prefs.ShowRealtimeClock; listing_Standard.CheckboxLabeled("ShowRealtimeClock".Translate(), ref checkOn5); Prefs.ShowRealtimeClock = checkOn5; if (listing_Standard.ButtonTextLabeled("ShowAnimalNames".Translate(), Prefs.AnimalNameMode.ToStringHuman())) { List <FloatMenuOption> list3 = new List <FloatMenuOption>(); IEnumerator enumerator2 = Enum.GetValues(typeof(AnimalNameDisplayMode)).GetEnumerator(); try { while (enumerator2.MoveNext()) { AnimalNameDisplayMode animalNameDisplayMode = (AnimalNameDisplayMode)enumerator2.Current; AnimalNameDisplayMode localMode = animalNameDisplayMode; list3.Add(new FloatMenuOption(localMode.ToStringHuman(), delegate { Prefs.AnimalNameMode = localMode; })); } } finally { IDisposable disposable; if ((disposable = (enumerator2 as IDisposable)) != null) { disposable.Dispose(); } } Find.WindowStack.Add(new FloatMenu(list3)); } listing_Standard.NewColumn(); Text.Font = GameFont.Medium; listing_Standard.Label("Gameplay".Translate()); Text.Font = GameFont.Small; listing_Standard.Gap(); listing_Standard.Gap(); if (listing_Standard.ButtonText("KeyboardConfig".Translate())) { Find.WindowStack.Add(new Dialog_KeyBindings()); } if (listing_Standard.ButtonText("ChooseLanguage".Translate())) { if (Current.ProgramState == ProgramState.Playing) { Messages.Message("ChangeLanguageFromMainMenu".Translate(), MessageTypeDefOf.RejectInput, historical: false); } else { List <FloatMenuOption> list4 = new List <FloatMenuOption>(); foreach (LoadedLanguage allLoadedLanguage in LanguageDatabase.AllLoadedLanguages) { LoadedLanguage localLang = allLoadedLanguage; list4.Add(new FloatMenuOption(localLang.FriendlyNameNative, delegate { LanguageDatabase.SelectLanguage(localLang); })); } Find.WindowStack.Add(new FloatMenu(list4)); } } if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor) { if (listing_Standard.ButtonText("OpenSaveGameDataFolder".Translate())) { Application.OpenURL(GenFilePaths.SaveDataFolderPath); } } else if (listing_Standard.ButtonText("ShowSaveGameDataLocation".Translate())) { Find.WindowStack.Add(new Dialog_MessageBox(Path.GetFullPath(GenFilePaths.SaveDataFolderPath))); } if (listing_Standard.ButtonText("ResetAdaptiveTutor".Translate())) { Messages.Message("AdaptiveTutorIsReset".Translate(), MessageTypeDefOf.TaskCompletion, historical: false); PlayerKnowledgeDatabase.ResetPersistent(); } bool checkOn6 = Prefs.AdaptiveTrainingEnabled; listing_Standard.CheckboxLabeled("LearningHelper".Translate(), ref checkOn6); Prefs.AdaptiveTrainingEnabled = checkOn6; bool checkOn7 = Prefs.RunInBackground; listing_Standard.CheckboxLabeled("RunInBackground".Translate(), ref checkOn7); Prefs.RunInBackground = checkOn7; bool checkOn8 = Prefs.EdgeScreenScroll; listing_Standard.CheckboxLabeled("EdgeScreenScroll".Translate(), ref checkOn8); Prefs.EdgeScreenScroll = checkOn8; bool checkOn9 = Prefs.PauseOnLoad; listing_Standard.CheckboxLabeled("PauseOnLoad".Translate(), ref checkOn9); Prefs.PauseOnLoad = checkOn9; bool checkOn10 = Prefs.PauseOnUrgentLetter; listing_Standard.CheckboxLabeled("PauseOnUrgentLetter".Translate(), ref checkOn10); Prefs.PauseOnUrgentLetter = checkOn10; int maxNumberOfPlayerSettlements = Prefs.MaxNumberOfPlayerSettlements; listing_Standard.Label("MaxNumberOfPlayerSettlements".Translate(maxNumberOfPlayerSettlements)); int num2 = Prefs.MaxNumberOfPlayerSettlements = Mathf.RoundToInt(listing_Standard.Slider((float)maxNumberOfPlayerSettlements, 1f, 5f)); if (maxNumberOfPlayerSettlements != num2 && num2 > 1) { TutorUtility.DoModalDialogIfNotKnown(ConceptDefOf.MaxNumberOfPlayerSettlements); } if (listing_Standard.ButtonTextLabeled("TemperatureMode".Translate(), Prefs.TemperatureMode.ToStringHuman())) { List <FloatMenuOption> list5 = new List <FloatMenuOption>(); IEnumerator enumerator4 = Enum.GetValues(typeof(TemperatureDisplayMode)).GetEnumerator(); try { while (enumerator4.MoveNext()) { TemperatureDisplayMode temperatureDisplayMode = (TemperatureDisplayMode)enumerator4.Current; TemperatureDisplayMode localTmode = temperatureDisplayMode; list5.Add(new FloatMenuOption(localTmode.ToString(), delegate { Prefs.TemperatureMode = localTmode; })); } } finally { IDisposable disposable2; if ((disposable2 = (enumerator4 as IDisposable)) != null) { disposable2.Dispose(); } } Find.WindowStack.Add(new FloatMenu(list5)); } 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> list6 = new List <FloatMenuOption>(); if (Prefs.DevMode) { list6.Add(new FloatMenuOption("0.125 " + text + "(debug)", delegate { Prefs.AutosaveIntervalDays = 0.125f; })); list6.Add(new FloatMenuOption("0.25 " + text + "(debug)", delegate { Prefs.AutosaveIntervalDays = 0.25f; })); } list6.Add(new FloatMenuOption("0.5 " + text + string.Empty, delegate { Prefs.AutosaveIntervalDays = 0.5f; })); list6.Add(new FloatMenuOption(1.ToString() + " " + text2, delegate { Prefs.AutosaveIntervalDays = 1f; })); list6.Add(new FloatMenuOption(3.ToString() + " " + text, delegate { Prefs.AutosaveIntervalDays = 3f; })); list6.Add(new FloatMenuOption(7.ToString() + " " + text, delegate { Prefs.AutosaveIntervalDays = 7f; })); list6.Add(new FloatMenuOption(14.ToString() + " " + text, delegate { Prefs.AutosaveIntervalDays = 14f; })); Find.WindowStack.Add(new FloatMenu(list6)); } if (Current.ProgramState == ProgramState.Playing && Current.Game.Info.permadeathMode && Prefs.AutosaveIntervalDays > 1f) { GUI.color = Color.red; listing_Standard.Label("MaxPermadeathAutosaveIntervalInfo".Translate(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 (!DevModePermanentlyDisabledUtility.Disabled && listing_Standard.ButtonText("PermanentlyDisableDevMode".Translate())) { Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmPermanentlyDisableDevMode".Translate(), delegate { DevModePermanentlyDisabledUtility.Disable(); }, destructive: true)); } if (!DevModePermanentlyDisabledUtility.Disabled || Prefs.DevMode) { bool checkOn11 = Prefs.DevMode; listing_Standard.CheckboxLabeled("DevelopmentMode".Translate(), ref checkOn11); Prefs.DevMode = checkOn11; } bool checkOn12 = Prefs.TestMapSizes; listing_Standard.CheckboxLabeled("EnableTestMapSizes".Translate(), ref checkOn12); Prefs.TestMapSizes = checkOn12; if (Prefs.DevMode) { bool checkOn13 = Prefs.ResetModsConfigOnCrash; listing_Standard.CheckboxLabeled("ResetModsConfigOnCrash".Translate(), ref checkOn13); Prefs.ResetModsConfigOnCrash = checkOn13; bool checkOn14 = Prefs.LogVerbose; listing_Standard.CheckboxLabeled("LogVerbose".Translate(), ref checkOn14); Prefs.LogVerbose = checkOn14; } listing_Standard.NewColumn(); Text.Font = GameFont.Medium; listing_Standard.Label(string.Empty); Text.Font = GameFont.Small; listing_Standard.Gap(); listing_Standard.Gap(); if (listing_Standard.ButtonText("ModSettings".Translate())) { Find.WindowStack.Add(new Dialog_ModSettings()); } listing_Standard.Label(string.Empty); listing_Standard.Label("NamesYouWantToSee".Translate()); Prefs.PreferredNames.RemoveAll(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(); if (pawnBio != null) { switch (pawnBio.BioType) { case PawnBioType.BackstoryInGame: name += " [B]"; break; case PawnBioType.PirateKing: name += " [PK]"; break; } } else { name += " [N]"; } 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, Color.white, GenUI.SubtleMouseoverColor)) { Prefs.PreferredNames.RemoveAt(j); SoundDefOf.Tick_Low.PlayOneShotOnCamera(); } } if (Prefs.PreferredNames.Count < 6 && listing_Standard.ButtonText("AddName".Translate() + "...")) { Find.WindowStack.Add(new Dialog_AddPreferredName()); } listing_Standard.Label(string.Empty); if (listing_Standard.ButtonText("RestoreToDefaultSettings".Translate())) { RestoreToDefaultSettings(); } listing_Standard.End(); }
public static void DrawGeneralCard(Rect rect) { Listing_Standard listing = new Listing_Standard(); listing.Begin(rect); listing.Label("ZMD_generalTabInfo".Translate()); listing.GapLine(); listing.CheckboxLabeled("ZMD_flagHomeMapOnly".Translate(), ref MapDesignerSettings.flagHomeMapOnly, "ZMD_flagHomeMapOnlyDesc".Translate()); listing.GapLine(); #region presets Rect selPresetRect = listing.GetRect(40f); Rect selButtonRect = selPresetRect; Rect descRect = selPresetRect; selButtonRect.xMax -= 0.66f * rect.width; descRect.xMin += 20f + 0.34f * rect.width; Widgets.Label(descRect, (GetPresetLabel() + "Desc").Translate()); Listing_Standard listing_selPreset = new Listing_Standard(); listing_selPreset.Begin(selButtonRect); // preset selection if (listing_selPreset.ButtonTextLabeled("ZMD_presets".Translate(), GetPresetLabel().Translate())) { List <FloatMenuOption> presetList = new List <FloatMenuOption>(); presetList.Add(new FloatMenuOption("ZMD_presetVanilla".Translate(), delegate { selPreset = Preset.Vanilla; })); presetList.Add(new FloatMenuOption("ZMD_presetFertileValley".Translate(), delegate { selPreset = Preset.FertileValley; })); presetList.Add(new FloatMenuOption("ZMD_presetBarrens".Translate(), delegate { selPreset = Preset.Barrens; })); presetList.Add(new FloatMenuOption("ZMD_presetUnnatural".Translate(), delegate { selPreset = Preset.Unnatural; })); presetList.Add(new FloatMenuOption("ZMD_presetFishingVillage".Translate(), delegate { selPreset = Preset.FishingVillage; })); presetList.Add(new FloatMenuOption("ZMD_presetCanyon".Translate(), delegate { selPreset = Preset.Canyon; })); presetList.Add(new FloatMenuOption("ZMD_presetZyllesChoice".Translate(), delegate { selPreset = Preset.ZyllesChoice; })); presetList.Add(new FloatMenuOption("ZMD_presetRandom".Translate(), delegate { selPreset = Preset.Random; })); Find.WindowStack.Add(new FloatMenu(presetList)); } listing_selPreset.End(); listing.GapLine(); if (listing.ButtonText("ZMD_applyPreset".Translate())) { SoundDefOf.Click.PlayOneShotOnCamera(null); ApplyPreset(); } #endregion listing.GapLine(); if (listing.ButtonText("ZMD_reset".Translate())) { SoundDefOf.Click.PlayOneShotOnCamera(null); ResetAllSettings(); } listing.End(); }
public override void DoWindowContents(Rect inRect) { Listing_Standard listing = new Listing_Standard(); listing.Begin(inRect); Text.Font = GameFont.Medium; listing.Label("Storyteller Packs"); Text.Font = GameFont.Small; listing.GapLine(); listing.Label("StorytellerPacks are packs of different types of votes. They each have their own settings, can be activated at the same time, and can be activated alongside normal storytellers."); listing.GapLine(); listing.Label("All storyteller packs will consider the global weights when choosing which votes to use. A weight of 0 would never be picked, meaning it is disabled."); listing.Gap(); if (listing.ButtonTextLabeled("Edit Global Vote Weights", "Edit Weights")) { Window_GlobalVoteWeights window = new Window_GlobalVoteWeights(); Find.WindowStack.TryRemove(window.GetType()); Find.WindowStack.Add(window); } listing.Gap(); listing.GapLine(); listing.Label("Enabled Storyteller Packs"); listing.Gap(24); listing.ColumnWidth = (inRect.width / 2f) - 20f; listing.CheckboxLabeled("<color=#6441A4>Torytalker</color> - Classic / Most Balanced", ref ToolkitSettings.ToryTalkerEnabled); listing.Gap(); if (listing.ButtonTextLabeled("ToryTalker Pack", "View")) { Window_ToryTalkerSettings window = new Window_ToryTalkerSettings(); Find.WindowStack.TryRemove(window.GetType()); Find.WindowStack.Add(window); } listing.Gap(24); listing.CheckboxLabeled("<color=#4BB543>HodlBot</color> - Random by Category / Type", ref ToolkitSettings.HodlBotEnabled); listing.Gap(); if (listing.ButtonTextLabeled("HodlBot Pack", "View")) { Window_HodlBotSettings window = new Window_HodlBotSettings(); Find.WindowStack.TryRemove(window.GetType()); Find.WindowStack.Add(window); } listing.Gap(24); listing.CheckboxLabeled("<color=#CF0E0F>UristBot</color> - Raids Strategies / Diseases", ref ToolkitSettings.UristBotEnabled); listing.Gap(); if (listing.ButtonTextLabeled("UristBot Pack", "View")) { Window_UristBotSettings window = new Window_UristBotSettings(); Find.WindowStack.TryRemove(window.GetType()); Find.WindowStack.Add(window); } listing.Gap(24); listing.CheckboxLabeled("<color=#1482CB>Milasandra</color> - Threats OnOffCycle", ref ToolkitSettings.MilasandraEnabled); listing.Gap(); if (listing.ButtonTextLabeled("Milasandra Pack", "View")) { Window_Milasandra window = new Window_Milasandra(); Find.WindowStack.TryRemove(window.GetType()); Find.WindowStack.Add(window); } listing.NewColumn(); listing.Gap(200f); listing.CheckboxLabeled("<color=#BF0030>Mercurius</color> - Misc Events Cycle", ref ToolkitSettings.MercuriusEnabled); listing.Gap(); if (listing.ButtonTextLabeled("Mercurius Pack", "View")) { Window_Mercurius window = new Window_Mercurius(); Find.WindowStack.TryRemove(window.GetType()); Find.WindowStack.Add(window); } listing.End(); }
public override void DoWindowContents(Rect inRect) { Rect rect = inRect.AtZero(); rect.yMax -= 45f; Listing_Standard listing_Standard = new Listing_Standard(); listing_Standard.ColumnWidth = (float)((rect.width - 34.0) / 3.0); 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 allLoadedLanguage in LanguageDatabase.AllLoadedLanguages) { LoadedLanguage localLang = allLoadedLanguage; 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(maxNumberOfPlayerHomes), -1f); int num3 = Prefs.MaxNumberOfPlayerHomes = Mathf.RoundToInt(listing_Standard.Slider((float)maxNumberOfPlayerHomes, 1f, 5f)); if (maxNumberOfPlayerHomes != num3 && num3 > 1) { TutorUtility.DoModalDialogIfNotKnown(ConceptDefOf.MaxNumberOfPlayerHomes); } if (listing_Standard.ButtonTextLabeled("TemperatureMode".Translate(), Prefs.TemperatureMode.ToStringHuman())) { List <FloatMenuOption> list2 = new List <FloatMenuOption>(); IEnumerator enumerator2 = Enum.GetValues(typeof(TemperatureDisplayMode)).GetEnumerator(); try { while (enumerator2.MoveNext()) { TemperatureDisplayMode temperatureDisplayMode = (TemperatureDisplayMode)enumerator2.Current; TemperatureDisplayMode localTmode = temperatureDisplayMode; list2.Add(new FloatMenuOption(localTmode.ToString(), delegate { Prefs.TemperatureMode = localTmode; }, MenuOptionPriority.Default, null, null, 0f, null, null)); } } finally { IDisposable disposable; if ((disposable = (enumerator2 as IDisposable)) != null) { disposable.Dispose(); } } 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 != 1.0) ? 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 > 1.0) { GUI.color = Color.red; listing_Standard.Label("MaxPermadeathAutosaveIntervalInfo".Translate(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>(); IEnumerator enumerator3 = Enum.GetValues(typeof(AnimalNameDisplayMode)).GetEnumerator(); try { while (enumerator3.MoveNext()) { AnimalNameDisplayMode animalNameDisplayMode = (AnimalNameDisplayMode)enumerator3.Current; AnimalNameDisplayMode localMode = animalNameDisplayMode; list4.Add(new FloatMenuOption(localMode.ToStringHuman(), delegate { Prefs.AnimalNameMode = localMode; }, MenuOptionPriority.Default, null, null, 0f, null, null)); } } finally { IDisposable disposable2; if ((disposable2 = (enumerator3 as IDisposable)) != null) { disposable2.Dispose(); } } 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(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(); if (pawnBio == null) { name += " [N]"; } else { switch (pawnBio.BioType) { case PawnBioType.BackstoryInGame: name += " [B]"; break; case PawnBioType.PirateKing: name += " [PK]"; break; } } Rect rect2 = listing_Standard.GetRect(24f); Widgets.Label(rect2, name); Rect butRect = new Rect((float)(rect2.xMax - 24.0), 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(); }
// NOTE: They removed Listing_Standard's scroll views in 1.3 :p //private static Rect viewRect=new Rect(0,0,100f,10000f); // OMG OMG OMG I got scrollView in Listing_Standard to work! public static void DoSettingsWindowContents(Rect inRect) { ModMetaData tmpMod; Color origColor = GUI.color; // make option gray if ignored Rect outerRect = inRect.ContractedBy(10f); Widgets.DrawHighlight(outerRect); // We put a scrollbar around a listing_standard; it seems to work okay bool scrollBarVisible = totalContentHeight > outerRect.height; var scrollViewTotal = new Rect(0f, 0f, outerRect.width - (scrollBarVisible ? ScrollBarWidthMargin : 0), totalContentHeight); Widgets.BeginScrollView(outerRect, ref scrollPosition, scrollViewTotal); Listing_Standard l = new Listing_Standard(GameFont.Medium); // my tiny high-resolution monitor :p l.Begin(new Rect(0f, 0f, scrollViewTotal.width, 9999f)); // Some RW window does this "9999f" thing, & it seems to work? //l.GapLine(); // Who can haul to Deep Storage (robots, animals, etc) l.Label("LWMDShaulToStorageExplanation".Translate()); l.CheckboxLabeled("LWMDSrobotsCanUse".Translate(), ref robotsCanUse, "LWMDSrobotsCanUseDesc".Translate()); string [] intLabels = { "LWM_DS_Int_Animal".Translate(), "LWM_DS_Int_ToolUser".Translate(), "LWM_DS_Int_Humanlike".Translate(), }; // Setting to allow bionic racoons to haul to Deep Storage: l.EnumRadioButton <Intelligence>(ref Patch_IsGoodStoreCell.NecessaryIntelligenceToUseDeepStorage, "LWM_DS_IntTitle".Translate(), "LWM_DS_IntDesc".Translate(), false, intLabels); l.GapLine(); //Storing Delay Settings l.Label("LWMDSstoringDelaySettings".Translate()); l.Label("LWMDSstoringDelayExplanation".Translate()); l.CheckboxLabeled("LWMDSstoringTakesTimeLabel".Translate(), ref storingTakesTime, "LWMDSstoringTakesTimeDesc".Translate()); l.Label("LWMDSstoringGlobalScale".Translate((storingGlobalScale * 100f).ToString("0."))); storingGlobalScale = l.Slider(storingGlobalScale, 0f, 2f); l.CheckboxLabeled("LWMDSstoringTimeConsidersStackSize".Translate(), ref storingTimeConsidersStackSize, "LWMDSstoringTimeConsidersStackSizeDesc".Translate()); // Reset storing delay settings to defaults if (l.ButtonText("LWMDSstoringDelaySettings".Translate() + ": " + "ResetBinding".Translate() /*Reset to Default*/)) { storingTakesTime = true; storingGlobalScale = 1f; storingTimeConsidersStackSize = true; } l.GapLine(); // default Storing Priority if (l.ButtonTextLabeled("LWM_DS_defaultStoragePriority".Translate(), defaultStoragePriority.Label())) { List <FloatMenuOption> mlist = new List <FloatMenuOption>(); foreach (StoragePriority p in Enum.GetValues(typeof(StoragePriority))) { mlist.Add(new FloatMenuOption(p.Label(), delegate() { defaultStoragePriority = p; foreach (ThingDef d in AllDeepStorageUnits) { d.building.defaultStorageSettings.Priority = p; } })); } Find.WindowStack.Add(new FloatMenu(mlist)); } l.GapLine(); l.Label("LWM_DS_userInterface".Translate()); l.CheckboxLabeled("LWM_DS_useEjectButton".Translate(), ref useEjectButton, "LWM_DS_useEjectButtonDesc".Translate()); //TODO:: if ((tmpMod = ModLister.GetActiveModWithIdentifier("netrve.dsgui")) != null) { GUI.color = Color.gray; l.Label("LWMDSignoredDueTo".Translate(tmpMod.Name)); } l.CheckboxLabeled("LWM_DS_useDSRightClick".Translate(), ref useDeepStorageRightClickLogic, "LWM_DS_useDSRightClickDesc".Translate()); // Architect Menu: l.GapLine(); //Architect Menu location GUI.color = origColor; /* * // string archLabel= * // if (archLabel==n * // l.Label("LWMDSarchitectMenuSettings".Translate()); * if (architectMenuDesigCatDef==architectMenuDefaultDesigCatDef) { * // if (architectLWM_DS_Storage_DesignationCatDef==null) { * // Log.Error("LWM.DeepStorage: architectLWM_DS_Storage_DesignationCatDef was null; this should never happen."); * // tmp="ERROR"; * // } else { * // tmp=architectCurrentDesignationCatDef.LabelCap; // todo: (default) * // } * archLabel+=" ("+ * } else { * var x=DefDatabase<DesignationCategoryDef>.GetNamed(architectMenuDesignationCatDefDefName, false); * if (x==null) { * // TODO * } * tmp=x.LabelCap; // todo: (<menuname>) * }*/ if (l.ButtonTextLabeled((architectMenuDefaultDesigCatDef + "_ArchitectMenuSettings").Translate(), // Label // value of dropdown button: DefDatabase <DesignationCategoryDef> .GetNamed(architectMenuDesigCatDef)?.LabelCap ?? "--ERROR--")) // error display text // , DefDatabase<DesigarchitectMenuDesigCatDef) ) { // Float menu for architect Menu choice: { List <FloatMenuOption> alist = new List <FloatMenuOption>(); var arl = DefDatabase <DesignationCategoryDef> .AllDefsListForReading; //all reading list //oops: // alist.Add(new FloatMenuOption(DefDatabase<DesignationCategoryDef>.GetNamed(architectMenuDefaultDesigCatDef).LabelCap alist.Add(new FloatMenuOption(architectMenuActualDef.LabelCap + " (" + "default".Translate() + " - " + architectMenuActualDef.defName + ")", delegate() { Utils.Mess(Utils.DBF.Settings, "Architect Menu placement set to default Storage"); ArchitectMenu_ChangeLocation(architectMenuDefaultDesigCatDef); // architectCurrentDesignationCatDef=architectLWM_DS_Storage_DesignationCatDef; // architectMenuDesignationCatDefDefName="LWM_DS_Storage"; // // SettingsChanged(); }, MenuOptionPriority.Default, null, null, 0f, null, null)); // Architect Menu: You may remove the "Furniture" references here if you wish alist.Add(new FloatMenuOption(DefDatabase <DesignationCategoryDef> .GetNamed("Furniture").LabelCap + " (Furniture)", // I know what this one's defName is! delegate() { Utils.Mess(Utils.DBF.Settings, "Architect Menu placement set to Furniture."); ArchitectMenu_ChangeLocation("Furniture"); }, MenuOptionPriority.Default, null, null, 0f, null, null)); foreach (var adcd in arl) //architect designation cat def { if (adcd.defName != architectMenuDefaultDesigCatDef && adcd.defName != "Furniture") { alist.Add(new FloatMenuOption(adcd.LabelCap + " (" + adcd.defName + ")", delegate() { Utils.Mess(Utils.DBF.Settings, "Architect Menu placement set to " + adcd); ArchitectMenu_ChangeLocation(adcd.defName); }, MenuOptionPriority.Default, null, null, 0f, null, null)); } } Find.WindowStack.Add(new FloatMenu(alist)); } l.CheckboxLabeled((architectMenuDefaultDesigCatDef + "_ArchitectMenuAlwaysShowCategory").Translate(), ref architectMenuAlwaysShowCategory, (architectMenuDefaultDesigCatDef + "_ArchitectMenuAlwaysShowDesc").Translate()); // Do we always display? If so, display: if (architectMenuAlwaysShowCategory != architectMenuAlwaysShowTmp) { if (architectMenuAlwaysShowCategory) { ArchitectMenu_Show(); } else if (architectMenuDesigCatDef != architectMenuDefaultDesigCatDef) { ArchitectMenu_Hide(); } architectMenuAlwaysShowTmp = architectMenuAlwaysShowCategory; } l.CheckboxLabeled((architectMenuDefaultDesigCatDef + "_ArchitectMenuMoveALL").Translate(), ref architectMenuMoveALLStorageItems, (architectMenuDefaultDesigCatDef + "_ArchitectMenuMoveALLDesc").Translate()); if (architectMenuMoveALLStorageItems != architectMenuMoveALLTmp) { // If turning off "all things in Storage", make sure to // dump all the items into Furniture, to make sure they // can at least be found somewhere. string ctmp = architectMenuDesigCatDef; if (architectMenuMoveALLStorageItems == false) { architectMenuMoveALLStorageItems = true; ArchitectMenu_ChangeLocation("Furniture"); architectMenuMoveALLStorageItems = false; } ArchitectMenu_ChangeLocation(ctmp); architectMenuMoveALLTmp = architectMenuMoveALLStorageItems; } // finished drawing settings for Architect Menu // ------------------- // Allow player to turn of Over-Capacity check. // Turn it off automatically for Project RimFactory and Extended Storage // Note: should turn it off automatically for any other storage mods, too l.GapLine(); tmpMod = ModLister.GetActiveModWithIdentifier("spdskatr.projectrimfactory") ?? ModLister.GetActiveModWithIdentifier("zymex.prf.lite") ?? ModLister.GetActiveModWithIdentifier("Skullywag.ExtendedStorage"); if (tmpMod != null) { GUI.color = Color.gray; // This setting is disabled due to mod [Extended Storage, etc] l.Label("LWMDSignoredDueTo".Translate(tmpMod.Name)); } l.CheckboxLabeled("LWMDSoverCapacityCheck".Translate(), ref checkOverCapacity, "LWMDSoverCapacityCheckDesc".Translate()); GUI.color = origColor; // Per DSU settings - let players change them around... l.GapLine(); if (allowPerDSUSettings) { if (l.ButtonText("LWMDSperDSUSettings".Translate())) { Find.WindowStack.Add(new Dialog_DS_Settings()); } } else { l.CheckboxLabeled("LWMDSperDSUturnOn".Translate(), ref allowPerDSUSettings, "LWMDSperDSUturnOnDesc".Translate()); } l.GapLine(); // End. Finis. Looks pretty having a line at the end. totalContentHeight = l.CurHeight + 10f; l.End(); Widgets.EndScrollView(); }
public override void DoWindowContents(Rect inRect) { Listing_Standard listing = new Listing_Standard(); listing.Begin(inRect); Text.Font = GameFont.Medium; listing.Label("<color=#4BB543>HodlBot</color> Settings"); Text.Font = GameFont.Small; listing.Gap(); listing.GapLine(); listing.Label("HodlBot chooses events from a random category or type. The chance of one of these categories/types being picked is based on weights below. Setting to 0% disables it."); listing.Gap(); string hodlbotMTBDays = Math.Truncate(((double)ToolkitSettings.HodlBotMTBDays * 100) / 100).ToString(); listing.TextFieldNumericLabeled <float>("Average Days Between Events", ref ToolkitSettings.HodlBotMTBDays, ref hodlbotMTBDays, 0.5f, 10f); listing.Gap(); if (listing.ButtonTextLabeled("Default HodlBot Weights", "Reset Weights")) { Settings_Storyteller.NewVoteCategoryWeightsHodlBot(); Settings_Storyteller.NewVoteTypeWeightsHodlBot(); } listing.Gap(); listing.Label("Random Category Weights"); listing.Gap(); List <string> VoteCategoryList = ToolkitSettings.VoteCategoryWeights.Keys.ToList(); List <float> VoteCategoryFloatList = ToolkitSettings.VoteCategoryWeights.Values.ToList(); for (int i = 0; i < VoteCategoryList.Count(); i++) { string buffer = VoteCategoryFloatList[i].ToString(); float newValue = VoteCategoryFloatList[i]; listing.TextFieldNumericLabeled <float>(VoteCategoryList[i] + " - ", ref newValue, ref buffer); ToolkitSettings.VoteCategoryWeights[VoteCategoryList[i]] = newValue; } listing.Gap(); listing.Label("Random Type Weights"); listing.Gap(); List <string> VoteTypeList = ToolkitSettings.VoteTypeWeights.Keys.ToList(); List <float> VoteTypeFloatList = ToolkitSettings.VoteTypeWeights.Values.ToList(); for (int i = 0; i < VoteTypeList.Count(); i++) { string buffer = VoteTypeFloatList[i].ToString(); float newValue = VoteTypeFloatList[i]; listing.TextFieldNumericLabeled <float>(VoteTypeList[i] + " - ", ref newValue, ref buffer); ToolkitSettings.VoteTypeWeights[VoteTypeList[i]] = newValue; } listing.End(); }
public override void DoSettingsWindowContents(Rect inRect) { var leftRect = new Rect(inRect.x, inRect.y, inRect.width * 0.65f, inRect.height); var rightRect = new Rect(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(); if (!disableMod) { 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()); } else { listing_options.Gap(); listing_options.Gap(); listing_options.Label("PrisonLabor_RestartInfo".Translate(), -1f); listing_options.Label("PrisonLabor_RestartInfo2".Translate(), -1f); listing_options.Gap(); listing_options.Gap(); listing_options.Gap(); } listing_options.Gap(); listing_options.Gap(); listing_options.Gap(); listing_options.CheckboxLabeled("PrisonLabor_DisableMod".Translate(), ref disableMod, "PrisonLabor_DisableModDesc".Translate()); 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())) { NewsDialog.showAll = true; NewsDialog.ForceShow(); } listing_panel.End(); Apply(); }
public static void Draw(Listing_Standard listing, Rect win, bool settingsPage) { listing.Label(Strings.settings_dnspy); Settings.PathToDnspy = listing.TextEntry(Settings.PathToDnspy); listing.Gap(); DubGUI.LabeledSliderFloat(listing, Strings.settings_updates_per_second, ref Settings.updatesPerSecond, 1.0f, 20.0f); DubGUI.Checkbox(Strings.settings_logging, listing, ref Settings.verboseLogging); DubGUI.Checkbox(Strings.settings_disable_tps_counter, listing, ref Settings.disableTPSCounter); DubGUI.Checkbox(Strings.settings_enable_debug_log, listing, ref Settings.enableLog); DubGUI.Checkbox(Strings.settings_show_icon, listing, ref Settings.showIcon); if (DubGUI.Checkbox(Strings.settings_long_form_names, listing, ref Settings.longFormNames)) { ThreadSafeLogger.Warning("You will need to restart analyzer to see changes come into effect for tabs which are already open. (Right click on the analyzer icon, and click 'Cleanup' ; or wait 30s after closing analyzer)"); } var s = Strings.settings_disable_cleanup; var rect = listing.GetRect(Text.LineHeight); DubGUI.Checkbox(rect, s, ref Settings.disableCleanup); TooltipHandler.TipRegion(rect, Strings.settings_disable_cleanup_desc); if (settingsPage) { return; } listing.GapLine(); DubGUI.CenterText(() => listing.Label("devoptions.heading".Tr())); listing.GapLine(); var tabs = listing.GetRect(tabRect.height); tabs.width = tabRect.width; Drawtab(tabs, 0, "Patch Tools"); tabs.x = tabs.xMax; Drawtab(tabs, 1, $"Saved Patches ({Settings.SavedPatches_Tick.Count + Settings.SavedPatches_Update.Count})"); listing.Gap(4); if (PatchTab == 0) { if (listing.ButtonTextLabeled("Logging cycle", patchType.ToString())) { if (patchType == Category.Tick) { patchType = Category.Update; } else { patchType = Category.Tick; } //For if onGui gets added //var list = new List<FloatMenuOption> //{ // new FloatMenuOption("devoptions.patchtype.tick".Tr(), () => patchType = Category.Tick), // new FloatMenuOption("devoptions.patchtype.update".Tr(), () => patchType = Category.Update) // new FloatMenuOption("devoptions.patchtype.ongui".Tr(), () => patchType = Category.OnGui) //}; //Find.WindowStack.Add(new FloatMenu(list)); } if (showSearchbox) { Window_SearchBar.Control(); } var inputR = DisplayInputField(listing); Window_SearchBar.SetCurrentInput(input); Window_SearchBar.UpdateSearchString(currentInput); var searchRect = listing.GetRect(Mathf.Min(listing.curY, win.height - listing.curY)); lock (Window_SearchBar.sync) { if (showSearchbox && !Mouse.IsOver(searchRect) && Event.current.type != EventType.MouseDown) { showSearchbox = false; } if (GUI.GetNameOfFocusedControl() == "profileinput") { showSearchbox = true; } else if (Mouse.IsOver(inputR)) { showSearchbox = true; } } if (showSearchbox) { Window_SearchBar.DoWindowContents(searchRect); } } else { foreach (var patch in Settings.SavedPatches_Tick.ToList()) { var row = listing.GetRect(Text.LineHeight); if (Widgets.CloseButtonFor(row.LeftPartPixels(30f))) { Settings.SavedPatches_Tick.Remove(patch); } Widgets.Label(row.RightPartPixels(row.width - 30f), patch + " Tick"); listing.GapLine(); } foreach (var patch in Settings.SavedPatches_Update.ToList()) { var row = listing.GetRect(Text.LineHeight); if (Widgets.CloseButtonFor(row.LeftPartPixels(30f))) { Settings.SavedPatches_Update.Remove(patch); } Widgets.Label(row.RightPartPixels(row.width - 30f), patch + " Update"); listing.GapLine(); } } }