Fixed mouse disappearing in one case. Updated version info.

This commit is contained in:
cdaragorn 2019-01-06 22:25:05 -07:00
parent e1fabeb4d5
commit b785ecae04
6 changed files with 64 additions and 25 deletions

View File

@ -79,6 +79,7 @@ namespace UIInfoSuite
writer.WriteEndElement(); writer.WriteEndElement();
} }
writer.WriteEndElement(); writer.WriteEndElement();
writer.Close();
} }
} }
} }

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.7.18.0")] [assembly: AssemblyVersion("1.7.20.0")]
[assembly: AssemblyFileVersion("1.7.18.0")] [assembly: AssemblyFileVersion("1.7.20.0")]

View File

@ -28,6 +28,7 @@ namespace UIInfoSuite.UIElements
private const int MaxBarWidth = 175; private const int MaxBarWidth = 175;
private int[] _currentExperience = new int[5]; private int[] _currentExperience = new int[5];
private int[] _currentLevelExtenderExperience = new int[5];
private readonly List<ExperiencePointDisplay> _experiencePointDisplays = new List<ExperiencePointDisplay>(); private readonly List<ExperiencePointDisplay> _experiencePointDisplays = new List<ExperiencePointDisplay>();
private readonly TimeSpan _levelUpPauseTime = TimeSpan.FromSeconds(2); private readonly TimeSpan _levelUpPauseTime = TimeSpan.FromSeconds(2);
private readonly Color _iconColor = Color.White; private readonly Color _iconColor = Color.White;
@ -75,7 +76,7 @@ namespace UIInfoSuite.UIElements
helper.Events.Display.RenderingHud += OnRenderingHud; helper.Events.Display.RenderingHud += OnRenderingHud;
helper.Events.Player.Warped += OnWarped_RemoveAllExperiencePointDisplays; helper.Events.Player.Warped += OnWarped_RemoveAllExperiencePointDisplays;
//var something = _helper.ModRegistry.GetApi("DevinLematty.LevelExtender"); var something = _helper.ModRegistry.GetApi("DevinLematty.LevelExtender");
try try
{ {
_levelExtenderAPI = _helper.ModRegistry.GetApi<LevelExtenderInterface>("DevinLematty.LevelExtender"); _levelExtenderAPI = _helper.ModRegistry.GetApi<LevelExtenderInterface>("DevinLematty.LevelExtender");
@ -145,12 +146,19 @@ namespace UIInfoSuite.UIElements
_currentExperience[i] = Game1.player.experiencePoints[i]; _currentExperience[i] = Game1.player.experiencePoints[i];
_showExperienceGain = showExperienceGain; _showExperienceGain = showExperienceGain;
if (_levelExtenderAPI != null)
{
for (int i = 0; i < _currentLevelExtenderExperience.Length; ++i)
_currentLevelExtenderExperience[i] = _levelExtenderAPI.currentXP()[i];
}
if (showExperienceGain) if (showExperienceGain)
{ {
_helper.Events.GameLoop.UpdateTicked += OnUpdateTicked_DetermineIfExperienceHasBeenGained; _helper.Events.GameLoop.UpdateTicked += OnUpdateTicked_DetermineIfExperienceHasBeenGained;
} }
} }
public void ToggleShowExperienceBar(bool showExperienceBar) public void ToggleShowExperienceBar(bool showExperienceBar)
{ {
_helper.Events.GameLoop.UpdateTicked -= OnUpdateTicked_DetermineIfExperienceHasBeenGained; _helper.Events.GameLoop.UpdateTicked -= OnUpdateTicked_DetermineIfExperienceHasBeenGained;
@ -241,9 +249,15 @@ namespace UIInfoSuite.UIElements
int currentLevelIndex = -1; int currentLevelIndex = -1;
int[] levelExtenderExperience = null;
if (_levelExtenderAPI != null)
levelExtenderExperience = _levelExtenderAPI.currentXP();
for (int i = 0; i < _currentExperience.Length; ++i) for (int i = 0; i < _currentExperience.Length; ++i)
{ {
if (_currentExperience[i] != Game1.player.experiencePoints[i]) if (_currentExperience[i] != Game1.player.experiencePoints[i] ||
(_levelExtenderAPI != null &&
_currentLevelExtenderExperience[i] != levelExtenderExperience[i]))
{ {
currentLevelIndex = i; currentLevelIndex = i;
break; break;
@ -311,15 +325,32 @@ namespace UIInfoSuite.UIElements
ShowExperienceBar(); ShowExperienceBar();
if (_showExperienceGain && if (_showExperienceGain &&
_experienceRequiredToLevel > 0) _experienceRequiredToLevel > 0)
{
int currentExperienceToUse = Game1.player.experiencePoints[currentLevelIndex];
int previousExperienceToUse = _currentExperience[currentLevelIndex];
if (_levelExtenderAPI != null &&
_currentSkillLevel > 9)
{
currentExperienceToUse = _levelExtenderAPI.currentXP()[currentLevelIndex];
previousExperienceToUse = _currentLevelExtenderExperience[currentLevelIndex];
}
int experienceGain = currentExperienceToUse - previousExperienceToUse;
if (experienceGain > 0)
{ {
_experiencePointDisplays.Add( _experiencePointDisplays.Add(
new ExperiencePointDisplay( new ExperiencePointDisplay(
Game1.player.experiencePoints[currentLevelIndex] - _currentExperience[currentLevelIndex], experienceGain,
Game1.player.getLocalPosition(Game1.viewport))); Game1.player.getLocalPosition(Game1.viewport)));
} }
}
_currentExperience[currentLevelIndex] = Game1.player.experiencePoints[currentLevelIndex]; _currentExperience[currentLevelIndex] = Game1.player.experiencePoints[currentLevelIndex];
if (_levelExtenderAPI != null)
_currentLevelExtenderExperience[currentLevelIndex] = _levelExtenderAPI.currentXP()[currentLevelIndex];
} }
else if (_previousItem != currentItem) else if (_previousItem != currentItem)
{ {

View File

@ -495,22 +495,25 @@ namespace UIInfoSuite.UIElements
4), 4),
Color.BurlyWood); Color.BurlyWood);
} }
//Game1.spriteBatch.Draw( if (!Game1.options.hardwareCursor)
// Game1.mouseCursors, {
// new Vector2( Game1.spriteBatch.Draw(
// Game1.getMouseX(), Game1.mouseCursors,
// Game1.getMouseY()), new Vector2(
// Game1.getSourceRectForStandardTileSheet( Game1.getMouseX(),
// Game1.mouseCursors, Game1.getMouseY()),
// Game1.mouseCursor, Game1.getSourceRectForStandardTileSheet(
// 16, Game1.mouseCursors,
// 16), Game1.mouseCursor,
// Color.White, 16,
// 0.0f, 16),
// Vector2.Zero, Color.White,
// Game1.pixelZoom + (Game1.dialogueButtonScale / 150.0f), 0.0f,
// SpriteEffects.None, Vector2.Zero,
// 1f); Game1.pixelZoom + (Game1.dialogueButtonScale / 150.0f),
SpriteEffects.None,
1f);
}
if (checkbox.bounds.Contains(Game1.getMouseX(), Game1.getMouseY())) if (checkbox.bounds.Contains(Game1.getMouseX(), Game1.getMouseY()))
IClickableMenu.drawHoverText( IClickableMenu.drawHoverText(

View File

@ -1,7 +1,7 @@
{ {
"Name": "UI Info Suite", "Name": "UI Info Suite",
"Author": "Cdaragorn", "Author": "Cdaragorn",
"Version": "1.7.18", "Version": "1.7.20",
"Description": "Adds a lot of useful information to the user interface. This is based on Demiacle's excellent UIModSuite.", "Description": "Adds a lot of useful information to the user interface. This is based on Demiacle's excellent UIModSuite.",
"UniqueID": "Cdaragorn.UiInfoSuite", "UniqueID": "Cdaragorn.UiInfoSuite",
"EntryDll": "UIInfoSuite.dll", "EntryDll": "UIInfoSuite.dll",

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.2.0" targetFramework="net45" />
</packages>