public static void DrawLanguageOption(Rect rect) { if (Game.Mode == GameMode.Entry) { var lang = LanguageDatabase.activeLanguage; if (lang.icon.NullOrBad()) { // Try fix bas flag texture var fileInfo = new FileInfo(Path.Combine("Mods", Path.Combine("Core", Path.Combine("Languages", Path.Combine(lang.folderName.ToString(), "LangIcon.png"))))); if (fileInfo.Exists) { LanguageDatabase.activeLanguage.icon = ModContentLoader <Texture2D> .LoadItem(fileInfo.FullName).contentItem; } } if ( Widgets.ImageButton( rect, LanguageDatabase.activeLanguage.icon) ) { var languageOptions = new List <FloatMenuOption>(); foreach (LoadedLanguage selectedLanguage in LanguageDatabase.AllLoadedLanguages) { languageOptions.Add( new FloatMenuOption( selectedLanguage.FriendlyNameNative, () => { if (selectedLanguage != Verse.LanguageDatabase.activeLanguage) { // Only reload if it changed LanguageDatabase.SelectLanguage(selectedLanguage); Prefs.Save(); } }, MenuOptionPriority.Medium) ); } Find.WindowStack.Add((Window) new FloatMenu(languageOptions, false)); } } }
public static void DoMainMenuControls(Rect rect, bool anyMapFiles) { GUI.BeginGroup(rect); Rect rect2 = new Rect(0f, 0f, 170f, rect.height); Rect rect3 = new Rect(rect2.xMax + 17f, 0f, 145f, rect.height); Text.Font = GameFont.Small; List <ListableOption> list = new List <ListableOption>(); if (Current.ProgramState == ProgramState.Entry) { string label = ("Tutorial".CanTranslate() ? ((string)"Tutorial".Translate()) : ((string)"LearnToPlay".Translate())); list.Add(new ListableOption(label, delegate { InitLearnToPlay(); })); list.Add(new ListableOption("NewColony".Translate(), delegate { Find.WindowStack.Add(new Page_SelectScenario()); })); } if (Current.ProgramState == ProgramState.Playing && !Current.Game.Info.permadeathMode) { list.Add(new ListableOption("Save".Translate(), delegate { CloseMainTab(); Find.WindowStack.Add(new Dialog_SaveFileList_Save()); })); } ListableOption item; if (anyMapFiles && (Current.ProgramState != ProgramState.Playing || !Current.Game.Info.permadeathMode)) { item = new ListableOption("LoadGame".Translate(), delegate { CloseMainTab(); Find.WindowStack.Add(new Dialog_SaveFileList_Load()); }); list.Add(item); } if (Current.ProgramState == ProgramState.Playing) { list.Add(new ListableOption("ReviewScenario".Translate(), delegate { Find.WindowStack.Add(new Dialog_MessageBox(Find.Scenario.GetFullInformationText(), null, null, null, null, Find.Scenario.name)); })); } item = new ListableOption("Options".Translate(), delegate { CloseMainTab(); Find.WindowStack.Add(new Dialog_Options()); }, "MenuButton-Options"); list.Add(item); if (Current.ProgramState == ProgramState.Entry) { item = new ListableOption("Mods".Translate(), delegate { Find.WindowStack.Add(new Page_ModsConfig()); }); list.Add(item); if (Prefs.DevMode && LanguageDatabase.activeLanguage == LanguageDatabase.defaultLanguage && LanguageDatabase.activeLanguage.anyError) { item = new ListableOption("SaveTranslationReport".Translate(), delegate { LanguageReportGenerator.SaveTranslationReport(); }); list.Add(item); } item = new ListableOption("Credits".Translate(), delegate { Find.WindowStack.Add(new Screen_Credits()); }); list.Add(item); } if (Current.ProgramState == ProgramState.Playing) { if (Current.Game.Info.permadeathMode) { item = new ListableOption("SaveAndQuitToMainMenu".Translate(), delegate { LongEventHandler.QueueLongEvent(delegate { GameDataSaveLoader.SaveGame(Current.Game.Info.permadeathModeUniqueName); MemoryUtility.ClearAllMapsAndWorld(); }, "Entry", "SavingLongEvent", doAsynchronously: false, null, showExtraUIInfo: false); }); list.Add(item); item = new ListableOption("SaveAndQuitToOS".Translate(), delegate { LongEventHandler.QueueLongEvent(delegate { GameDataSaveLoader.SaveGame(Current.Game.Info.permadeathModeUniqueName); LongEventHandler.ExecuteWhenFinished(delegate { Root.Shutdown(); }); }, "SavingLongEvent", doAsynchronously: false, null, showExtraUIInfo: false); }); list.Add(item); } else { Action action = delegate { if (GameDataSaveLoader.CurrentGameStateIsValuable) { Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmQuit".Translate(), delegate { GenScene.GoToMainMenu(); }, destructive: true)); } else { GenScene.GoToMainMenu(); } }; item = new ListableOption("QuitToMainMenu".Translate(), action); list.Add(item); Action action2 = delegate { if (GameDataSaveLoader.CurrentGameStateIsValuable) { Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmQuit".Translate(), delegate { Root.Shutdown(); }, destructive: true)); } else { Root.Shutdown(); } }; item = new ListableOption("QuitToOS".Translate(), action2); list.Add(item); } } else { item = new ListableOption("QuitToOS".Translate(), delegate { Root.Shutdown(); }); list.Add(item); } OptionListingUtility.DrawOptionListing(rect2, list); Text.Font = GameFont.Small; List <ListableOption> list2 = new List <ListableOption>(); ListableOption item2 = new ListableOption_WebLink("FictionPrimer".Translate(), "https://rimworldgame.com/backstory", TexButton.IconBlog); list2.Add(item2); item2 = new ListableOption_WebLink("LudeonBlog".Translate(), "https://ludeon.com/blog", TexButton.IconBlog); list2.Add(item2); item2 = new ListableOption_WebLink("Forums".Translate(), "https://ludeon.com/forums", TexButton.IconForums); list2.Add(item2); item2 = new ListableOption_WebLink("OfficialWiki".Translate(), "https://rimworldwiki.com", TexButton.IconBlog); list2.Add(item2); item2 = new ListableOption_WebLink("TynansTwitter".Translate(), "https://twitter.com/TynanSylvester", TexButton.IconTwitter); list2.Add(item2); item2 = new ListableOption_WebLink("TynansDesignBook".Translate(), "https://tynansylvester.com/book", TexButton.IconBook); list2.Add(item2); item2 = new ListableOption_WebLink("HelpTranslate".Translate(), TranslationsContributeURL, TexButton.IconForums); list2.Add(item2); item2 = new ListableOption_WebLink("BuySoundtrack".Translate(), "http://www.lasgameaudio.co.uk/#!store/t04fw", TexButton.IconSoundtrack); list2.Add(item2); float num = OptionListingUtility.DrawOptionListing(rect3, list2); GUI.BeginGroup(rect3); if (Current.ProgramState == ProgramState.Entry && Widgets.ButtonText(new Rect(0f, num + 10f, rect3.width, 50f), LanguageDatabase.activeLanguage.FriendlyNameNative)) { List <FloatMenuOption> list3 = new List <FloatMenuOption>(); foreach (LoadedLanguage allLoadedLanguage in LanguageDatabase.AllLoadedLanguages) { LoadedLanguage localLang = allLoadedLanguage; list3.Add(new FloatMenuOption(localLang.DisplayName, delegate { LanguageDatabase.SelectLanguage(localLang); Prefs.Save(); })); } Find.WindowStack.Add(new FloatMenu(list3)); } GUI.EndGroup(); GUI.EndGroup(); }
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 res 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(res.width, res.height), delegate { if (!ResolutionUtility.UIScaleSafeWithResolution(Prefs.UIScale, res.width, res.height)) { Messages.Message("MessageScreenResTooSmallForUIScale".Translate(), MessageTypeDefOf.RejectInput, historical: false); } else { ResolutionUtility.SafeSetResolution(res); } })); } if (!list.Any()) { list.Add(new FloatMenuOption("NoneBrackets".Translate(), null)); } Find.WindowStack.Add(new FloatMenu(list)); } if (listing_Standard.ButtonTextLabeled("UIScale".Translate(), Prefs.UIScale + "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] + "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>(); foreach (AnimalNameDisplayMode value in Enum.GetValues(typeof(AnimalNameDisplayMode))) { AnimalNameDisplayMode localMode = value; list3.Add(new FloatMenuOption(localMode.ToStringHuman(), delegate { Prefs.AnimalNameMode = localMode; })); } 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); SoundDefOf.Click.PlayOneShotOnCamera(); } else { List <FloatMenuOption> list4 = new List <FloatMenuOption>(); foreach (LoadedLanguage allLoadedLanguage in LanguageDatabase.AllLoadedLanguages) { LoadedLanguage localLang = allLoadedLanguage; list4.Add(new FloatMenuOption(localLang.DisplayName, 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); SoundDefOf.Click.PlayOneShotOnCamera(); } if (listing_Standard.ButtonText("OpenLogFileFolder".Translate())) { Application.OpenURL(Application.persistentDataPath); SoundDefOf.Click.PlayOneShotOnCamera(); } } else { if (listing_Standard.ButtonText("ShowSaveGameDataLocation".Translate())) { Find.WindowStack.Add(new Dialog_MessageBox(Path.GetFullPath(GenFilePaths.SaveDataFolderPath))); } if (listing_Standard.ButtonText("ShowLogFileLocation".Translate())) { Find.WindowStack.Add(new Dialog_MessageBox(Path.GetFullPath(Application.persistentDataPath))); } } if (listing_Standard.ButtonText("ResetAdaptiveTutor".Translate())) { Messages.Message("AdaptiveTutorIsReset".Translate(), MessageTypeDefOf.TaskCompletion, historical: false); PlayerKnowledgeDatabase.ResetPersistent(); SoundDefOf.Click.PlayOneShotOnCamera(); } 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; float mapDragSensitivity = Prefs.MapDragSensitivity; listing_Standard.Label("MapDragSensitivity".Translate() + ": " + mapDragSensitivity.ToStringPercent("F0")); Prefs.MapDragSensitivity = (float)Math.Round(listing_Standard.Slider(mapDragSensitivity, 0.8f, 2.5f), 2); bool checkOn9 = Prefs.PauseOnLoad; listing_Standard.CheckboxLabeled("PauseOnLoad".Translate(), ref checkOn9); Prefs.PauseOnLoad = checkOn9; AutomaticPauseMode automaticPauseMode = Prefs.AutomaticPauseMode; if (listing_Standard.ButtonTextLabeled("AutomaticPauseModeSetting".Translate(), Prefs.AutomaticPauseMode.ToStringHuman())) { List <FloatMenuOption> list5 = new List <FloatMenuOption>(); foreach (AutomaticPauseMode value2 in Enum.GetValues(typeof(AutomaticPauseMode))) { AutomaticPauseMode localPmode = value2; list5.Add(new FloatMenuOption(localPmode.ToStringHuman(), delegate { Prefs.AutomaticPauseMode = localPmode; })); } Find.WindowStack.Add(new FloatMenu(list5)); } Prefs.AutomaticPauseMode = automaticPauseMode; int maxNumberOfPlayerSettlements = Prefs.MaxNumberOfPlayerSettlements; listing_Standard.Label("MaxNumberOfPlayerSettlements".Translate(maxNumberOfPlayerSettlements)); int num2 = (Prefs.MaxNumberOfPlayerSettlements = Mathf.RoundToInt(listing_Standard.Slider(maxNumberOfPlayerSettlements, 1f, 5f))); if (maxNumberOfPlayerSettlements != num2 && num2 > 1) { TutorUtility.DoModalDialogIfNotKnown(ConceptDefOf.MaxNumberOfPlayerSettlements); } if (listing_Standard.ButtonTextLabeled("TemperatureMode".Translate(), Prefs.TemperatureMode.ToStringHuman())) { List <FloatMenuOption> list6 = new List <FloatMenuOption>(); foreach (TemperatureDisplayMode value3 in Enum.GetValues(typeof(TemperatureDisplayMode))) { TemperatureDisplayMode localTmode = value3; list6.Add(new FloatMenuOption(localTmode.ToStringHuman(), delegate { Prefs.TemperatureMode = localTmode; })); } Find.WindowStack.Add(new FloatMenu(list6)); } float autosaveIntervalDays = Prefs.AutosaveIntervalDays; string text = "Days".Translate(); string text2 = "Day".Translate().ToLower(); if (listing_Standard.ButtonTextLabeled("AutosaveInterval".Translate(), autosaveIntervalDays + " " + ((autosaveIntervalDays == 1f) ? text2 : text))) { List <FloatMenuOption> list7 = new List <FloatMenuOption>(); if (Prefs.DevMode) { list7.Add(new FloatMenuOption("0.125 " + text + "(debug)", delegate { Prefs.AutosaveIntervalDays = 0.125f; })); list7.Add(new FloatMenuOption("0.25 " + text + "(debug)", delegate { Prefs.AutosaveIntervalDays = 0.25f; })); } list7.Add(new FloatMenuOption(("0.5 " + text) ?? "", delegate { Prefs.AutosaveIntervalDays = 0.5f; })); list7.Add(new FloatMenuOption(1 + " " + text2, delegate { Prefs.AutosaveIntervalDays = 1f; })); list7.Add(new FloatMenuOption(3 + " " + text, delegate { Prefs.AutosaveIntervalDays = 3f; })); list7.Add(new FloatMenuOption(7 + " " + text, delegate { Prefs.AutosaveIntervalDays = 7f; })); list7.Add(new FloatMenuOption(14 + " " + text, delegate { Prefs.AutosaveIntervalDays = 14f; })); Find.WindowStack.Add(new FloatMenu(list7)); } 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)); } bool checkOn10 = Prefs.TestMapSizes; listing_Standard.CheckboxLabeled("EnableTestMapSizes".Translate(), ref checkOn10); Prefs.TestMapSizes = checkOn10; if (!DevModePermanentlyDisabledUtility.Disabled || Prefs.DevMode) { bool checkOn11 = Prefs.DevMode; listing_Standard.CheckboxLabeled("DevelopmentMode".Translate(), ref checkOn11); Prefs.DevMode = checkOn11; } if (Prefs.DevMode) { bool checkOn12 = Prefs.ResetModsConfigOnCrash; listing_Standard.CheckboxLabeled("ResetModsConfigOnCrash".Translate(), ref checkOn12); Prefs.ResetModsConfigOnCrash = checkOn12; bool checkOn13 = Prefs.LogVerbose; listing_Standard.CheckboxLabeled("LogVerbose".Translate(), ref checkOn13); Prefs.LogVerbose = checkOn13; if (Current.ProgramState != ProgramState.Playing) { bool checkOn14 = Prefs.SimulateNotOwningRoyalty; listing_Standard.CheckboxLabeled("SimulateNotOwningRoyalty".Translate(), ref checkOn14); Prefs.SimulateNotOwningRoyalty = checkOn14; } } listing_Standard.NewColumn(); Text.Font = GameFont.Medium; listing_Standard.Label(""); 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(""); listing_Standard.Label("NamesYouWantToSee".Translate()); Prefs.PreferredNames.RemoveAll((string n) => n.NullOrEmpty()); for (int j = 0; j < Prefs.PreferredNames.Count; j++) { string name = Prefs.PreferredNames[j]; PawnBio pawnBio = SolidBioDatabase.allBios.Where((PawnBio b) => b.name.ToString() == name).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); if (Widgets.ButtonImage(new Rect(rect2.xMax - 24f, rect2.y, 24f, 24f), 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(""); if (listing_Standard.ButtonText("RestoreToDefaultSettings".Translate())) { Find.WindowStack.Add(new Dialog_MessageBox("ResetAndRestartConfirmationDialog".Translate(), "Yes".Translate(), delegate { RestoreToDefaultSettings(); }, "No".Translate())); } listing_Standard.End(); }
public static bool PreFDoMainMenuControls(Rect rect, bool anyMapFiles) { // Shape buttons float floButtonHeight = rect.height / 8f; float floButtonPadding = floButtonHeight / 6f; float floButtonWidth = rect.width / 2f; Rect rectButtonsFrame = new Rect(rect.x, rect.y, (rect.width / 2f) - rect.width * .05f, rect.height); Rect rectButtons = new Rect(0f, 0f, rectButtonsFrame.width, rectButtonsFrame.height); GUI.BeginGroup(rectButtonsFrame); // make sure font is set to small Text.Font = GameFont.Small; // Menu Buttons are contained in this List List <ProListableOption> listableOptions = new List <ProListableOption>(); // Tutorial Button and New Colony Button string str; // string needed because Tutorial doesn't exist in every language.. if (Current.ProgramState == ProgramState.Entry) { str = ("Tutorial".CanTranslate() ? "Tutorial".Translate() : "LearnToPlay".Translate()); listableOptions.Add(new ProListableOption(str, () => Traverse.Create(typeof(MainMenuDrawer)).Method("InitLearnToPlay"), null)); listableOptions.Add(new ProListableOption("NewColony".Translate(), () => Find.WindowStack.Add(new ProCWP()), null)); } // In-Game Save Button if (Current.ProgramState == ProgramState.Playing && !Current.Game.Info.permadeathMode) { listableOptions.Add(new ProListableOption("Save".Translate(), () => { Traverse.Create(typeof(MainMenuDrawer)).Method("CloseMainTab"); Find.WindowStack.Add(new Dialog_SaveFileList_Save()); }, null)); } // Load Game Button if (anyMapFiles && (Current.ProgramState != ProgramState.Playing || !Current.Game.Info.permadeathMode)) { listableOptions.Add(new ProListableOption("LoadGame".Translate(), () => { Traverse.Create(typeof(MainMenuDrawer)).Method("CloseMainTab"); Find.WindowStack.Add(new Dialog_SaveFileList_Load()); }, null)); } // Review Scenario Button if (Current.ProgramState == ProgramState.Playing) { listableOptions.Add(new ProListableOption("ReviewScenario".Translate(), () => { WindowStack windowStack = Find.WindowStack; string scenario = Find.Scenario.name; windowStack.Add(new Dialog_MessageBox(Find.Scenario.GetFullInformationText(), null, null, null, null, scenario, false)); }, null)); } // Options Button listableOptions.Add(new ProListableOption("Options".Translate(), () => { Traverse.Create(typeof(MainMenuDrawer)).Method("CloseMainTab"); Find.WindowStack.Add(new Dialog_Options()); }, "MenuButton-Options")); // Mods Button and Credit Button if (Current.ProgramState == ProgramState.Entry) { listableOptions.Add(new ProListableOption("Mods".Translate(), () => Find.WindowStack.Add(new Page_ModsConfig()), null)); listableOptions.Add(new ProListableOption("Credits".Translate(), () => Find.WindowStack.Add(new Screen_Credits()), null)); } // Quit To OS Button if (Current.ProgramState != ProgramState.Playing) { listableOptions.Add(new ProListableOption("QuitToOS".Translate(), () => Root.Shutdown(), null)); } // Quit Buttons depending on Permadeath setting else if (!Current.Game.Info.permadeathMode) { Action currentGameStateIsValuable = () => { if (!GameDataSaveLoader.CurrentGameStateIsValuable) { GenScene.GoToMainMenu(); } else { Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmQuit".Translate(), () => GenScene.GoToMainMenu(), true, null)); } }; ProListableOption listableOption = new ProListableOption("QuitToMainMenu".Translate(), currentGameStateIsValuable, null); listableOptions.Add(listableOption); Action action = () => { if (!GameDataSaveLoader.CurrentGameStateIsValuable) { Root.Shutdown(); } else { Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmQuit".Translate(), () => Root.Shutdown(), true, null)); } }; listableOption = new ProListableOption("QuitToOS".Translate(), action, null); listableOptions.Add(listableOption); } else { listableOptions.Add(new ProListableOption("SaveAndQuitToMainMenu".Translate(), () => LongEventHandler.QueueLongEvent(() => { GameDataSaveLoader.SaveGame(Current.Game.Info.permadeathModeUniqueName); MemoryUtility.ClearAllMapsAndWorld(); }, "Entry", "SavingLongEvent", false, null), null)); listableOptions.Add(new ProListableOption("SaveAndQuitToOS".Translate(), () => LongEventHandler.QueueLongEvent(() => { GameDataSaveLoader.SaveGame(Current.Game.Info.permadeathModeUniqueName); LongEventHandler.ExecuteWhenFinished(() => Root.Shutdown()); }, "SavingLongEvent", false, null), null)); } // Draw Menu Buttons ProOptionListingUtility.ProDrawOptionListing(rectButtons, listableOptions, UI.screenHeight / 100f); GUI.EndGroup(); // Configure Links Text.Font = GameFont.Small; List <ProListableOption_WebLink> listableOptions1 = new List <ProListableOption_WebLink>(); ProListableOption_WebLink listableOptionWebLink = new ProListableOption_WebLink("FictionPrimer".Translate(), null, "https://docs.google.com/document/d/1pIZyKif0bFbBWten4drrm7kfSSfvBoJPgG9-ywfN8j8/pub", ProTBin.IconBlog); listableOptions1.Add(listableOptionWebLink); listableOptionWebLink = new ProListableOption_WebLink("LudeonBlog".Translate(), null, "http://ludeon.com/blog", ProTBin.IconBlog); listableOptions1.Add(listableOptionWebLink); listableOptionWebLink = new ProListableOption_WebLink("Forums".Translate(), null, "http://ludeon.com/forums", ProTBin.IconForums); listableOptions1.Add(listableOptionWebLink); listableOptionWebLink = new ProListableOption_WebLink("OfficialWiki".Translate(), null, "http://rimworldwiki.com", ProTBin.IconBlog); listableOptions1.Add(listableOptionWebLink); listableOptionWebLink = new ProListableOption_WebLink("TynansTwitter".Translate(), null, "https://twitter.com/TynanSylvester", ProTBin.IconTwitter); listableOptions1.Add(listableOptionWebLink); listableOptionWebLink = new ProListableOption_WebLink("TynansDesignBook".Translate(), null, "http://tynansylvester.com/book", ProTBin.IconBook); listableOptions1.Add(listableOptionWebLink); listableOptionWebLink = new ProListableOption_WebLink("HelpTranslate".Translate(), null, "http://ludeon.com/forums/index.php?topic=2933.0", ProTBin.IconForums); listableOptions1.Add(listableOptionWebLink); listableOptionWebLink = new ProListableOption_WebLink("BuySoundtrack".Translate(), null, "http://www.lasgameaudio.co.uk/#!store/t04fw", ProTBin.IconSoundtrack); listableOptions1.Add(listableOptionWebLink); // Shape Links Rect rectLinksFrame = new Rect(rect.x + (rect.width / 2f), rect.y, (rect.width / 2f), (rect.height / (listableOptions1.Count + 1)) * (listableOptions1.Count - 1)); GUI.BeginGroup(rectLinksFrame); Rect rectLinks = new Rect(0f, 0f, rectLinksFrame.width, rectLinksFrame.height); // Draw Links ProOptionListingUtility.ProDrawOptionListing(rectLinks, listableOptions1, (rectLinks.height / 9f) / 7f); GUI.EndGroup(); // Handle language button if (Current.ProgramState == ProgramState.Entry) { // Configure Language button. List <FloatMenuOption> floatMenuOptions = new List <FloatMenuOption>(); IEnumerator <LoadedLanguage> enumerator = LanguageDatabase.AllLoadedLanguages.GetEnumerator(); try { while (enumerator.MoveNext()) { LoadedLanguage current = enumerator.Current; floatMenuOptions.Add(new FloatMenuOption(current.FriendlyNameNative, () => { LanguageDatabase.SelectLanguage(current); Prefs.Save(); }, MenuOptionPriority.Default, null, null, 0f, null, null)); } } finally { if (enumerator == null) { } enumerator.Dispose(); } // Shape language button Rect rectLanguageButtonFrame = new Rect(rect.x + (rect.width / 2f), rect.y + rectLinksFrame.height, (rect.width / 2f), (rect.height / (listableOptions1.Count + 1)) * 2f); GUI.BeginGroup(rectLanguageButtonFrame); float floLanguageButtonPadding = rectLanguageButtonFrame.height * .1f; Rect rectLanguageButton = new Rect(0f + floLanguageButtonPadding, 0f + floLanguageButtonPadding, rectLanguageButtonFrame.width - (floLanguageButtonPadding * 2f), rectLanguageButtonFrame.height - (floLanguageButtonPadding * 2f)); // Draw language button if (Widgets.ButtonImage(rectLanguageButton, LanguageDatabase.activeLanguage.icon)) { Find.WindowStack.Add(new FloatMenu(floatMenuOptions)); } GUI.EndGroup(); } return(false); }
public void DoTab3Contents(Rect inRect) { Text.Font = GameFont.Medium; Widgets.Label(inRect, "OCity_Dialog_AboutMode".Translate()); Text.Font = GameFont.Small; var chatAreaOuter = new Rect(inRect.x + 150f, inRect.y + 40f, inRect.width - 150f, inRect.height - 30f - 40f); AboutBox.Drow(chatAreaOuter); var rect2 = new Rect(inRect.x, inRect.y + inRect.height / 2f, 150f, inRect.height - 30f - 40f); Text.Font = GameFont.Small; List <ListableOption> list2 = new List <ListableOption>(); ListableOption item2 = new ListableOption_WebLink("OCity_Dialog_AutorPage".Translate(), "https://steamcommunity.com/sharedfiles/filedetails/?id=1908437382", GeneralTexture.IconForums); list2.Add(item2); rect2 = new Rect(inRect.x, inRect.y + 30f, 150f, 40f); Text.Font = GameFont.Small; list2 = new List <ListableOption>(); item2 = new ListableOption_WebLink("OCity_Dialog_Regame".Translate(), () => { var form = new Dialog_Input("OCity_Dialog_DeleteData".Translate(), "OCity_Dialog_DeleteDataCheck".Translate()); form.PostCloseAction = () => { if (form.ResultOK) { var mainCannal = SessionClientController.Data.Chats[0]; SessionClientController.Command((connect) => { var res = connect.PostingChat(mainCannal.Id, "/killmyallplease"); if (res != null && res.Status == 0) { SessionClientController.Disconnected("OCity_Dialog_DeletedData".Translate()); } }); } }; Find.WindowStack.Add(form); }, GeneralTexture.IconDelTex); list2.Add(item2); float num = OptionListingUtility.DrawOptionListing(rect2, list2); GUI.BeginGroup(rect2); if (Current.ProgramState == ProgramState.Entry && Widgets.ButtonImage(new Rect(0f, num + 10f, 64f, 32f), LanguageDatabase.activeLanguage.icon)) { List <FloatMenuOption> list3 = new List <FloatMenuOption>(); foreach (LoadedLanguage current in LanguageDatabase.AllLoadedLanguages) { LoadedLanguage localLang = current; list3.Add(new FloatMenuOption(localLang.FriendlyNameNative, delegate { LanguageDatabase.SelectLanguage(localLang); Prefs.Save(); }, MenuOptionPriority.Default, null, null, 0f, null, null)); } Find.WindowStack.Add(new FloatMenu(list3)); } GUI.EndGroup(); /* * var rectCannals = new Rect(inRect.x, inRect.y, 100f, (float)Math.Round((decimal)(inRect.height / 2f * 10f)) / 10f); * Widgets.DrawBoxSolid(inRect, new Color(0.2f, 0.2f, 0)); * Widgets.DrawBoxSolid(rectCannals, new Color(0.4f, 0.4f, 0)); * * * Widgets.DrawBoxSolid(new Rect(inRect.x + 110f, inRect.y, inRect.width - 110f, inRect.height - 40f) * , new Color(0.4f, 0, 0)); * * Widgets.DrawBoxSolid(new Rect(inRect.x + 110f, inRect.y + inRect.height - 35f, inRect.width - 110f, 25f) * , new Color(0, 0, 0.4f)); * * Widgets.Label(inRect, "Вкладка 3"); */ }
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(), -1f, null); Text.Font = GameFont.Small; listing_Standard.Gap(12f); listing_Standard.Gap(12f); listing_Standard.Label("GameVolume".Translate(), -1f, null); Prefs.VolumeGame = listing_Standard.Slider(Prefs.VolumeGame, 0f, 1f); listing_Standard.Label("MusicVolume".Translate(), -1f, null); Prefs.VolumeMusic = listing_Standard.Slider(Prefs.VolumeMusic, 0f, 1f); listing_Standard.Label("AmbientVolume".Translate(), -1f, null); Prefs.VolumeAmbient = listing_Standard.Slider(Prefs.VolumeAmbient, 0f, 1f); if (listing_Standard.ButtonTextLabeled("Resolution".Translate(), Dialog_Options.ResToString(Screen.width, Screen.height))) { List <FloatMenuOption> list = new List <FloatMenuOption>(); using (IEnumerator <Resolution> enumerator = (from x in UnityGUIBugsFixer.ScreenResolutionsWithoutDuplicates where x.width >= 1024 && x.height >= 768 orderby x.width, x.height select x).GetEnumerator()) { while (enumerator.MoveNext()) { Resolution res = enumerator.Current; list.Add(new FloatMenuOption(Dialog_Options.ResToString(res.width, res.height), delegate() { if (!ResolutionUtility.UIScaleSafeWithResolution(Prefs.UIScale, res.width, res.height)) { Messages.Message("MessageScreenResTooSmallForUIScale".Translate(), MessageTypeDefOf.RejectInput, false); } else { ResolutionUtility.SafeSetResolution(res); } }, MenuOptionPriority.Default, null, null, 0f, null, null)); } } if (!list.Any <FloatMenuOption>()) { list.Add(new FloatMenuOption("NoneBrackets".Translate(), null, MenuOptionPriority.Default, null, null, 0f, null, 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 < Dialog_Options.UIScales.Length; i++) { float scale = Dialog_Options.UIScales[i]; list2.Add(new FloatMenuOption(Dialog_Options.UIScales[i].ToString() + "x", delegate() { if (scale != 1f && !ResolutionUtility.UIScaleSafeWithResolution(scale, Screen.width, Screen.height)) { Messages.Message("MessageScreenResTooSmallForUIScale".Translate(), MessageTypeDefOf.RejectInput, false); } else { ResolutionUtility.SafeSetUIScale(scale); } }, MenuOptionPriority.Default, null, null, 0f, null, null)); } Find.WindowStack.Add(new FloatMenu(list2)); } 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.Gap(12f); bool hatsOnlyOnMap = Prefs.HatsOnlyOnMap; listing_Standard.CheckboxLabeled("HatsShownOnlyOnMap".Translate(), ref hatsOnlyOnMap, null); if (hatsOnlyOnMap != Prefs.HatsOnlyOnMap) { PortraitsCache.Clear(); } Prefs.HatsOnlyOnMap = hatsOnlyOnMap; bool plantWindSway = Prefs.PlantWindSway; listing_Standard.CheckboxLabeled("PlantWindSway".Translate(), ref plantWindSway, null); Prefs.PlantWindSway = plantWindSway; bool showRealtimeClock = Prefs.ShowRealtimeClock; listing_Standard.CheckboxLabeled("ShowRealtimeClock".Translate(), ref showRealtimeClock, null); Prefs.ShowRealtimeClock = showRealtimeClock; 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()) { object obj = enumerator2.Current; AnimalNameDisplayMode localMode2 = (AnimalNameDisplayMode)obj; AnimalNameDisplayMode localMode = localMode2; list3.Add(new FloatMenuOption(localMode.ToStringHuman(), delegate() { Prefs.AnimalNameMode = localMode; }, MenuOptionPriority.Default, null, null, 0f, null, null)); } } 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(), -1f, null); 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, false); } else { List <FloatMenuOption> list4 = new List <FloatMenuOption>(); foreach (LoadedLanguage localLang2 in LanguageDatabase.AllLoadedLanguages) { LoadedLanguage localLang = localLang2; list4.Add(new FloatMenuOption(localLang.FriendlyNameNative, delegate() { LanguageDatabase.SelectLanguage(localLang); }, MenuOptionPriority.Default, null, null, 0f, null, null)); } Find.WindowStack.Add(new FloatMenu(list4)); } } if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor) { if (listing_Standard.ButtonText("OpenSaveGameDataFolder".Translate(), null)) { Application.OpenURL(GenFilePaths.SaveDataFolderPath); } } else if (listing_Standard.ButtonText("ShowSaveGameDataLocation".Translate(), null)) { Find.WindowStack.Add(new Dialog_MessageBox(Path.GetFullPath(GenFilePaths.SaveDataFolderPath), null, null, null, null, null, false, null, null)); } if (listing_Standard.ButtonText("ResetAdaptiveTutor".Translate(), null)) { Messages.Message("AdaptiveTutorIsReset".Translate(), MessageTypeDefOf.TaskCompletion, false); PlayerKnowledgeDatabase.ResetPersistent(); } bool adaptiveTrainingEnabled = Prefs.AdaptiveTrainingEnabled; listing_Standard.CheckboxLabeled("LearningHelper".Translate(), ref adaptiveTrainingEnabled, null); Prefs.AdaptiveTrainingEnabled = adaptiveTrainingEnabled; 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; int maxNumberOfPlayerSettlements = Prefs.MaxNumberOfPlayerSettlements; listing_Standard.Label("MaxNumberOfPlayerSettlements".Translate(new object[] { maxNumberOfPlayerSettlements }), -1f, null); int num = Mathf.RoundToInt(listing_Standard.Slider((float)maxNumberOfPlayerSettlements, 1f, 5f)); Prefs.MaxNumberOfPlayerSettlements = num; if (maxNumberOfPlayerSettlements != num && num > 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()) { object obj2 = enumerator4.Current; TemperatureDisplayMode localTmode2 = (TemperatureDisplayMode)obj2; TemperatureDisplayMode localTmode = localTmode2; list5.Add(new FloatMenuOption(localTmode.ToString(), delegate() { Prefs.TemperatureMode = localTmode; }, MenuOptionPriority.Default, null, null, 0f, null, null)); } } 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; }, MenuOptionPriority.Default, null, null, 0f, null, null)); list6.Add(new FloatMenuOption("0.25 " + text + "(debug)", delegate() { Prefs.AutosaveIntervalDays = 0.25f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); } list6.Add(new FloatMenuOption("0.5 " + text + string.Empty, delegate() { Prefs.AutosaveIntervalDays = 0.5f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); list6.Add(new FloatMenuOption(1.ToString() + " " + text2, delegate() { Prefs.AutosaveIntervalDays = 1f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); list6.Add(new FloatMenuOption(3.ToString() + " " + text, delegate() { Prefs.AutosaveIntervalDays = 3f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); list6.Add(new FloatMenuOption(7.ToString() + " " + text, delegate() { Prefs.AutosaveIntervalDays = 7f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); list6.Add(new FloatMenuOption(14.ToString() + " " + text, delegate() { Prefs.AutosaveIntervalDays = 14f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); 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(new object[] { 1f }), -1f, null); 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(), null)) { Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmPermanentlyDisableDevMode".Translate(), delegate { DevModePermanentlyDisabledUtility.Disable(); }, true, null)); } if (!DevModePermanentlyDisabledUtility.Disabled || Prefs.DevMode) { bool devMode = Prefs.DevMode; listing_Standard.CheckboxLabeled("DevelopmentMode".Translate(), ref devMode, null); Prefs.DevMode = devMode; } bool testMapSizes = Prefs.TestMapSizes; listing_Standard.CheckboxLabeled("EnableTestMapSizes".Translate(), ref testMapSizes, null); Prefs.TestMapSizes = testMapSizes; 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, null); 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, null); listing_Standard.Label("NamesYouWantToSee".Translate(), -1f, null); List <string> preferredNames = Prefs.PreferredNames; if (Dialog_Options.< > f__mg$cache0 == null) { Dialog_Options.< > f__mg$cache0 = new Predicate <string>(GenText.NullOrEmpty); } preferredNames.RemoveAll(Dialog_Options.< > f__mg$cache0); 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, Color.white, GenUI.SubtleMouseoverColor)) { Prefs.PreferredNames.RemoveAt(j); SoundDefOf.Tick_Low.PlayOneShotOnCamera(null); } } if (Prefs.PreferredNames.Count < 6 && listing_Standard.ButtonText("AddName".Translate() + "...", null)) { Find.WindowStack.Add(new Dialog_AddPreferredName()); } listing_Standard.Label(string.Empty, -1f, null); if (listing_Standard.ButtonText("RestoreToDefaultSettings".Translate(), null)) { this.RestoreToDefaultSettings(); } listing_Standard.End(); }
internal void <> m__0() { LanguageDatabase.SelectLanguage(this.localLang); Prefs.Save(); }
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(); }
public static void DoMainMenuButtons(Rect rect, bool anyWorldFiles, bool anyMapFiles, Action backToGameButtonAction = null) { Rect rect2 = new Rect(0f, 0f, 200f, rect.height); Rect rect3 = new Rect(rect2.xMax + 17f, 0f, -1f, rect.height); rect3.xMax = rect.width; Text.Font = GameFont.Small; List <ListableOption> list = new List <ListableOption>(); ListableOption item; if (Game.Mode == GameMode.Entry) { item = new ListableOption("CreateWorld".Translate(), delegate { MapInitData.Reset(); Find.WindowStack.Add(new Page_CreateWorldParams()); }); list.Add(item); if (anyWorldFiles) { item = new ListableOption("NewColony".Translate(), delegate { MapInitData.Reset(); Find.WindowStack.Add(new Page_SelectStoryteller()); }); list.Add(item); } } if (Game.Mode == GameMode.MapPlaying) { if (backToGameButtonAction != null) { item = new ListableOption("BackToGame".Translate(), backToGameButtonAction); list.Add(item); } item = new ListableOption("Save".Translate(), delegate { MainMenuDrawer.CloseMainTab(); Find.WindowStack.Add(new Dialog_MapList_Save()); }); list.Add(item); } if (anyMapFiles) { item = new ListableOption("Load".Translate(), delegate { MainMenuDrawer.CloseMainTab(); Find.WindowStack.Add(new Dialog_MapList_Load()); }); list.Add(item); } item = new ListableOption("EdB.InterfaceOptions.Button.GameOptions".Translate(), delegate { MainMenuDrawer.CloseMainTab(); Find.WindowStack.Add(new Dialog_Options()); }); list.Add(item); if (Preferences.Instance.AtLeastOne) { item = new ListableOption("EdB.InterfaceOptions.Button.InterfaceOptions".Translate(), delegate { MainMenuDrawer.CloseMainTab(); Find.WindowStack.Add(new Dialog_InterfaceOptions()); }); list.Add(item); } if (Game.Mode == GameMode.Entry) { item = new ListableOption("Mods".Translate(), delegate { Find.WindowStack.Add(new Page_ModsConfig()); }); list.Add(item); item = new ListableOption("Credits".Translate(), delegate { Find.WindowStack.Add(new Page_Credits()); }); list.Add(item); } if (Game.Mode == GameMode.MapPlaying) { Action action = delegate { Find.WindowStack.Add(new Dialog_Confirm("ConfirmQuit".Translate(), delegate { Application.LoadLevel("Entry"); }, true)); }; item = new ListableOption("QuitToMainMenu".Translate(), action); list.Add(item); Action action2 = delegate { Find.WindowStack.Add(new Dialog_Confirm("ConfirmQuit".Translate(), delegate { Root.Shutdown(); }, true)); }; item = new ListableOption("QuitToOS".Translate(), action2); list.Add(item); } else { item = new ListableOption("QuitToOS".Translate(), delegate { Root.Shutdown(); }); list.Add(item); } Rect rect4 = rect2.ContractedBy(17f); OptionListingUtility.DrawOptionListing(rect4, list); Text.Font = GameFont.Small; List <ListableOption> list2 = new List <ListableOption>(); ListableOption item2 = new ListableOption_WebLink("FictionPrimer".Translate(), "https://docs.google.com/document/d/1pIZyKif0bFbBWten4drrm7kfSSfvBoJPgG9-ywfN8j8/pub", MainMenuDrawer.IconBlog); list2.Add(item2); item2 = new ListableOption_WebLink("LudeonBlog".Translate(), "http://ludeon.com/blog", MainMenuDrawer.IconBlog); list2.Add(item2); item2 = new ListableOption_WebLink("Forums".Translate(), "http://ludeon.com/forums", MainMenuDrawer.IconForums); list2.Add(item2); item2 = new ListableOption_WebLink("OfficialWiki".Translate(), "http://rimworldwiki.com", MainMenuDrawer.IconBlog); list2.Add(item2); item2 = new ListableOption_WebLink("TynansTwitter".Translate(), "https://twitter.com/TynanSylvester", MainMenuDrawer.IconTwitter); list2.Add(item2); item2 = new ListableOption_WebLink("TynansDesignBook".Translate(), "http://tynansylvester.com/book", MainMenuDrawer.IconBook); list2.Add(item2); item2 = new ListableOption_WebLink("HelpTranslate".Translate(), "http://ludeon.com/forums/index.php?topic=2933.0", MainMenuDrawer.IconForums); list2.Add(item2); Rect rect5 = rect3.ContractedBy(17f); float num = OptionListingUtility.DrawOptionListing(rect5, list2); GUI.BeginGroup(rect5); if (Game.Mode == GameMode.Entry && Widgets.ImageButton(new Rect(0f, num + 10f, 64f, 32f), LanguageDatabase.activeLanguage.icon)) { List <FloatMenuOption> list3 = new List <FloatMenuOption>(); foreach (LoadedLanguage current in LanguageDatabase.AllLoadedLanguages) { LoadedLanguage localLang = current; list3.Add(new FloatMenuOption(localLang.FriendlyNameNative, delegate { LanguageDatabase.SelectLanguage(localLang); Prefs.Save(); }, MenuOptionPriority.Medium, null, null)); } Find.WindowStack.Add(new FloatMenu(list3, false)); } GUI.EndGroup(); }