Пример #1
0
 /// <summary>
 /// Raised after a game menu is opened, closed, or replaced.
 /// Here it invoke the MailController to show a custom mail when the it's a LetterViewerMenu, called from open the mailbox and there is CustomMails to be delivered
 /// </summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event arguments.</param>
 private void OnMenuChanged(object sender, MenuChangedEventArgs e)
 {
     if (e.NewMenu is LetterViewerMenu && this.Helper.Reflection.GetField <string>(e.NewMenu, "mailTitle").GetValue() != null && MailController.HasCustomMail())
     {
         MailController.ShowLetter();
     }
 }
 /// <summary>
 /// Raised after the game begins a new day (including when the player loads a save).
 /// Here it updates the mail box.
 /// </summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event arguments.</param>
 private void OnDayStarted(object sender, DayStartedEventArgs e)
 {
     if (MailDao.HasRepositoryChanged())
     {
         Helper.Content.InvalidateCache("Data\\mail");
     }
     MailController.UpdateMailBox();
 }
 public static bool mailbox_prefix(GameLocation __instance)
 {
     if (Game1.player.mailbox.Count > 0)
     {
         if (Game1.player.mailbox.First <string>() == null)
         {
             Game1.player.mailbox.RemoveAt(0);
             return(false);
         }
         else if (Game1.player.mailbox.First <string>().Contains(CustomMailId))
         {
             Game1.player.mailbox.RemoveAt(0);
             MailController.ShowLetter();
             return(false);
         }
     }
     return(true);
 }
Пример #4
0
 public static bool mailbox(GameLocation __instance)
 {
     if (Game1.mailbox.Count > 0 && Game1.player.ActiveObject == null)
     {
         if (Game1.mailbox.First <string>() == null)
         {
             Game1.mailbox.RemoveAt(0);
             return(false);
         }
         else if (Game1.mailbox.First <string>().Contains(CustomMailId))
         {
             Game1.mailbox.RemoveAt(0);
             MailController.ShowLetter();
             return(false);
         }
         else
         {
             _events.Display.MenuChanged += OnMenuChanged;
         }
     }
     return(true);
 }
 /// <summary>
 /// Raised before the game begins writes data to the save file (except the initial save creation).
 /// </summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event arguments.</param>
 private void OnSaving(object sender, EventArgs e)
 {
     MailController.UnloadMailBox();
 }
 /// <summary>
 /// Raised after the game returns to the title screen.
 /// Unloads the menu changed method.
 /// </summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event arguments.</param>
 private void OnReturnedToTitle(object sender, ReturnedToTitleEventArgs e)
 {
     MailController.UnloadMailBox();
 }
Пример #7
0
 /// <summary>
 /// Raised after the game returns to the title screen.
 /// Unloads the menu changed method.
 /// </summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event arguments.</param>
 private void OnReturnedToTitle(object sender, ReturnedToTitleEventArgs e)
 {
     Helper.Events.Display.MenuChanged -= OnMenuChanged;
     MailController.UnloadMailBox();
 }
Пример #8
0
 /// <summary>
 /// To be invoked after returning to the title screen.
 /// Unloads the menu changed method.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SaveEvents_AfterReturnToTitle(object sender, EventArgs e)
 {
     MenuEvents.MenuChanged -= MenuEvents_MenuChanged;
     MailController.UnloadMailBox();
 }
Пример #9
0
 /// <summary>
 /// To be invoked before saving a game.
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TimeEvents_BeforeSave(object sender, EventArgs e)
 {
     MailController.UnloadMailBox();
 }
Пример #10
0
 /*********
 ** Private methods
 *********/
 /// <summary>
 /// The method invoked when the day starts.
 /// Here it updates the mail box.
 /// </summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event data.</param>
 private void TimeEvents_AfterDayStarted(object sender, EventArgs e)
 {
     MailController.UpdateMailBox();
 }
 /// <summary>
 /// Raised after the game begins a new day (including when the player loads a save).
 /// Here it updates the mail box.
 /// </summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event arguments.</param>
 private void OnDayStarted(object sender, DayStartedEventArgs e)
 {
     MailController.UpdateMailBox();
 }