From fa04c757ed7e96e21039358dd2762b5975fd4f69 Mon Sep 17 00:00:00 2001 From: Joshua Navarro Date: Thu, 6 Dec 2018 00:41:28 -0800 Subject: [PATCH] Added player's birthday to billboard. Need to remove from request board and fix it for festival days. --- GeneralMods/HappyBirthday/GiftManager.cs | 5 ++++- GeneralMods/HappyBirthday/HappyBirthday.cs | 26 ++++++++-------------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/GeneralMods/HappyBirthday/GiftManager.cs b/GeneralMods/HappyBirthday/GiftManager.cs index 9c18d41e..9b79c4ee 100644 --- a/GeneralMods/HappyBirthday/GiftManager.cs +++ b/GeneralMods/HappyBirthday/GiftManager.cs @@ -129,7 +129,10 @@ namespace Omegasis.HappyBirthday } } - + /// + /// Used to load spouse birthday gifts from disk. + /// + /// public Dictionary loadSpouseBirthdayGifts() { throw new NotImplementedException(); diff --git a/GeneralMods/HappyBirthday/HappyBirthday.cs b/GeneralMods/HappyBirthday/HappyBirthday.cs index 80ace5cf..b9a7fca0 100644 --- a/GeneralMods/HappyBirthday/HappyBirthday.cs +++ b/GeneralMods/HappyBirthday/HappyBirthday.cs @@ -113,6 +113,8 @@ namespace Omegasis.HappyBirthday private void GraphicsEvents_OnPostRenderHudEvent(object sender, EventArgs e) { if (Game1.activeClickableMenu == null) return; + if (PlayerData == null) return; + if (PlayerData.BirthdaySeason == null) return; if (PlayerData.BirthdaySeason.ToLower() != Game1.currentSeason.ToLower()) return; if (Game1.activeClickableMenu is Billboard) { @@ -124,13 +126,18 @@ namespace Omegasis.HappyBirthday { if (clicky.containsPoint(Game1.getMouseX(), Game1.getMouseY())) { + if (String.IsNullOrEmpty(clicky.hoverText)) continue; hoverText += clicky.hoverText + Environment.NewLine; } + else + { + //hoverText = ""; + } } if (!String.IsNullOrEmpty(hoverText)) { - hoverText.Remove(hoverText.Length - 2, 1); + hoverText=hoverText.Remove(hoverText.Length - 2, 1); var oldText = Helper.Reflection.GetField(Game1.activeClickableMenu, "hoverText", true); oldText.SetValue(hoverText); } @@ -148,28 +155,13 @@ namespace Omegasis.HappyBirthday if (Game1.activeClickableMenu == null) return; //Don't do anything if birthday has not been chosen yet. if (PlayerData == null) return; - if (PlayerData.BirthdaySeason == null || PlayerData.BirthdayDay==0) return; + if (String.IsNullOrEmpty(PlayerData.BirthdaySeason)) return; if (PlayerData.BirthdaySeason.ToLower() != Game1.currentSeason.ToLower()) return; if (Game1.activeClickableMenu is Billboard) { int index = PlayerData.BirthdayDay; Game1.player.FarmerRenderer.drawMiniPortrat(Game1.spriteBatch, new Vector2(Game1.activeClickableMenu.xPositionOnScreen + 152 + (index - 1) % 7 * 32 * 4, Game1.activeClickableMenu.yPositionOnScreen + 230 + (index - 1) / 7 * 32 * 4), 0.5f, 4f, 2, Game1.player); - - string hoverText = ""; - foreach(var clicky in (Game1.activeClickableMenu as Billboard).calendarDays) - { - if (clicky.containsPoint(Game1.getMouseX(), Game1.getMouseY())) - { - hoverText += clicky.hoverText+Environment.NewLine; - } - } - if (hoverText != "") - { - var oldText=Helper.Reflection.GetField(Game1.activeClickableMenu, "hoverText", true); - oldText.SetValue(hoverText); - } - } }