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();
        }
示例#2
0
        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();
        }
示例#3
0
        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();
        }