Changes

Jump to navigation Jump to search
53 bytes added ,  13:00, 15 September 2019
m
Line 352: Line 352:  
===Send a letter===
 
===Send a letter===
   −
Before you can send any of your own custom mail you must use a class that implements (derives from) IAssetEditor to inject new mail content into Data\Mail.xnb. An example using SMAPI is shown below:
+
Before you can send any of your own custom mail you must use a class that implements (derives from) IAssetEditor to inject new mail content into "Data\Mail.xnb". It doesn't have to be a separate class as ModEntry can also implement IAssetEditor.  An example using a separate class is shown below:
    
<source lang="c#">
 
<source lang="c#">
Line 390: Line 390:     
<source lang="c#">
 
<source lang="c#">
        /// <summary>
+
    /// <summary>
        /// Fires after game is launched, right before first update tick. Happens once per game session (unrelated to loading saves).
+
    /// Fires after game is launched, right before first update tick. Happens once per game session (unrelated to loading saves).
        /// All mods are loaded and initialized at this point, so this is a good time to set up mod integrations.
+
    /// All mods are loaded and initialized at this point, so this is a good time to set up mod integrations.
        /// </summary>
+
    /// </summary>
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
+
    private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
+
    {
            Helper.Content.AssetEditors.Add(new MyModMail());
+
        Helper.Content.AssetEditors.Add(new MyModMail());
        }
+
    }
 
</source>
 
</source>
   Line 403: Line 403:     
<source lang="c#">
 
<source lang="c#">
        Game1.player.mailbox.Add("MyModMail1");
+
    Game1.player.mailbox.Add("MyModMail1");
        Game1.addMailForTomorrow("MyModMail2");
+
    Game1.addMailForTomorrow("MyModMail2");
 
</source>
 
</source>
   Line 416: Line 416:     
<source lang="c#">
 
<source lang="c#">
          Game1.player.mailReceived.Remove("MyModMail1");
+
    Game1.player.mailReceived.Remove("MyModMail1");
 
</source>
 
</source>
  
49

edits

Navigation menu