Fixed render issue on billboard where player portrait and would appear over mouse and hover text.

This commit is contained in:
JoshuaNavarro 2019-04-11 17:25:54 -07:00
parent 839a385b32
commit e62610631d
3 changed files with 29 additions and 12 deletions

View File

@ -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<string, string>()
{
["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<string, string>()
{

View File

@ -14,6 +14,8 @@ namespace Omegasis.HappyBirthday.Framework
str.Replace("@", Game1.player.name);
HUDMessage message = new HUDMessage(str, 1);
foreach (KeyValuePair<long, Farmer> f in Game1.otherFarmers)
{
HappyBirthday.ModHelper.Multiplayer.SendMessage<string>(message.message, FSTRING_SendBirthdayMessageToOthers, new string[] { HappyBirthday.ModHelper.Multiplayer.ModID }, new long[] { f.Key });

View File

@ -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<string>((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<string>((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
/// <param name="e">The event arguments.</param>
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,12 +379,12 @@ 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");