Some bug fixes.
This commit is contained in:
parent
459fd8124f
commit
d31f1a0827
|
@ -34,6 +34,7 @@ namespace UIInfoSuite
|
|||
helper.Events.GameLoop.Saved += OnSaved;
|
||||
helper.Events.GameLoop.ReturnedToTitle += OnReturnedToTitle;
|
||||
helper.Events.Display.Rendering += IconHandler.Handler.Reset;
|
||||
helper.Events.GameLoop.GameLaunched += GameLoop_GameLaunched;
|
||||
|
||||
//Resources = new ResourceManager("UIInfoSuite.Resource.strings", Assembly.GetAssembly(typeof(ModEntry)));
|
||||
//try
|
||||
|
@ -47,6 +48,11 @@ namespace UIInfoSuite
|
|||
//}
|
||||
}
|
||||
|
||||
private void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>Raised after the game returns to the title screen.</summary>
|
||||
/// <param name="sender">The event sender.</param>
|
||||
private void OnReturnedToTitle(object sender, ReturnedToTitleEventArgs e)
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.8.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.8.0.0")]
|
||||
[assembly: AssemblyVersion("1.8.3.0")]
|
||||
[assembly: AssemblyFileVersion("1.8.3.0")]
|
||||
|
|
|
@ -6,6 +6,7 @@ using StardewValley.Buildings;
|
|||
using StardewValley.Locations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace UIInfoSuite.UIElements
|
||||
{
|
||||
|
@ -15,6 +16,8 @@ namespace UIInfoSuite.UIElements
|
|||
private readonly ModConfig _modConfig;
|
||||
private readonly IModEvents _events;
|
||||
|
||||
private readonly Mutex _mutex = new Mutex();
|
||||
|
||||
private static readonly int[][] _junimoHutArray = new int[17][]
|
||||
{
|
||||
new int[17] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
|
||||
|
@ -67,10 +70,21 @@ namespace UIInfoSuite.UIElements
|
|||
if (!e.IsMultipleOf(4))
|
||||
return;
|
||||
|
||||
// check draw tile outlines
|
||||
_effectiveArea.Clear();
|
||||
if (_mutex.WaitOne())
|
||||
{
|
||||
try
|
||||
{
|
||||
// check draw tile outlines
|
||||
_effectiveArea.Clear();
|
||||
}
|
||||
finally
|
||||
{
|
||||
_mutex.ReleaseMutex();
|
||||
}
|
||||
|
||||
}
|
||||
if (Game1.activeClickableMenu == null &&
|
||||
!Game1.eventUp)
|
||||
!Game1.eventUp)
|
||||
{
|
||||
if (Game1.currentLocation is BuildableGameLocation buildableLocation)
|
||||
{
|
||||
|
@ -126,7 +140,7 @@ namespace UIInfoSuite.UIElements
|
|||
{
|
||||
arrayToUse = _modConfig.QualitySprinkler;
|
||||
}
|
||||
else if (name.Contains("prismatic"))
|
||||
else if (name.Contains("prismatic"))
|
||||
{
|
||||
arrayToUse = _modConfig.PrismaticSprinkler;
|
||||
}
|
||||
|
@ -153,10 +167,10 @@ namespace UIInfoSuite.UIElements
|
|||
{
|
||||
arrayToUse = _modConfig.QualitySprinkler;
|
||||
}
|
||||
else if (name.Contains("prismatic"))
|
||||
{
|
||||
arrayToUse = _modConfig.PrismaticSprinkler;
|
||||
}
|
||||
else if (name.Contains("prismatic"))
|
||||
{
|
||||
arrayToUse = _modConfig.PrismaticSprinkler;
|
||||
}
|
||||
else
|
||||
{
|
||||
arrayToUse = _modConfig.Sprinkler;
|
||||
|
@ -174,6 +188,7 @@ namespace UIInfoSuite.UIElements
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>Raised after the game draws to the sprite patch in a draw tick, just before the final sprite batch is rendered to the screen.</summary>
|
||||
|
@ -181,30 +196,51 @@ namespace UIInfoSuite.UIElements
|
|||
/// <param name="e">The event arguments.</param>
|
||||
private void OnRendered(object sender, RenderedEventArgs e)
|
||||
{
|
||||
// draw tile outlines
|
||||
foreach (Point point in _effectiveArea)
|
||||
Game1.spriteBatch.Draw(
|
||||
Game1.mouseCursors,
|
||||
Game1.GlobalToLocal(new Vector2(point.X * Game1.tileSize, point.Y * Game1.tileSize)),
|
||||
new Rectangle(194, 388, 16, 16),
|
||||
Color.White * 0.7f,
|
||||
0.0f,
|
||||
Vector2.Zero,
|
||||
Game1.pixelZoom,
|
||||
SpriteEffects.None,
|
||||
0.01f);
|
||||
if (_mutex.WaitOne(0))
|
||||
{
|
||||
try
|
||||
{
|
||||
// draw tile outlines
|
||||
foreach (Point point in _effectiveArea)
|
||||
Game1.spriteBatch.Draw(
|
||||
Game1.mouseCursors,
|
||||
Game1.GlobalToLocal(new Vector2(point.X * Game1.tileSize, point.Y * Game1.tileSize)),
|
||||
new Rectangle(194, 388, 16, 16),
|
||||
Color.White * 0.7f,
|
||||
0.0f,
|
||||
Vector2.Zero,
|
||||
Game1.pixelZoom,
|
||||
SpriteEffects.None,
|
||||
0.01f);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_mutex.ReleaseMutex();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ParseConfigToHighlightedArea(int[][] highlightedLocation, int xPos, int yPos)
|
||||
{
|
||||
int xOffset = highlightedLocation.Length / 2;
|
||||
for (int i = 0; i < highlightedLocation.Length; ++i)
|
||||
|
||||
if (_mutex.WaitOne())
|
||||
{
|
||||
int yOffset = highlightedLocation[i].Length / 2;
|
||||
for (int j = 0; j < highlightedLocation[i].Length; ++j)
|
||||
try
|
||||
{
|
||||
if (highlightedLocation[i][j] == 1)
|
||||
_effectiveArea.Add(new Point(xPos + i - xOffset, yPos + j - yOffset));
|
||||
for (int i = 0; i < highlightedLocation.Length; ++i)
|
||||
{
|
||||
int yOffset = highlightedLocation[i].Length / 2;
|
||||
for (int j = 0; j < highlightedLocation[i].Length; ++j)
|
||||
{
|
||||
if (highlightedLocation[i][j] == 1)
|
||||
_effectiveArea.Add(new Point(xPos + i - xOffset, yPos + j - yOffset));
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_mutex.ReleaseMutex();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,7 +139,8 @@ namespace UIInfoSuite.UIElements
|
|||
private void OnRenderedHud(object sender, RenderedHudEventArgs e)
|
||||
{
|
||||
// draw hover text
|
||||
if (_toolBeingUpgraded != null && _toolUpgradeIcon.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
||||
if (_toolBeingUpgraded != null &&
|
||||
(_toolUpgradeIcon?.containsPoint(Game1.getMouseX(), Game1.getMouseY()) ?? false))
|
||||
{
|
||||
IClickableMenu.drawHoverText(
|
||||
Game1.spriteBatch,
|
||||
|
|
|
@ -79,7 +79,7 @@ namespace UIInfoSuite.UIElements
|
|||
private void OnRenderedHud(object sender, RenderedHudEventArgs e)
|
||||
{
|
||||
// draw hover text
|
||||
if (_travelingMerchantIsHere && _travelingMerchantIcon.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
||||
if (_travelingMerchantIsHere && (_travelingMerchantIcon?.containsPoint(Game1.getMouseX(), Game1.getMouseY()) ?? false))
|
||||
{
|
||||
string hoverText = _helper.SafeGetString(
|
||||
LanguageKeys.TravelingMerchantIsInTown);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"Name": "UI Info Suite",
|
||||
"Author": "Cdaragorn",
|
||||
"Version": "1.8.0",
|
||||
"Version": "1.8.3",
|
||||
"Description": "Adds a lot of useful information to the user interface. This is based on Demiacle's excellent UIModSuite.",
|
||||
"UniqueID": "Cdaragorn.UiInfoSuite",
|
||||
"EntryDll": "UIInfoSuite.dll",
|
||||
|
|
Loading…
Reference in New Issue