More moving back multiplayer.

This commit is contained in:
cdaragorn 2018-05-20 17:46:44 -06:00
parent 5fdce677b4
commit 4058de9ed0
2 changed files with 10 additions and 13 deletions

View File

@ -34,15 +34,13 @@ namespace UIInfoSuite.UIElements
private void CheckIfGiftHasBeenGiven(object sender, EventArgs e)
{
if (_birthdayNPC != null &&
Game1.player != null &&
Game1.player.friendshipData != null)
Game1.player != null)
{
Game1.player.friendshipData.FieldDict.TryGetValue(_birthdayNPC.Name, out var netRef);
//var birthdayNPCDetails = Game1.player.friendshipData.SafeGet(_birthdayNPC.name);
Friendship birthdayNPCDetails = netRef;
var birthdayNPCDetails = Game1.player.friendships.SafeGet(_birthdayNPC.name);
if (birthdayNPCDetails != null)
{
if (birthdayNPCDetails.GiftsToday == 1)
if (birthdayNPCDetails[3] == 1)
_birthdayNPC = null;
}
}
@ -95,14 +93,14 @@ namespace UIInfoSuite.UIElements
ClickableTextureComponent texture =
new ClickableTextureComponent(
_birthdayNPC.Name,
_birthdayNPC.name,
new Rectangle(
iconPosition.X - 7,
iconPosition.Y - 2,
(int)(16.0 * scale),
(int)(16.0 * scale)),
null,
_birthdayNPC.Name,
_birthdayNPC.name,
_birthdayNPC.Sprite.Texture,
headShot,
2f);
@ -111,7 +109,7 @@ namespace UIInfoSuite.UIElements
if (texture.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
{
String hoverText = String.Format("{0}'s Birthday", _birthdayNPC.Name);
String hoverText = String.Format("{0}'s Birthday", _birthdayNPC.name);
IClickableMenu.drawHoverText(
Game1.spriteBatch,
hoverText,

View File

@ -1,6 +1,5 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Netcode;
using StardewModdingAPI;
using StardewModdingAPI.Events;
using StardewValley;
@ -33,13 +32,13 @@ namespace UIInfoSuite.UIElements
public void ToggleOption(bool showWhenAnimalNeedsPet)
{
_timer.Stop();
PlayerEvents.Warped -= OnLocationChange;
LocationEvents.LocationsChanged -= OnLocationChange;
GraphicsEvents.OnPreRenderHudEvent -= DrawAnimalHasProduct;
if (showWhenAnimalNeedsPet)
{
_timer.Start();
PlayerEvents.Warped += OnLocationChange;
LocationEvents.LocationsChanged += OnLocationChange;
GraphicsEvents.OnPreRenderHudEvent += DrawAnimalHasProduct;
}
}
@ -95,7 +94,7 @@ namespace UIInfoSuite.UIElements
}
}
private void OnLocationChange(object sender, EventArgsPlayerWarped e)
private void OnLocationChange(object sender, EventArgsGameLocationsChanged e)
{
if (e.NewLocation is AnimalHouse ||
e.NewLocation is Farm)