From e62610631d683c1a618bd91c40be6f2f4143bec2 Mon Sep 17 00:00:00 2001 From: JoshuaNavarro Date: Thu, 11 Apr 2019 17:25:54 -0700 Subject: [PATCH] Fixed render issue on billboard where player portrait and would appear over mouse and hover text. --- GeneralMods/HappyBirthday/BirthdayMessages.cs | 12 ++++----- .../Framework/MultiplayerSupport.cs | 2 ++ GeneralMods/HappyBirthday/HappyBirthday.cs | 27 ++++++++++++++----- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/GeneralMods/HappyBirthday/BirthdayMessages.cs b/GeneralMods/HappyBirthday/BirthdayMessages.cs index 149d522c..31ba55fe 100644 --- a/GeneralMods/HappyBirthday/BirthdayMessages.cs +++ b/GeneralMods/HappyBirthday/BirthdayMessages.cs @@ -67,8 +67,8 @@ namespace Omegasis.HappyBirthday public BirthdayMessages() { - createBirthdayGreetings(); - loadTranslationStrings(); + this.createBirthdayGreetings(); + this.loadTranslationStrings(); } @@ -111,10 +111,10 @@ namespace Omegasis.HappyBirthday }, [StardewValley.LocalizedContentManager.LanguageCode.ru] = new Dictionary() { - ["Mail:birthdayMom"] = "", - ["Mail:birthdayDad"] = "", - ["Happy Birthday: Star Message"] = "", - ["Happy Birthday: Farmhand Birthday Message"] = "" + ["Mail:birthdayMom"] = "ƒорогой @,^ — днем рождени¤, мо¤ радость. Ёто были замечательные моменты, когда ты выростал в доброго, трудолюбивого человека. я надеюсь, в твоей жизни будет куча превосходных моментов. ^ — любовью, мама ^ P.S. «десь находить небольшой подарок, который ¤ сделала дл¤ теб¤. %item object 221 1 %%", + ["Mail:birthdayDad"] = "ƒорогой @,^ — днем рождени¤, мой ребенок. «десь немного тихо в твой день рождени¤ с тех пор, как ты уехал на ферму, но тво¤ мать и ¤ знаем, что ты со своим дедушкой делаешь нас гордыми. ћы оба знаем, что жить на ферме может быть трудно, но мы верим в теб¤ на все 100%, просто продолжай следовать своим мечтам.^ — любовью папа ^ P.S. “ут есть немного денег, которые помогут тебе на ферме. ”дачи! %item money 5000 5001%%", + ["Happy Birthday: Star Message"] = "Ёто твой день рождени¤! — днем рождени¤!", + ["Happy Birthday: Farmhand Birthday Message"] = "Ёто твой день рождени¤! ѕоздравл¤ю с этим!" }, [StardewValley.LocalizedContentManager.LanguageCode.th] = new Dictionary() { diff --git a/GeneralMods/HappyBirthday/Framework/MultiplayerSupport.cs b/GeneralMods/HappyBirthday/Framework/MultiplayerSupport.cs index f6e9fa4b..04b3d417 100644 --- a/GeneralMods/HappyBirthday/Framework/MultiplayerSupport.cs +++ b/GeneralMods/HappyBirthday/Framework/MultiplayerSupport.cs @@ -14,6 +14,8 @@ namespace Omegasis.HappyBirthday.Framework str.Replace("@", Game1.player.name); HUDMessage message = new HUDMessage(str, 1); + + foreach (KeyValuePair f in Game1.otherFarmers) { HappyBirthday.ModHelper.Multiplayer.SendMessage(message.message, FSTRING_SendBirthdayMessageToOthers, new string[] { HappyBirthday.ModHelper.Multiplayer.ModID }, new long[] { f.Key }); diff --git a/GeneralMods/HappyBirthday/HappyBirthday.cs b/GeneralMods/HappyBirthday/HappyBirthday.cs index 3035f0f3..81a222d5 100644 --- a/GeneralMods/HappyBirthday/HappyBirthday.cs +++ b/GeneralMods/HappyBirthday/HappyBirthday.cs @@ -153,14 +153,14 @@ namespace Omegasis.HappyBirthday { this.othersBirthdays.Add(message.Key, message.Value); MultiplayerSupport.SendBirthdayInfoToConnectingPlayer(e.FromPlayerID); - this.Monitor.Log("Got other player's birthday data from: " + Game1.getFarmer(e.FromPlayerID).name); + this.Monitor.Log("Got other player's birthday data from: " + Game1.getFarmer(e.FromPlayerID).Name); } else { //Brute force update birthday info if it has already been recevived but dont send birthday info again. this.othersBirthdays.Remove(message.Key); this.othersBirthdays.Add(message.Key, message.Value); - this.Monitor.Log("Got other player's birthday data from: " + Game1.getFarmer(e.FromPlayerID).name); + this.Monitor.Log("Got other player's birthday data from: " + Game1.getFarmer(e.FromPlayerID).Name); } } } @@ -229,6 +229,13 @@ namespace Omegasis.HappyBirthday { int index = this.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); + (Game1.activeClickableMenu as Billboard).drawMouse(e.SpriteBatch); + + string hoverText = this.Helper.Reflection.GetField((Game1.activeClickableMenu as Billboard), "hoverText", true).GetValue(); + if (hoverText.Length > 0) + { + IClickableMenu.drawHoverText(Game1.spriteBatch, hoverText, Game1.dialogueFont, 0, 0, -1, (string)null, -1, (string[])null, (Item)null, 0, -1, -1, -1, -1, 1f, (CraftingRecipe)null); + } } } @@ -238,6 +245,13 @@ namespace Omegasis.HappyBirthday if (pair.Value.BirthdaySeason != Game1.currentSeason.ToLower()) continue; //Hide out of season birthdays. index = pair.Value.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.getFarmer(pair.Key)); + (Game1.activeClickableMenu as Billboard).drawMouse(e.SpriteBatch); + + string hoverText=this.Helper.Reflection.GetField((Game1.activeClickableMenu as Billboard), "hoverText", true).GetValue(); + if (hoverText.Length > 0) + { + IClickableMenu.drawHoverText(Game1.spriteBatch, hoverText, Game1.dialogueFont, 0, 0, -1, (string)null, -1, (string[])null, (Item)null, 0, -1, -1, -1, -1, 1f, (CraftingRecipe)null); + } } } } @@ -326,7 +340,7 @@ namespace Omegasis.HappyBirthday if (PlayerBirthdayData != null) { - ModMonitor.Log("Send all birthday information from " + Game1.player.name); + ModMonitor.Log("Send all birthday information from " + Game1.player.Name); MultiplayerSupport.SendBirthdayInfoToOtherPlayers(); } //this.SeenEvent = false; @@ -347,6 +361,7 @@ namespace Omegasis.HappyBirthday /// The event arguments. private void OnUpdateTicked(object sender, UpdateTickedEventArgs e) { + if (!Context.IsWorldReady || Game1.eventUp || Game1.isFestival()) return; if (!this.HasChosenBirthday && Game1.activeClickableMenu == null && Game1.player.Name.ToLower() != "unnamed farmhand") @@ -364,11 +379,11 @@ namespace Omegasis.HappyBirthday { string starMessage = BirthdayMessages.GetTranslatedString("Happy Birthday: Star Message"); + + ModMonitor.Log(starMessage); Messages.ShowStarMessage(starMessage); MultiplayerSupport.SendBirthdayMessageToOtherPlayers(); - - - + Game1.player.mailbox.Add("birthdayMom"); Game1.player.mailbox.Add("birthdayDad");