Changes

Jump to navigation Jump to search
m
Text replacement - "tt>" to "samp>"
Line 1: Line 1:  
{{../../header}}
 
{{../../header}}
   −
You can let users configure your mod through a standard <tt>config.json</tt> file. SMAPI will automatically create the file and take care of reading, normalising, and updating it.
+
You can let users configure your mod through a standard <samp>config.json</samp> file. SMAPI will automatically create the file and take care of reading, normalising, and updating it.
    
==Config model==
 
==Config model==
Line 14: Line 14:  
</syntaxhighlight>
 
</syntaxhighlight>
   −
That model would be saved to <tt>config.json</tt> with this content:
+
That model would be saved to <samp>config.json</samp> with this content:
 
<syntaxhighlight lang="json">
 
<syntaxhighlight lang="json">
 
{
 
{
Line 49: Line 49:     
==Using the config file==
 
==Using the config file==
To read the <tt>config.json</tt> (SMAPI will create it automatically):
+
To read the <samp>config.json</samp> (SMAPI will create it automatically):
    
<ol>
 
<ol>
 
<li>Create your [[#Config model|config model]].</li>
 
<li>Create your [[#Config model|config model]].</li>
<li>Access the config values in your <tt>ModEntry</tt> class:
+
<li>Access the config values in your <samp>ModEntry</samp> class:
 
<syntaxhighlight lang="c#">
 
<syntaxhighlight lang="c#">
 
/// <summary>The main entry point for the mod.</summary>
 
/// <summary>The main entry point for the mod.</summary>
Line 80: Line 80:  
</ol>
 
</ol>
   −
That's it! When the player launches the game, SMAPI will create the <tt>config.json</tt> file automatically if it doesn't exist yet, using the default config options you provided in your model. If you need to save some changes, you can use <tt>this.Helper.WriteConfig(this.Config)</tt>.
+
That's it! When the player launches the game, SMAPI will create the <samp>config.json</samp> file automatically if it doesn't exist yet, using the default config options you provided in your model. If you need to save some changes, you can use <samp>this.Helper.WriteConfig(this.Config)</samp>.
    
==Keybind settings==
 
==Keybind settings==
 
: {{main article|Modding:Modder Guide/APIs/Input}}
 
: {{main article|Modding:Modder Guide/APIs/Input}}
   −
You can use SMAPI's [[Modding:Modder Guide/APIs/Input#KeybindList|<tt>KeybindList</tt>]] in your model to let users configure keybinds. This automatically supports multi-key or alternative bindings (e.g. to support split-screen mode):
+
You can use SMAPI's [[Modding:Modder Guide/APIs/Input#KeybindList|<samp>KeybindList</samp>]] in your model to let users configure keybinds. This automatically supports multi-key or alternative bindings (e.g. to support split-screen mode):
    
<syntaxhighlight lang="c#">
 
<syntaxhighlight lang="c#">
Line 94: Line 94:  
</syntaxhighlight>
 
</syntaxhighlight>
   −
The value is automatically written/parsed in the <tt>config.json</tt> file as a string:
+
The value is automatically written/parsed in the <samp>config.json</samp> file as a string:
 
<syntaxhighlight lang="json">
 
<syntaxhighlight lang="json">
 
{
 
{
105,662

edits

Navigation menu