From 3523e14a504d244be6872901c25c4a541d38a9f2 Mon Sep 17 00:00:00 2001 From: RuiNtD Date: Fri, 13 Dec 2024 04:08:10 -0700 Subject: [PATCH] Update dependencies --- IGenericModConfigMenuApi.cs | 338 ++++++++++++++++++------------------ SVRichPresence.csproj | 2 +- 2 files changed, 172 insertions(+), 168 deletions(-) diff --git a/IGenericModConfigMenuApi.cs b/IGenericModConfigMenuApi.cs index d591489..6d38a55 100644 --- a/IGenericModConfigMenuApi.cs +++ b/IGenericModConfigMenuApi.cs @@ -7,171 +7,175 @@ namespace GenericModConfigMenu { - /// The API which lets other mods add a config UI through Generic Mod Config Menu. - public interface IGenericModConfigMenuApi - { - /********* - ** Methods - *********/ - /**** - ** Must be called first - ****/ - /// Register a mod whose config can be edited through the UI. - /// The mod's manifest. - /// Reset the mod's config to its default values. - /// Save the mod's current config to the config.json file. - /// Whether the options can only be edited from the title screen. - /// Each mod can only be registered once, unless it's deleted via before calling this again. - void Register(IManifest mod, Action reset, Action save, bool titleScreenOnly = false); - - - /**** - ** Basic options - ****/ - /// Add a section title at the current position in the form. - /// The mod's manifest. - /// The title text shown in the form. - /// The tooltip text shown when the cursor hovers on the title, or null to disable the tooltip. - void AddSectionTitle(IManifest mod, Func text, Func tooltip = null); - - /// Add a paragraph of text at the current position in the form. - /// The mod's manifest. - /// The paragraph text to display. - void AddParagraph(IManifest mod, Func text); - - /// Add an image at the current position in the form. - /// The mod's manifest. - /// The image texture to display. - /// The pixel area within the texture to display, or null to show the entire image. - /// The zoom factor to apply to the image. - void AddImage(IManifest mod, Func texture, Rectangle? texturePixelArea = null, int scale = Game1.pixelZoom); - - /// Add a boolean option at the current position in the form. - /// The mod's manifest. - /// Get the current value from the mod config. - /// Set a new value in the mod config. - /// The label text to show in the form. - /// The tooltip text shown when the cursor hovers on the field, or null to disable the tooltip. - /// The unique field ID for use with , or null to auto-generate a randomized ID. - void AddBoolOption(IManifest mod, Func getValue, Action setValue, Func name, Func tooltip = null, string fieldId = null); - - /// Add an integer option at the current position in the form. - /// The mod's manifest. - /// Get the current value from the mod config. - /// Set a new value in the mod config. - /// The label text to show in the form. - /// The tooltip text shown when the cursor hovers on the field, or null to disable the tooltip. - /// The minimum allowed value, or null to allow any. - /// The maximum allowed value, or null to allow any. - /// The interval of values that can be selected. - /// Get the display text to show for a value, or null to show the number as-is. - /// The unique field ID for use with , or null to auto-generate a randomized ID. - void AddNumberOption(IManifest mod, Func getValue, Action setValue, Func name, Func tooltip = null, int? min = null, int? max = null, int? interval = null, Func formatValue = null, string fieldId = null); - - /// Add a float option at the current position in the form. - /// The mod's manifest. - /// Get the current value from the mod config. - /// Set a new value in the mod config. - /// The label text to show in the form. - /// The tooltip text shown when the cursor hovers on the field, or null to disable the tooltip. - /// The minimum allowed value, or null to allow any. - /// The maximum allowed value, or null to allow any. - /// The interval of values that can be selected. - /// Get the display text to show for a value, or null to show the number as-is. - /// The unique field ID for use with , or null to auto-generate a randomized ID. - void AddNumberOption(IManifest mod, Func getValue, Action setValue, Func name, Func tooltip = null, float? min = null, float? max = null, float? interval = null, Func formatValue = null, string fieldId = null); - - /// Add a string option at the current position in the form. - /// The mod's manifest. - /// Get the current value from the mod config. - /// Set a new value in the mod config. - /// The label text to show in the form. - /// The tooltip text shown when the cursor hovers on the field, or null to disable the tooltip. - /// The values that can be selected, or null to allow any. - /// Get the display text to show for a value from , or null to show the values as-is. - /// The unique field ID for use with , or null to auto-generate a randomized ID. - void AddTextOption(IManifest mod, Func getValue, Action setValue, Func name, Func tooltip = null, string[] allowedValues = null, Func formatAllowedValue = null, string fieldId = null); - - /// Add a key binding at the current position in the form. - /// The mod's manifest. - /// Get the current value from the mod config. - /// Set a new value in the mod config. - /// The label text to show in the form. - /// The tooltip text shown when the cursor hovers on the field, or null to disable the tooltip. - /// The unique field ID for use with , or null to auto-generate a randomized ID. - void AddKeybind(IManifest mod, Func getValue, Action setValue, Func name, Func tooltip = null, string fieldId = null); - - /// Add a key binding list at the current position in the form. - /// The mod's manifest. - /// Get the current value from the mod config. - /// Set a new value in the mod config. - /// The label text to show in the form. - /// The tooltip text shown when the cursor hovers on the field, or null to disable the tooltip. - /// The unique field ID for use with , or null to auto-generate a randomized ID. - void AddKeybindList(IManifest mod, Func getValue, Action setValue, Func name, Func tooltip = null, string fieldId = null); - - - /**** - ** Multi-page management - ****/ - /// Start a new page in the mod's config UI, or switch to that page if it already exists. All options registered after this will be part of that page. - /// The mod's manifest. - /// The unique page ID. - /// The page title shown in its UI, or null to show the value. - /// You must also call to make the page accessible. This is only needed to set up a multi-page config UI. If you don't call this method, all options will be part of the mod's main config UI instead. - void AddPage(IManifest mod, string pageId, Func pageTitle = null); - - /// Add a link to a page added via at the current position in the form. - /// The mod's manifest. - /// The unique ID of the page to open when the link is clicked. - /// The link text shown in the form. - /// The tooltip text shown when the cursor hovers on the link, or null to disable the tooltip. - void AddPageLink(IManifest mod, string pageId, Func text, Func tooltip = null); - - - /**** - ** Advanced - ****/ - /// Add an option at the current position in the form using custom rendering logic. - /// The mod's manifest. - /// The label text to show in the form. - /// Draw the option in the config UI. This is called with the sprite batch being rendered and the pixel position at which to start drawing. - /// The tooltip text shown when the cursor hovers on the field, or null to disable the tooltip. - /// A callback raised just before the menu containing this option is opened. - /// A callback raised before the form's current values are saved to the config (i.e. before the save callback passed to ). - /// A callback raised after the form's current values are saved to the config (i.e. after the save callback passed to ). - /// A callback raised before the form is reset to its default values (i.e. before the reset callback passed to ). - /// A callback raised after the form is reset to its default values (i.e. after the reset callback passed to ). - /// A callback raised just before the menu containing this option is closed. - /// The pixel height to allocate for the option in the form, or null for a standard input-sized option. This is called and cached each time the form is opened. - /// The unique field ID for use with , or null to auto-generate a randomized ID. - /// The custom logic represented by the callback parameters is responsible for managing its own state if needed. For example, you can store state in a static field or use closures to use a state variable. - void AddComplexOption(IManifest mod, Func name, Action draw, Func tooltip = null, Action beforeMenuOpened = null, Action beforeSave = null, Action afterSave = null, Action beforeReset = null, Action afterReset = null, Action beforeMenuClosed = null, Func height = null, string fieldId = null); - - /// Set whether the options registered after this point can only be edited from the title screen. - /// The mod's manifest. - /// Whether the options can only be edited from the title screen. - /// This lets you have different values per-field. Most mods should just set it once in . - void SetTitleScreenOnlyForNextOptions(IManifest mod, bool titleScreenOnly); - - /// Register a method to notify when any option registered by this mod is edited through the config UI. - /// The mod's manifest. - /// The method to call with the option's unique field ID and new value. - /// Options use a randomized ID by default; you'll likely want to specify the fieldId argument when adding options if you use this. - void OnFieldChanged(IManifest mod, Action onChange); - - /// Open the config UI for a specific mod. - /// The mod's manifest. - void OpenModMenu(IManifest mod); - - /// Get the currently-displayed mod config menu, if any. - /// The manifest of the mod whose config menu is being shown, or null if not applicable. - /// The page ID being shown for the current config menu, or null if not applicable. This may be null even if a mod config menu is shown (e.g. because the mod doesn't have pages). - /// Returns whether a mod config menu is being shown. - bool TryGetCurrentMenu(out IManifest mod, out string page); - - /// Remove a mod from the config UI and delete all its options and pages. - /// The mod's manifest. - void Unregister(IManifest mod); - } + /// The API which lets other mods add a config UI through Generic Mod Config Menu. + public interface IGenericModConfigMenuApi + { + /********* + ** Methods + *********/ + /**** + ** Must be called first + ****/ + /// Register a mod whose config can be edited through the UI. + /// The mod's manifest. + /// Reset the mod's config to its default values. + /// Save the mod's current config to the config.json file. + /// Whether the options can only be edited from the title screen. + /// Each mod can only be registered once, unless it's deleted via before calling this again. + void Register(IManifest mod, Action reset, Action save, bool titleScreenOnly = false); + + + /**** + ** Basic options + ****/ + /// Add a section title at the current position in the form. + /// The mod's manifest. + /// The title text shown in the form. + /// The tooltip text shown when the cursor hovers on the title, or null to disable the tooltip. + void AddSectionTitle(IManifest mod, Func text, Func tooltip = null); + + /// Add a paragraph of text at the current position in the form. + /// The mod's manifest. + /// The paragraph text to display. + void AddParagraph(IManifest mod, Func text); + + /// Add an image at the current position in the form. + /// The mod's manifest. + /// The image texture to display. + /// The pixel area within the texture to display, or null to show the entire image. + /// The zoom factor to apply to the image. + void AddImage(IManifest mod, Func texture, Rectangle? texturePixelArea = null, int scale = Game1.pixelZoom); + + /// Add a boolean option at the current position in the form. + /// The mod's manifest. + /// Get the current value from the mod config. + /// Set a new value in the mod config. + /// The label text to show in the form. + /// The tooltip text shown when the cursor hovers on the field, or null to disable the tooltip. + /// The unique field ID for use with , or null to auto-generate a randomized ID. + void AddBoolOption(IManifest mod, Func getValue, Action setValue, Func name, Func tooltip = null, string fieldId = null); + + /// Add an integer option at the current position in the form. + /// The mod's manifest. + /// Get the current value from the mod config. + /// Set a new value in the mod config. + /// The label text to show in the form. + /// The tooltip text shown when the cursor hovers on the field, or null to disable the tooltip. + /// The minimum allowed value, or null to allow any. + /// The maximum allowed value, or null to allow any. + /// The interval of values that can be selected. + /// Get the display text to show for a value, or null to show the number as-is. + /// The unique field ID for use with , or null to auto-generate a randomized ID. + void AddNumberOption(IManifest mod, Func getValue, Action setValue, Func name, Func tooltip = null, int? min = null, int? max = null, int? interval = null, Func formatValue = null, string fieldId = null); + + /// Add a float option at the current position in the form. + /// The mod's manifest. + /// Get the current value from the mod config. + /// Set a new value in the mod config. + /// The label text to show in the form. + /// The tooltip text shown when the cursor hovers on the field, or null to disable the tooltip. + /// The minimum allowed value, or null to allow any. + /// The maximum allowed value, or null to allow any. + /// The interval of values that can be selected. + /// Get the display text to show for a value, or null to show the number as-is. + /// The unique field ID for use with , or null to auto-generate a randomized ID. + void AddNumberOption(IManifest mod, Func getValue, Action setValue, Func name, Func tooltip = null, float? min = null, float? max = null, float? interval = null, Func formatValue = null, string fieldId = null); + + /// Add a string option at the current position in the form. + /// The mod's manifest. + /// Get the current value from the mod config. + /// Set a new value in the mod config. + /// The label text to show in the form. + /// The tooltip text shown when the cursor hovers on the field, or null to disable the tooltip. + /// The values that can be selected, or null to allow any. + /// Get the display text to show for a value from , or null to show the values as-is. + /// The unique field ID for use with , or null to auto-generate a randomized ID. + void AddTextOption(IManifest mod, Func getValue, Action setValue, Func name, Func tooltip = null, string[] allowedValues = null, Func formatAllowedValue = null, string fieldId = null); + + /// Add a key binding at the current position in the form. + /// The mod's manifest. + /// Get the current value from the mod config. + /// Set a new value in the mod config. + /// The label text to show in the form. + /// The tooltip text shown when the cursor hovers on the field, or null to disable the tooltip. + /// The unique field ID for use with , or null to auto-generate a randomized ID. + void AddKeybind(IManifest mod, Func getValue, Action setValue, Func name, Func tooltip = null, string fieldId = null); + + /// Add a key binding list at the current position in the form. + /// The mod's manifest. + /// Get the current value from the mod config. + /// Set a new value in the mod config. + /// The label text to show in the form. + /// The tooltip text shown when the cursor hovers on the field, or null to disable the tooltip. + /// The unique field ID for use with , or null to auto-generate a randomized ID. + void AddKeybindList(IManifest mod, Func getValue, Action setValue, Func name, Func tooltip = null, string fieldId = null); + + + /**** + ** Multi-page management + ****/ + /// Start a new page in the mod's config UI, or switch to that page if it already exists. All options registered after this will be part of that page. + /// The mod's manifest. + /// The unique page ID. + /// The page title shown in its UI, or null to show the value. + /// You must also call to make the page accessible. This is only needed to set up a multi-page config UI. If you don't call this method, all options will be part of the mod's main config UI instead. + void AddPage(IManifest mod, string pageId, Func pageTitle = null); + + /// Add a link to a page added via at the current position in the form. + /// The mod's manifest. + /// The unique ID of the page to open when the link is clicked. + /// The link text shown in the form. + /// The tooltip text shown when the cursor hovers on the link, or null to disable the tooltip. + void AddPageLink(IManifest mod, string pageId, Func text, Func tooltip = null); + + + /**** + ** Advanced + ****/ + /// Add an option at the current position in the form using custom rendering logic. + /// The mod's manifest. + /// The label text to show in the form. + /// Draw the option in the config UI. This is called with the sprite batch being rendered and the pixel position at which to start drawing. + /// The tooltip text shown when the cursor hovers on the field, or null to disable the tooltip. + /// A callback raised just before the menu containing this option is opened. + /// A callback raised before the form's current values are saved to the config (i.e. before the save callback passed to ). + /// A callback raised after the form's current values are saved to the config (i.e. after the save callback passed to ). + /// A callback raised before the form is reset to its default values (i.e. before the reset callback passed to ). + /// A callback raised after the form is reset to its default values (i.e. after the reset callback passed to ). + /// A callback raised just before the menu containing this option is closed. + /// The pixel height to allocate for the option in the form, or null for a standard input-sized option. This is called and cached each time the form is opened. + /// The unique field ID for use with , or null to auto-generate a randomized ID. + /// The custom logic represented by the callback parameters is responsible for managing its own state if needed. For example, you can store state in a static field or use closures to use a state variable. + void AddComplexOption(IManifest mod, Func name, Action draw, Func tooltip = null, Action beforeMenuOpened = null, Action beforeSave = null, Action afterSave = null, Action beforeReset = null, Action afterReset = null, Action beforeMenuClosed = null, Func height = null, string fieldId = null); + + /// Set whether the options registered after this point can only be edited from the title screen. + /// The mod's manifest. + /// Whether the options can only be edited from the title screen. + /// This lets you have different values per-field. Most mods should just set it once in . + void SetTitleScreenOnlyForNextOptions(IManifest mod, bool titleScreenOnly); + + /// Register a method to notify when any option registered by this mod is edited through the config UI. + /// The mod's manifest. + /// The method to call with the option's unique field ID and new value. + /// Options use a randomized ID by default; you'll likely want to specify the fieldId argument when adding options if you use this. + void OnFieldChanged(IManifest mod, Action onChange); + + /// Open the config UI for a specific mod. + /// The mod's manifest. + void OpenModMenu(IManifest mod); + + /// Open the config UI for a specific mod, as a child menu if there is an existing menu. + /// The mod's manifest. + void OpenModMenuAsChildMenu(IManifest mod); + + /// Get the currently-displayed mod config menu, if any. + /// The manifest of the mod whose config menu is being shown, or null if not applicable. + /// The page ID being shown for the current config menu, or null if not applicable. This may be null even if a mod config menu is shown (e.g. because the mod doesn't have pages). + /// Returns whether a mod config menu is being shown. + bool TryGetCurrentMenu(out IManifest mod, out string page); + + /// Remove a mod from the config UI and delete all its options and pages. + /// The mod's manifest. + void Unregister(IManifest mod); + } } diff --git a/SVRichPresence.csproj b/SVRichPresence.csproj index 246033b..afe7114 100644 --- a/SVRichPresence.csproj +++ b/SVRichPresence.csproj @@ -4,7 +4,7 @@ ThirdParty - +