Beispiel #1
0
 public override void PreClose()
 {
     PSI.SaveSettings();
     PSI.Reinit();
     CloseButtonClicked = true;
     base.PreClose();
 }
Beispiel #2
0
        private void FillPageMain(Listing_Standard listing)
        {
            if (listing.DoTextButton("PSI.Settings.IconSet".Translate() + PSI.Settings.iconSet))
            {
                var options = PSI.IconSets.Select(setname => new FloatMenuOption(setname, () =>
                {
                    PSI.Settings.iconSet = setname;
                    PSI.Materials        = new Materials(setname);
                    PSI.Materials.ReloadTextures(true);
                })).ToList();
                Find.WindowStack.Add(new FloatMenu(options));
            }

            if (listing.DoTextButton("PSI.Settings.LoadPresetButton".Translate()))
            {
                var strArray = new string[0];
                var path     = _modPath + "/Presets/Complete/";
                if (Directory.Exists(path))
                {
                    strArray = Directory.GetFiles(path, "*.cfg");
                }
                var options = strArray.Select(setname => new FloatMenuOption(Path.GetFileNameWithoutExtension(setname), () =>
                {
                    try
                    {
                        PSI.Settings = XmlLoader.ItemFromXmlFile <ModSettings>(setname);
                        PSI.SaveSettings();
                        PSI.Reinit();
                    }
                    catch (IOException)
                    {
                        Log.Error("PSI.Settings.LoadPreset.UnableToLoad".Translate() + setname);
                    }
                })).ToList();
                Find.WindowStack.Add(new FloatMenu(options));
            }

            listing.DoGap();

            DoHeading(listing, "PSI.Settings.Advanced");

            if (listing.DoTextButton("PSI.Settings.VisibilityButton".Translate()))
            {
                Page = "showhide";
            }

            if (listing.DoTextButton("PSI.Settings.ArrangementButton".Translate()))
            {
                Page = "arrange";
            }

            if (!listing.DoTextButton("PSI.Settings.SensitivityButton".Translate()))
            {
                return;
            }

            Page = "limits";
        }