Changes

Jump to navigation Jump to search
update for SMAPI 2.9
Line 100: Line 100:  
         public override void Entry(IModHelper helper)
 
         public override void Entry(IModHelper helper)
 
         {
 
         {
             InputEvents.ButtonPressed += this.InputEvents_ButtonPressed;
+
             helper.Events.Input.ButtonPressed += this.OnButtonPressed;
 
         }
 
         }
   Line 107: Line 107:  
         ** Private methods
 
         ** Private methods
 
         *********/
 
         *********/
         /// <summary>The method invoked when the player presses a controller, keyboard, or mouse button.</summary>
+
         /// <summary>Raised after the player presses a button on the keyboard, controller, or mouse.</summary>
 
         /// <param name="sender">The event sender.</param>
 
         /// <param name="sender">The event sender.</param>
 
         /// <param name="e">The event data.</param>
 
         /// <param name="e">The event data.</param>
         private void InputEvents_ButtonPressed(object sender, EventArgsInput e)
+
         private void OnButtonPressed(object sender, ButtonPressedEventArgs e)
 
         {
 
         {
 
             // ignore if player hasn't loaded a save yet
 
             // ignore if player hasn't loaded a save yet
Line 130: Line 130:  
# <code>public class ModEntry : Mod</code> (see [https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/class class keyword]) creates your mod's main class, and subclasses SMAPI's <tt>Mod</tt> class. SMAPI will detect your <tt>Mod</tt> subclass automatically, and <tt>Mod</tt> gives you access to SMAPI's APIs.
 
# <code>public class ModEntry : Mod</code> (see [https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/class class keyword]) creates your mod's main class, and subclasses SMAPI's <tt>Mod</tt> class. SMAPI will detect your <tt>Mod</tt> subclass automatically, and <tt>Mod</tt> gives you access to SMAPI's APIs.
 
# <code>public override void Entry(IModHelper helper)</code> is the method SMAPI will call when your mod is loaded into the game. The <code>helper</code> provides convenient access to many of SMAPI's APIs.
 
# <code>public override void Entry(IModHelper helper)</code> is the method SMAPI will call when your mod is loaded into the game. The <code>helper</code> provides convenient access to many of SMAPI's APIs.
# <code>InputEvents.ButtonPressed += this.InputEvents_ButtonPressed;</code> adds an 'event handler' (i.e. a method to call) when the button-pressed event happens. In other words, when a button is pressed (the <tt>InputEvents.ButtonPressed</tt> event), SMAPI will call your <tt>this.InputEvents_ButtonPressed</tt> method. See [[Modding:Modder Guide/APIs/Events|events in the SMAPI reference]] for more info.
+
# <code>helper.Events.Input.ButtonPressed += this.OnButtonPressed;</code> adds an 'event handler' (i.e. a method to call) when the button-pressed event happens. In other words, when a button is pressed (the <tt>helper.Events.Input.ButtonPressed</tt> event), SMAPI will call your <tt>this.OnButtonPressed</tt> method. See [[Modding:Modder Guide/APIs/Events|events in the SMAPI reference]] for more info.
    
===Add your manifest===
 
===Add your manifest===
Line 146: Line 146:  
   "UniqueID": "<your name>.<your project name>",
 
   "UniqueID": "<your name>.<your project name>",
 
   "EntryDll": "<your project name>.dll",
 
   "EntryDll": "<your project name>.dll",
   "MinimumApiVersion": "2.0",
+
   "MinimumApiVersion": "2.9",
 
   "UpdateKeys": []
 
   "UpdateKeys": []
 
}
 
}
translators
8,437

edits

Navigation menu