-
Notifications
You must be signed in to change notification settings - Fork 1
How to use
This page gives a broad overview of how to use this framework's objects to insert your mod's options into the StardewConfigMenu.
The first task your mod must do is connect to the StardewConfigMenu mod. To retrieve a reference to the menu we use SMAPI's Helper.ModRegistry.GetApi
method described here. We can guarantee the menu API is available by ensuring StardewConfigMenu is specified as a dependency for your mod and GetApi
is called after all mods are loaded.
After connecting, your mod must add your mod's option package. The SimpleOptionsPackage
or TabbedOptionsPackage
objects are your mod's container for all its tabs and their options. It allows for easy transport between the StardewConfigMenu and your mod, as well as providing modders with an easy way to retrieve settings after they've been added. Only one IOptionsPackage
object should be made per mod, adding any subsequent IOptionsPackage
objects to the menu will replace the original package.
An OptionsTab
is added to an IOptionsPackage
and contains ConfigOption
objects. Option Tabs allow for mods to further categorize their options into separate pages.
The ConfigOption
class is the base class for every type of option i.e. Toggle, Stepper, Dropdown etc. This base class cannot be created. Subclasses of ConfigOption
are created such as ConfigToggle
and added to an OptionsTab
object.
For more information on specific subclasses of ConfigOption
check their individual pages.