public override void PreRemove() { PSI.saveSettings(); PSI.reinit(); closeButtonClicked = true; base.PreRemove(); }
protected void fillPageMain(Listing_Standard listing) { //listing.DoHeading("General settings"); if (listing.DoTextButton(Translator.Translate("PSI.Settings.IconSet") + PSI.settings.iconSet)) { List <FloatMenuOption> options = new List <FloatMenuOption>(); foreach (string setname in PSI.iconSets) { options.Add(new FloatMenuOption(setname, () => { PSI.settings.iconSet = setname; PSI.materials = new Materials(setname); PSI.materials.reloadTextures(true); })); } Find.LayerStack.Add((Layer) new Layer_FloatMenu(options, false)); } if (listing.DoTextButton(Translator.Translate("PSI.Settings.LoadPresetButton"))) { string[] presetList = {}; String path2 = GenFilePaths.CoreModsFolderPath + "/Pawn State Icons/Presets/Complete/"; if (Directory.Exists(path2)) { presetList = Directory.GetFiles(path2, "*.cfg"); } List <FloatMenuOption> options = new List <FloatMenuOption>(); foreach (string setname in presetList) { options.Add(new FloatMenuOption(Path.GetFileNameWithoutExtension(setname), () => { try { PSI.settings = XmlLoader.ItemFromXmlFile <ModSettings>(setname, true); PSI.saveSettings(); PSI.reinit(); } catch (IOException) { Log.Error(Translator.Translate("PSI.Settings.LoadPreset.UnableToLoad") + setname); } })); } Find.LayerStack.Add((Layer) new Layer_FloatMenu(options, false)); } listing.DoGap(); DoHeading(listing, "PSI.Settings.Advanced"); if (listing.DoTextButton(Translator.Translate("PSI.Settings.VisibilityButton"))) { page = "showhide"; } if (listing.DoTextButton(Translator.Translate("PSI.Settings.ArrangementButton"))) { page = "arrange"; } if (listing.DoTextButton(Translator.Translate("PSI.Settings.SensitivityButton"))) { page = "limits"; } }