Changes

715 bytes removed ,  03:40, 28 November 2022
Line 403: Line 403:     
===Send a letter (using dynamic content)===
 
===Send a letter (using dynamic content)===
  −
To make uses of this class in your own project, thereby making the dynamic mail available, hook into the OnGameLaunch event, for example.
  −
  −
<syntaxhighlight lang="c#">
  −
    // Make this available to other methods in the class to access
  −
    private MailData mailData = new MailData();
  −
  −
    /// <summary>
  −
    /// 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.
  −
    /// </summary>
  −
    private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
  −
    {
  −
        Helper.Content.AssetEditors.Add(mailData);
  −
    }
  −
</syntaxhighlight>
      
You can hook into other events, such as "Day Starting" or "Day Ending" to generate the letter you want to send.  Consider this simple example, that is only for illustration purposes.
 
You can hook into other events, such as "Day Starting" or "Day Ending" to generate the letter you want to send.  Consider this simple example, that is only for illustration purposes.
528

edits