public void RegisterModConfigMenu(IModHelper helper, IManifest manifest) { if (!helper.ModRegistry.IsLoaded("spacechase0.GenericModConfigMenu")) { return; } IGMCMAPI api = helper.ModRegistry.GetApi <IGMCMAPI>("spacechase0.GenericModConfigMenu"); api.RegisterModConfig(manifest, ResetToDefault, () => helper.WriteConfig(this)); api.SetDefaultIngameOptinValue(manifest, true); api.RegisterLabel(manifest, manifest.Name, manifest.Description); api.RegisterChoiceOption( manifest, helper.Translation.Get("cfg-warpsenabled.label"), helper.Translation.Get("cfg-warpsenabled.desc"), () => VanillaWarpsEnabled.ToString(), (string c) => VanillaWarpsEnabled = Utils.ParseEnum <WarpEnabled>(c), Enum.GetNames(typeof(WarpEnabled)) ); api.RegisterChoiceOption( manifest, helper.Translation.Get("cfg-farmenabled.label"), helper.Translation.Get("cfg-farmenabled.desc"), () => FarmWarpEnabled.ToString(), (string c) => FarmWarpEnabled = Utils.ParseEnum <WarpEnabled>(c), Enum.GetNames(typeof(WarpEnabled)) ); api.RegisterSimpleOption( manifest, helper.Translation.Get("cfg-accessdisabled.label"), helper.Translation.Get("cfg-accessdisabled.desc"), () => AccessFromDisabled, (bool b) => AccessFromDisabled = b ); api.RegisterSimpleOption( manifest, helper.Translation.Get("cfg-accesswand.label"), helper.Translation.Get("cfg-accesswand.desc"), () => AccessFromWand, (bool b) => AccessFromWand = b ); api.RegisterSimpleOption( manifest, helper.Translation.Get("cfg-obeliskpatch.label"), helper.Translation.Get("cfg-obeliskpatch.desc"), () => PatchObelisks, (bool b) => PatchObelisks = b ); api.RegisterSimpleOption( manifest, helper.Translation.Get("cfg-menu.label"), helper.Translation.Get("cfg-menu.desc"), () => MenuEnabled, (bool b) => MenuEnabled = b ); }
public bool register(IModHelper helper) { if (GetAPI(helper) == null) { return(false); } Api.RegisterModConfig(Manifest, () => { foreach (var option in Options) { option.ActiveIndex = option.DefaultIndex; } activeSound?.Stop(true); }, () => SaveHandler.Invoke("save", "file")); Api.RegisterClampedOption(Manifest, "MusicVolume", "", () => CustomMusicMod.config.MusicVolume, (f) => CustomMusicMod.config.MusicVolume = f, 0f, 1f); Api.RegisterClampedOption(Manifest, "SoundVolume", "", () => CustomMusicMod.config.SoundVolume, (f) => CustomMusicMod.config.SoundVolume = f, 0f, 1f); if (Label != null) { Api.RegisterLabel(Manifest, Label.Name, Label.Description); } foreach (var option in Options) { Api.RegisterChoiceOption(Manifest, option.Name, option.Description, () => { activeSound?.Stop(true); return(option.Choices[option.ActiveIndex]); }, (s) => { activeSound?.Stop(true); option.ActiveIndex = option.Choices.IndexOf(s); SaveHandler(option.Name, s); }, option.Choices.ToArray()); } Api.RegisterLabel(Manifest, "", ""); Api.RegisterLabel(Manifest, "", ""); Api.RegisterLabel(Manifest, "", ""); Api.RegisterLabel(Manifest, "", ""); Api.RegisterLabel(Manifest, "", ""); Api.RegisterLabel(Manifest, "", ""); Api.SubscribeToChange(Manifest, HandleChange); return(true); }
public bool register(IModHelper helper) { if (GetAPI(helper) == null) { return(false); } PatchGMCM(helper); Api.RegisterModConfig(Manifest, () => { foreach (var option in Options) { option.ActiveIndex = option.DefaultIndex; } activeSound?.Stop(true); }, () => SaveHandler.Invoke("save", "file")); if (Label != null) { Api.RegisterLabel(Manifest, Label.Name, Label.Description); } foreach (var option in Options) { Api.RegisterChoiceOption(Manifest, option.Name, option.Description, () => { activeSound?.Stop(true); return(option.Choices[option.ActiveIndex]); }, (s) => { activeSound?.Stop(true); option.ActiveIndex = option.Choices.IndexOf(s); SaveHandler(option.Name, s); }, option.Choices.ToArray()); } Api.RegisterLabel(Manifest, "", ""); Api.RegisterLabel(Manifest, "", ""); Api.RegisterLabel(Manifest, "", ""); Api.RegisterLabel(Manifest, "", ""); Api.RegisterLabel(Manifest, "", ""); Api.RegisterLabel(Manifest, "", ""); return(true); }
public void RegisterModConfigMenu(IModHelper helper, IManifest manifest) { if (!helper.ModRegistry.IsLoaded("spacechase0.GenericModConfigMenu")) { return; } IGMCMAPI api = helper.ModRegistry.GetApi <IGMCMAPI>("spacechase0.GenericModConfigMenu"); api.RegisterModConfig(manifest, ResetToDefault, () => helper.WriteConfig(this)); api.SetDefaultIngameOptinValue(manifest, true); api.RegisterLabel(manifest, manifest.Name, manifest.Description); api.RegisterSimpleOption( manifest, helper.Translation.Get("cfg-afterobelisk.label"), helper.Translation.Get("cfg-afterobelisk.desc"), () => AfterObelisk, (bool b) => AfterObelisk = b ); }