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.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
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.7.18.0")]
[assembly: AssemblyFileVersion("1.7.18.0")]
[assembly: AssemblyVersion("1.7.20.0")]
[assembly: AssemblyFileVersion("1.7.20.0")]

View File

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

View File

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

View File

@ -1,7 +1,7 @@
{
"Name": "UI Info Suite",
"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.",
"UniqueID": "Cdaragorn.UiInfoSuite",
"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>