Fixed a lot of bugs. Updated for official multiplayer release. Started adding integration with level extender mod.
This commit is contained in:
parent
c92c20b6b6
commit
fd9c4f28ef
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace UIInfoSuite
|
||||
{
|
||||
public interface LEEvents
|
||||
{
|
||||
event EventHandler OnXPChanged;
|
||||
void raiseEvent();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace UIInfoSuite
|
||||
{
|
||||
public interface LevelExtenderInterface
|
||||
{
|
||||
int[] currentXP();
|
||||
int[] requiredXP();
|
||||
}
|
||||
}
|
|
@ -20,7 +20,6 @@ namespace UIInfoSuite
|
|||
{
|
||||
public class ModEntry : Mod
|
||||
{
|
||||
|
||||
private readonly SkipIntro _skipIntro = new SkipIntro();
|
||||
|
||||
private String _modDataFileName;
|
||||
|
@ -38,6 +37,11 @@ namespace UIInfoSuite
|
|||
|
||||
}
|
||||
|
||||
~ModEntry()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Entry(IModHelper helper)
|
||||
{
|
||||
//Helper = helper;
|
||||
|
@ -70,7 +74,7 @@ namespace UIInfoSuite
|
|||
|
||||
private void ReturnToTitle(object sender, EventArgs e)
|
||||
{
|
||||
_modOptionsPageHandler.Dispose();
|
||||
_modOptionsPageHandler?.Dispose();
|
||||
_modOptionsPageHandler = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.13.0")]
|
||||
[assembly: AssemblyFileVersion("1.7.13.0")]
|
||||
[assembly: AssemblyVersion("1.7.18.0")]
|
||||
[assembly: AssemblyFileVersion("1.7.18.0")]
|
||||
|
|
|
@ -71,6 +71,8 @@
|
|||
<Compile Include="Extensions\CollectionExtensions.cs" />
|
||||
<Compile Include="Extensions\ObjectExtensions.cs" />
|
||||
<Compile Include="LanguageKeys.cs" />
|
||||
<Compile Include="LEEvents.cs" />
|
||||
<Compile Include="LevelExtenderInterface.cs" />
|
||||
<Compile Include="ModConfig.cs" />
|
||||
<Compile Include="Options\ModOptionsCheckbox.cs" />
|
||||
<Compile Include="Options\ModOptionsPageButton.cs" />
|
||||
|
@ -151,7 +153,7 @@
|
|||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180630\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
|
||||
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="AfterBuild">
|
||||
|
@ -163,11 +165,11 @@
|
|||
<Copy SourceFiles="$(TargetDir)\$(TargetName).dll.mdb" DestinationFolder="$(ModPath)" Condition="Exists('$(TargetDir)\$(TargetName).dll.mdb')" />
|
||||
<Copy SourceFiles="$(ProjectDir)manifest.json" DestinationFolder="$(ModPath)" />
|
||||
</Target>
|
||||
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180630\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180630\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
|
||||
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180630\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180630\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -11,6 +11,7 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Media;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -21,15 +22,20 @@ namespace UIInfoSuite.UIElements
|
|||
{
|
||||
class ExperienceBar : IDisposable
|
||||
{
|
||||
|
||||
public interface LevelExtenderEvents
|
||||
{
|
||||
event EventHandler OnXPChanged;
|
||||
}
|
||||
|
||||
private const int MaxBarWidth = 175;
|
||||
|
||||
//private float _currentExperience = 0;
|
||||
private int[] _currentExperience = new int[5];
|
||||
private readonly List<ExperiencePointDisplay> _experiencePointDisplays = new List<ExperiencePointDisplay>();
|
||||
private GameLocation _currentLocation = new GameLocation();
|
||||
private readonly TimeSpan _levelUpPauseTime = TimeSpan.FromSeconds(2);
|
||||
private Color _iconColor = Color.White;
|
||||
private readonly Color _iconColor = Color.White;
|
||||
private Color _experienceFillColor = Color.Blue;
|
||||
private Rectangle _experienceIconPosition = new Rectangle(10, 428, 10, 10);
|
||||
private Item _previousItem = null;
|
||||
private bool _experienceBarShouldBeVisible = false;
|
||||
private bool _shouldDrawLevelUp = false;
|
||||
|
@ -44,6 +50,13 @@ namespace UIInfoSuite.UIElements
|
|||
private readonly IModHelper _helper;
|
||||
private SoundPlayer _player;
|
||||
|
||||
private LevelExtenderInterface _levelExtenderAPI;
|
||||
|
||||
private int _currentSkillLevel = 0;
|
||||
private int _experienceRequiredToLevel = -1;
|
||||
private int _experienceFromPreviousLevels = -1;
|
||||
private int _experienceEarnedThisLevel = -1;
|
||||
|
||||
public ExperienceBar(IModHelper helper)
|
||||
{
|
||||
_helper = helper;
|
||||
|
@ -64,6 +77,40 @@ namespace UIInfoSuite.UIElements
|
|||
_timeToDisappear.Elapsed += StopTimerAndFadeBarOut;
|
||||
GraphicsEvents.OnPreRenderHudEvent += OnPreRenderHudEvent;
|
||||
PlayerEvents.Warped += RemoveAllExperiencePointDisplays;
|
||||
|
||||
//var something = _helper.ModRegistry.GetApi("DevinLematty.LevelExtender");
|
||||
try
|
||||
{
|
||||
_levelExtenderAPI = _helper.ModRegistry.GetApi<LevelExtenderInterface>("DevinLematty.LevelExtender");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
int j = 4;
|
||||
}
|
||||
int f = 3;
|
||||
|
||||
//if (something != null)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// var methods = something.GetType().GetMethods();
|
||||
// var currentXPMethod = something.GetType().GetMethod("currentXP");
|
||||
|
||||
// foreach (var method in methods)
|
||||
// {
|
||||
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// int f = 3;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
private void LoadModApis(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
@ -71,8 +118,11 @@ namespace UIInfoSuite.UIElements
|
|||
PlayerEvents.LeveledUp -= OnLevelUp;
|
||||
GraphicsEvents.OnPreRenderHudEvent -= OnPreRenderHudEvent;
|
||||
PlayerEvents.Warped -= RemoveAllExperiencePointDisplays;
|
||||
GameEvents.QuarterSecondTick -= DetermineIfExperienceHasBeenGained;
|
||||
_timeToDisappear.Elapsed -= StopTimerAndFadeBarOut;
|
||||
_timeToDisappear.Stop();
|
||||
_timeToDisappear.Dispose();
|
||||
_timeToDisappear = null;
|
||||
}
|
||||
|
||||
public void ToggleLevelUpAnimation(bool showLevelUpAnimation)
|
||||
|
@ -93,21 +143,29 @@ namespace UIInfoSuite.UIElements
|
|||
|
||||
public void ToggleShowExperienceGain(bool showExperienceGain)
|
||||
{
|
||||
GameEvents.QuarterSecondTick -= DetermineIfExperienceHasBeenGained;
|
||||
for (int i = 0; i < _currentExperience.Length; ++i)
|
||||
_currentExperience[i] = Game1.player.experiencePoints[i];
|
||||
_showExperienceGain = showExperienceGain;
|
||||
|
||||
if (showExperienceGain)
|
||||
{
|
||||
GameEvents.QuarterSecondTick += DetermineIfExperienceHasBeenGained;
|
||||
}
|
||||
}
|
||||
|
||||
public void ToggleShowExperienceBar(bool showExperienceBar)
|
||||
{
|
||||
GameEvents.QuarterSecondTick -= DetermineIfExperienceHasBeenGained;
|
||||
//GraphicsEvents.OnPreRenderHudEvent -= OnPreRenderHudEvent;
|
||||
//PlayerEvents.Warped -= RemoveAllExperiencePointDisplays;
|
||||
_showExperienceBar = showExperienceBar;
|
||||
//if (showExperienceBar)
|
||||
//{
|
||||
if (showExperienceBar)
|
||||
{
|
||||
//GraphicsEvents.OnPreRenderHudEvent += OnPreRenderHudEvent;
|
||||
//PlayerEvents.Warped += RemoveAllExperiencePointDisplays;
|
||||
//}
|
||||
GameEvents.QuarterSecondTick += DetermineIfExperienceHasBeenGained;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnLevelUp(object sender, EventArgsLevelUp e)
|
||||
|
@ -123,9 +181,7 @@ namespace UIInfoSuite.UIElements
|
|||
case EventArgsLevelUp.LevelType.Mining: _levelUpIconRectangle.X = 30; break;
|
||||
}
|
||||
_shouldDrawLevelUp = true;
|
||||
_timeToDisappear.Interval = _timeBeforeExperienceBarFades.TotalMilliseconds;
|
||||
_timeToDisappear.Start();
|
||||
_experienceBarShouldBeVisible = true;
|
||||
ShowExperienceBar();
|
||||
|
||||
float previousAmbientVolume = Game1.options.ambientVolumeLevel;
|
||||
float previousMusicVolume = Game1.options.musicVolumeLevel;
|
||||
|
@ -160,7 +216,7 @@ namespace UIInfoSuite.UIElements
|
|||
|
||||
private void StopTimerAndFadeBarOut(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
_timeToDisappear.Stop();
|
||||
_timeToDisappear?.Stop();
|
||||
_experienceBarShouldBeVisible = false;
|
||||
}
|
||||
|
||||
|
@ -169,19 +225,11 @@ namespace UIInfoSuite.UIElements
|
|||
_experiencePointDisplays.Clear();
|
||||
}
|
||||
|
||||
private void OnPreRenderHudEvent(object sender, EventArgs e)
|
||||
{
|
||||
if (!Game1.eventUp)
|
||||
private void DetermineIfExperienceHasBeenGained(object sender, EventArgs e)
|
||||
{
|
||||
Item currentItem = Game1.player.CurrentItem;
|
||||
Rectangle rectangle1 = new Rectangle(10, 428, 10, 10);
|
||||
int experienceLevel = 0;
|
||||
|
||||
int currentLevelIndex = -1;
|
||||
int experienceRequiredToLevel = -1;
|
||||
int experienceFromPreviousLevels = -1;
|
||||
int experienceEarnedThisLevel = -1;
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < _currentExperience.Length; ++i)
|
||||
{
|
||||
|
@ -194,116 +242,137 @@ namespace UIInfoSuite.UIElements
|
|||
|
||||
if (currentLevelIndex > -1)
|
||||
{
|
||||
switch ((EventArgsLevelUp.LevelType)currentLevelIndex)
|
||||
switch (currentLevelIndex)
|
||||
{
|
||||
case EventArgsLevelUp.LevelType.Combat:
|
||||
{
|
||||
_experienceFillColor = new Color(204, 0, 3, 0.63f);
|
||||
rectangle1.X = 120;
|
||||
experienceLevel = Game1.player.combatLevel.Value;
|
||||
break;
|
||||
}
|
||||
|
||||
case EventArgsLevelUp.LevelType.Farming:
|
||||
case 0:
|
||||
{
|
||||
_experienceFillColor = new Color(255, 251, 35, 0.38f);
|
||||
rectangle1.X = 10;
|
||||
experienceLevel = Game1.player.farmingLevel.Value;
|
||||
_experienceIconPosition.X = 10;
|
||||
_currentSkillLevel = Game1.player.farmingLevel.Value;
|
||||
break;
|
||||
}
|
||||
|
||||
case EventArgsLevelUp.LevelType.Fishing:
|
||||
case 1:
|
||||
{
|
||||
_experienceFillColor = new Color(17, 84, 252, 0.63f);
|
||||
rectangle1.X = 20;
|
||||
experienceLevel = Game1.player.fishingLevel.Value;
|
||||
_experienceIconPosition.X = 20;
|
||||
_currentSkillLevel = Game1.player.fishingLevel.Value;
|
||||
break;
|
||||
}
|
||||
|
||||
case EventArgsLevelUp.LevelType.Foraging:
|
||||
case 2:
|
||||
{
|
||||
_experienceFillColor = new Color(0, 234, 0, 0.63f);
|
||||
rectangle1.X = 60;
|
||||
experienceLevel = Game1.player.foragingLevel.Value;
|
||||
_experienceIconPosition.X = 60;
|
||||
_currentSkillLevel = Game1.player.foragingLevel.Value;
|
||||
break;
|
||||
}
|
||||
|
||||
case EventArgsLevelUp.LevelType.Mining:
|
||||
case 3:
|
||||
{
|
||||
_experienceFillColor = new Color(145, 104, 63, 0.63f);
|
||||
rectangle1.X = 30;
|
||||
experienceLevel = Game1.player.miningLevel.Value;
|
||||
_experienceIconPosition.X = 30;
|
||||
_currentSkillLevel = Game1.player.miningLevel.Value;
|
||||
break;
|
||||
}
|
||||
|
||||
case 4:
|
||||
{
|
||||
_experienceFillColor = new Color(204, 0, 3, 0.63f);
|
||||
_experienceIconPosition.X = 120;
|
||||
_currentSkillLevel = Game1.player.combatLevel.Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
experienceRequiredToLevel = GetExperienceRequiredToLevel(experienceLevel);
|
||||
experienceFromPreviousLevels = GetExperienceRequiredToLevel(experienceLevel - 1);
|
||||
experienceEarnedThisLevel = Game1.player.experiencePoints[currentLevelIndex] - experienceFromPreviousLevels;
|
||||
int experiencePreviouslyEarnedThisLevel = _currentExperience[currentLevelIndex] - experienceFromPreviousLevels;
|
||||
_currentExperience[currentLevelIndex] = Game1.player.experiencePoints[currentLevelIndex];
|
||||
_experienceRequiredToLevel = GetExperienceRequiredToLevel(_currentSkillLevel);
|
||||
_experienceFromPreviousLevels = GetExperienceRequiredToLevel(_currentSkillLevel - 1);
|
||||
_experienceEarnedThisLevel = Game1.player.experiencePoints[currentLevelIndex] - _experienceFromPreviousLevels;
|
||||
int experiencePreviouslyEarnedThisLevel = _currentExperience[currentLevelIndex] - _experienceFromPreviousLevels;
|
||||
|
||||
if (_experienceRequiredToLevel <= 0 &&
|
||||
_levelExtenderAPI != null)
|
||||
{
|
||||
_experienceEarnedThisLevel = _levelExtenderAPI.currentXP()[currentLevelIndex];
|
||||
_experienceFromPreviousLevels = _currentExperience[currentLevelIndex] - _experienceEarnedThisLevel;
|
||||
_experienceRequiredToLevel = _levelExtenderAPI.requiredXP()[currentLevelIndex] + _experienceFromPreviousLevels;
|
||||
}
|
||||
|
||||
ShowExperienceBar();
|
||||
if (_showExperienceGain)
|
||||
if (_showExperienceGain &&
|
||||
_experienceRequiredToLevel > 0)
|
||||
{
|
||||
_experiencePointDisplays.Add(
|
||||
new ExperiencePointDisplay(
|
||||
experienceEarnedThisLevel - experiencePreviouslyEarnedThisLevel,
|
||||
Game1.player.experiencePoints[currentLevelIndex] - _currentExperience[currentLevelIndex],
|
||||
Game1.player.getLocalPosition(Game1.viewport)));
|
||||
}
|
||||
|
||||
_currentExperience[currentLevelIndex] = Game1.player.experiencePoints[currentLevelIndex];
|
||||
|
||||
}
|
||||
else
|
||||
else if (_previousItem != currentItem)
|
||||
{
|
||||
if (currentItem is FishingRod)
|
||||
{
|
||||
_experienceFillColor = new Color(17, 84, 252, 0.63f);
|
||||
currentLevelIndex = 1;
|
||||
rectangle1.X = 20;
|
||||
experienceLevel = Game1.player.fishingLevel.Value;
|
||||
_experienceIconPosition.X = 20;
|
||||
_currentSkillLevel = Game1.player.fishingLevel.Value;
|
||||
}
|
||||
else if (currentItem is Pickaxe)
|
||||
{
|
||||
_experienceFillColor = new Color(145, 104, 63, 0.63f);
|
||||
currentLevelIndex = 3;
|
||||
rectangle1.X = 30;
|
||||
experienceLevel = Game1.player.miningLevel.Value;
|
||||
_experienceIconPosition.X = 30;
|
||||
_currentSkillLevel = Game1.player.miningLevel.Value;
|
||||
}
|
||||
else if (currentItem is MeleeWeapon &&
|
||||
currentItem.Name != "Scythe")
|
||||
{
|
||||
_experienceFillColor = new Color(204, 0, 3, 0.63f);
|
||||
currentLevelIndex = 4;
|
||||
rectangle1.X = 120;
|
||||
experienceLevel = Game1.player.combatLevel.Value;
|
||||
_experienceIconPosition.X = 120;
|
||||
_currentSkillLevel = Game1.player.combatLevel.Value;
|
||||
}
|
||||
else if (Game1.currentLocation is Farm &&
|
||||
!(currentItem is Axe))
|
||||
{
|
||||
_experienceFillColor = new Color(255, 251, 35, 0.38f);
|
||||
currentLevelIndex = 0;
|
||||
rectangle1.X = 10;
|
||||
experienceLevel = Game1.player.farmingLevel.Value;
|
||||
_experienceIconPosition.X = 10;
|
||||
_currentSkillLevel = Game1.player.farmingLevel.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
_experienceFillColor = new Color(0, 234, 0, 0.63f);
|
||||
currentLevelIndex = 2;
|
||||
rectangle1.X = 60;
|
||||
experienceLevel = Game1.player.foragingLevel.Value;
|
||||
_experienceIconPosition.X = 60;
|
||||
_currentSkillLevel = Game1.player.foragingLevel.Value;
|
||||
}
|
||||
|
||||
experienceRequiredToLevel = GetExperienceRequiredToLevel(experienceLevel);
|
||||
experienceFromPreviousLevels = GetExperienceRequiredToLevel(experienceLevel - 1);
|
||||
experienceEarnedThisLevel = Game1.player.experiencePoints[currentLevelIndex] - experienceFromPreviousLevels;
|
||||
_experienceRequiredToLevel = GetExperienceRequiredToLevel(_currentSkillLevel);
|
||||
_experienceFromPreviousLevels = GetExperienceRequiredToLevel(_currentSkillLevel - 1);
|
||||
_experienceEarnedThisLevel = Game1.player.experiencePoints[currentLevelIndex] - _experienceFromPreviousLevels;
|
||||
|
||||
if (_experienceRequiredToLevel <= 0 &&
|
||||
_levelExtenderAPI != null)
|
||||
{
|
||||
_experienceEarnedThisLevel = _levelExtenderAPI.currentXP()[currentLevelIndex];
|
||||
_experienceFromPreviousLevels = _currentExperience[currentLevelIndex] - _experienceEarnedThisLevel;
|
||||
_experienceRequiredToLevel = _levelExtenderAPI.requiredXP()[currentLevelIndex] + _experienceFromPreviousLevels;
|
||||
}
|
||||
|
||||
if (_previousItem != currentItem)
|
||||
ShowExperienceBar();
|
||||
_previousItem = currentItem;
|
||||
}
|
||||
|
||||
_previousItem = currentItem;
|
||||
}
|
||||
|
||||
private void OnPreRenderHudEvent(object sender, EventArgs e)
|
||||
{
|
||||
if (!Game1.eventUp)
|
||||
{
|
||||
if (_shouldDrawLevelUp)
|
||||
{
|
||||
Vector2 playerLocalPosition = Game1.player.getLocalPosition(Game1.viewport);
|
||||
|
@ -342,13 +411,14 @@ namespace UIInfoSuite.UIElements
|
|||
}
|
||||
}
|
||||
|
||||
if (_experienceBarShouldBeVisible &&
|
||||
if (_experienceRequiredToLevel > 0 &&
|
||||
_experienceBarShouldBeVisible &&
|
||||
_showExperienceBar)
|
||||
{
|
||||
int experienceDifferenceBetweenLevels = experienceRequiredToLevel - experienceFromPreviousLevels;
|
||||
int barWidth = (int)((double)experienceEarnedThisLevel / experienceDifferenceBetweenLevels * MaxBarWidth);
|
||||
int experienceDifferenceBetweenLevels = _experienceRequiredToLevel - _experienceFromPreviousLevels;
|
||||
int barWidth = (int)((double)_experienceEarnedThisLevel / experienceDifferenceBetweenLevels * MaxBarWidth);
|
||||
|
||||
DrawExperienceBar(barWidth, experienceEarnedThisLevel, experienceDifferenceBetweenLevels, experienceLevel, rectangle1);
|
||||
DrawExperienceBar(barWidth, _experienceEarnedThisLevel, experienceDifferenceBetweenLevels, _currentSkillLevel);
|
||||
|
||||
}
|
||||
|
||||
|
@ -358,6 +428,9 @@ namespace UIInfoSuite.UIElements
|
|||
private int GetExperienceRequiredToLevel(int currentLevel)
|
||||
{
|
||||
int amount = 0;
|
||||
|
||||
//if (currentLevel < 10)
|
||||
//{
|
||||
switch (currentLevel)
|
||||
{
|
||||
case 0: amount = 100; break;
|
||||
|
@ -371,10 +444,19 @@ namespace UIInfoSuite.UIElements
|
|||
case 8: amount = 10000; break;
|
||||
case 9: amount = 15000; break;
|
||||
}
|
||||
//}
|
||||
//else if (_levelExtenderAPI != null &&
|
||||
// currentLevel < 100)
|
||||
//{
|
||||
// var requiredXP = _levelExtenderAPI.requiredXP();
|
||||
// amount = requiredXP[currentLevel];
|
||||
//}
|
||||
return amount;
|
||||
}
|
||||
|
||||
private void ShowExperienceBar()
|
||||
{
|
||||
if (_timeToDisappear != null)
|
||||
{
|
||||
if (_allowExperienceBarToFadeOut)
|
||||
{
|
||||
|
@ -385,11 +467,12 @@ namespace UIInfoSuite.UIElements
|
|||
{
|
||||
_timeToDisappear.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
_experienceBarShouldBeVisible = true;
|
||||
}
|
||||
|
||||
private void DrawExperienceBar(int barWidth, int experienceGainedThisLevel, int experienceRequiredForNextLevel, int currentLevel, Rectangle iconPosition)
|
||||
private void DrawExperienceBar(int barWidth, int experienceGainedThisLevel, int experienceRequiredForNextLevel, int currentLevel)
|
||||
{
|
||||
float leftSide = Game1.graphics.GraphicsDevice.Viewport.TitleSafeArea.Left;
|
||||
|
||||
|
@ -474,7 +557,7 @@ namespace UIInfoSuite.UIElements
|
|||
new Vector2(
|
||||
leftSide + 54,
|
||||
Game1.graphics.GraphicsDevice.Viewport.TitleSafeArea.Bottom - 62),
|
||||
iconPosition,
|
||||
_experienceIconPosition,
|
||||
_iconColor,
|
||||
0,
|
||||
Vector2.Zero,
|
||||
|
|
|
@ -49,6 +49,8 @@ namespace UIInfoSuite.UIElements
|
|||
GameMenu gameMenu = Game1.activeClickableMenu as GameMenu;
|
||||
|
||||
if (gameMenu.currentTab == 2)
|
||||
{
|
||||
if (_socialPage != null)
|
||||
{
|
||||
int slotPosition = (int)typeof(SocialPage)
|
||||
.GetField(
|
||||
|
@ -102,6 +104,11 @@ namespace UIInfoSuite.UIElements
|
|||
hoverText,
|
||||
Game1.smallFont);
|
||||
}
|
||||
else
|
||||
{
|
||||
OnMenuChange(sender, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,11 +16,13 @@ namespace UIInfoSuite.UIElements
|
|||
class ShowBirthdayIcon : IDisposable
|
||||
{
|
||||
private NPC _birthdayNPC;
|
||||
private ClickableTextureComponent _birthdayIcon;
|
||||
|
||||
public void ToggleOption(bool showBirthdayIcon)
|
||||
{
|
||||
TimeEvents.AfterDayStarted -= CheckForBirthday;
|
||||
GraphicsEvents.OnPreRenderHudEvent -= DrawBirthdayIcon;
|
||||
GraphicsEvents.OnPostRenderHudEvent -= DrawHoverText;
|
||||
GameEvents.HalfSecondTick -= CheckIfGiftHasBeenGiven;
|
||||
|
||||
if (showBirthdayIcon)
|
||||
|
@ -28,6 +30,7 @@ namespace UIInfoSuite.UIElements
|
|||
CheckForBirthday(null, null);
|
||||
TimeEvents.AfterDayStarted += CheckForBirthday;
|
||||
GraphicsEvents.OnPreRenderHudEvent += DrawBirthdayIcon;
|
||||
GraphicsEvents.OnPostRenderHudEvent += DrawHoverText;
|
||||
GameEvents.HalfSecondTick += CheckIfGiftHasBeenGiven;
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +97,7 @@ namespace UIInfoSuite.UIElements
|
|||
SpriteEffects.None,
|
||||
1f);
|
||||
|
||||
ClickableTextureComponent texture =
|
||||
_birthdayIcon =
|
||||
new ClickableTextureComponent(
|
||||
_birthdayNPC.Name,
|
||||
new Rectangle(
|
||||
|
@ -108,9 +111,15 @@ namespace UIInfoSuite.UIElements
|
|||
headShot,
|
||||
2f);
|
||||
|
||||
texture.draw(Game1.spriteBatch);
|
||||
_birthdayIcon.draw(Game1.spriteBatch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (texture.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
||||
private void DrawHoverText(object sender, EventArgs e)
|
||||
{
|
||||
if (_birthdayNPC != null &&
|
||||
_birthdayIcon.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
||||
{
|
||||
String hoverText = String.Format("{0}'s Birthday", _birthdayNPC.Name);
|
||||
IClickableMenu.drawHoverText(
|
||||
|
@ -121,5 +130,3 @@ namespace UIInfoSuite.UIElements
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,6 +144,7 @@ namespace UIInfoSuite.UIElements
|
|||
{
|
||||
if (_currentTile.bigCraftable.Value &&
|
||||
_currentTile.MinutesUntilReady > 0 &&
|
||||
_currentTile.heldObject.Value != null &&
|
||||
_currentTile.Name != "Heater")
|
||||
{
|
||||
StringBuilder hoverText = new StringBuilder();
|
||||
|
|
|
@ -23,11 +23,13 @@ namespace UIInfoSuite.UIElements
|
|||
private NPC _gus;
|
||||
private bool _drawQueenOfSauceIcon = false;
|
||||
private bool _drawDishOfDayIcon = false;
|
||||
private ClickableTextureComponent _queenOfSauceIcon;
|
||||
private readonly IModHelper _helper;
|
||||
|
||||
public void ToggleOption(bool showQueenOfSauceIcon)
|
||||
{
|
||||
GraphicsEvents.OnPreRenderHudEvent -= DrawIcon;
|
||||
GraphicsEvents.OnPostRenderHudEvent -= DrawHoverText;
|
||||
TimeEvents.AfterDayStarted -= CheckForNewRecipe;
|
||||
GameEvents.OneSecondTick -= CheckIfLearnedRecipe;
|
||||
|
||||
|
@ -37,6 +39,7 @@ namespace UIInfoSuite.UIElements
|
|||
CheckForNewRecipe(null, null);
|
||||
TimeEvents.AfterDayStarted += CheckForNewRecipe;
|
||||
GraphicsEvents.OnPreRenderHudEvent += DrawIcon;
|
||||
GraphicsEvents.OnPostRenderHudEvent += DrawHoverText;
|
||||
GameEvents.OneSecondTick += CheckIfLearnedRecipe;
|
||||
}
|
||||
}
|
||||
|
@ -145,21 +148,12 @@ namespace UIInfoSuite.UIElements
|
|||
{
|
||||
Point iconPosition = IconHandler.Handler.GetNewIconPosition();
|
||||
|
||||
ClickableTextureComponent texture = new ClickableTextureComponent(
|
||||
_queenOfSauceIcon = new ClickableTextureComponent(
|
||||
new Rectangle(iconPosition.X, iconPosition.Y, 40, 40),
|
||||
Game1.mouseCursors,
|
||||
new Rectangle(609, 361, 28, 28),
|
||||
1.3f);
|
||||
texture.draw(Game1.spriteBatch);
|
||||
|
||||
if (texture.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
||||
{
|
||||
IClickableMenu.drawHoverText(
|
||||
Game1.spriteBatch,
|
||||
_helper.SafeGetString(
|
||||
LanguageKeys.TodaysRecipe)+ _todaysRecipe,
|
||||
Game1.dialogueFont);
|
||||
}
|
||||
_queenOfSauceIcon.draw(Game1.spriteBatch);
|
||||
}
|
||||
|
||||
if (_drawDishOfDayIcon)
|
||||
|
@ -205,6 +199,19 @@ namespace UIInfoSuite.UIElements
|
|||
}
|
||||
}
|
||||
|
||||
private void DrawHoverText(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawQueenOfSauceIcon &&
|
||||
_queenOfSauceIcon.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
||||
{
|
||||
IClickableMenu.drawHoverText(
|
||||
Game1.spriteBatch,
|
||||
_helper.SafeGetString(
|
||||
LanguageKeys.TodaysRecipe) + _todaysRecipe,
|
||||
Game1.dialogueFont);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
ToggleOption(false);
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace UIInfoSuite.UIElements
|
|||
private Rectangle _toolTexturePosition;
|
||||
private String _hoverText;
|
||||
private Tool _toolBeingUpgraded;
|
||||
private ClickableTextureComponent _toolUpgradeIcon;
|
||||
|
||||
public ShowToolUpgradeStatus(IModHelper helper)
|
||||
{
|
||||
|
@ -28,6 +29,7 @@ namespace UIInfoSuite.UIElements
|
|||
public void ToggleOption(bool showToolUpgradeStatus)
|
||||
{
|
||||
GraphicsEvents.OnPreRenderHudEvent -= DrawToolUpgradeStatus;
|
||||
GraphicsEvents.OnPostRenderHudEvent -= DrawHoverText;
|
||||
TimeEvents.AfterDayStarted -= DayChanged;
|
||||
GameEvents.OneSecondTick -= CheckForMidDayChanges;
|
||||
|
||||
|
@ -35,6 +37,7 @@ namespace UIInfoSuite.UIElements
|
|||
{
|
||||
DayChanged(null, new EventArgsIntChanged(0, Game1.dayOfMonth));
|
||||
GraphicsEvents.OnPreRenderHudEvent += DrawToolUpgradeStatus;
|
||||
GraphicsEvents.OnPostRenderHudEvent += DrawHoverText;
|
||||
TimeEvents.AfterDayStarted += DayChanged;
|
||||
GameEvents.OneSecondTick += CheckForMidDayChanges;
|
||||
}
|
||||
|
@ -110,22 +113,26 @@ namespace UIInfoSuite.UIElements
|
|||
_toolBeingUpgraded != null)
|
||||
{
|
||||
Point iconPosition = IconHandler.Handler.GetNewIconPosition();
|
||||
ClickableTextureComponent textureComponent =
|
||||
_toolUpgradeIcon =
|
||||
new ClickableTextureComponent(
|
||||
new Rectangle(iconPosition.X, iconPosition.Y, 40, 40),
|
||||
Game1.toolSpriteSheet,
|
||||
_toolTexturePosition,
|
||||
2.5f);
|
||||
textureComponent.draw(Game1.spriteBatch);
|
||||
_toolUpgradeIcon.draw(Game1.spriteBatch);
|
||||
}
|
||||
}
|
||||
|
||||
if (textureComponent.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
||||
private void DrawHoverText(object sender, EventArgs e)
|
||||
{
|
||||
if (_toolBeingUpgraded != null &&
|
||||
_toolUpgradeIcon.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
||||
{
|
||||
IClickableMenu.drawHoverText(
|
||||
Game1.spriteBatch,
|
||||
_hoverText, Game1.dialogueFont);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
|
|
|
@ -17,21 +17,25 @@ namespace UIInfoSuite.UIElements
|
|||
class ShowTravelingMerchant : IDisposable
|
||||
{
|
||||
private bool _travelingMerchantIsHere = false;
|
||||
private ClickableTextureComponent _travelingMerchantIcon;
|
||||
private readonly IModHelper _helper;
|
||||
|
||||
public void ToggleOption(bool showTravelingMerchant)
|
||||
{
|
||||
GraphicsEvents.OnPreRenderHudEvent -= DrawTravelingMerchant;
|
||||
GraphicsEvents.OnPostRenderHudEvent -= DrawHoverText;
|
||||
TimeEvents.AfterDayStarted -= DayChanged;
|
||||
|
||||
if (showTravelingMerchant)
|
||||
{
|
||||
DayChanged(null, new EventArgsIntChanged(0, Game1.dayOfMonth));
|
||||
GraphicsEvents.OnPreRenderHudEvent += DrawTravelingMerchant;
|
||||
GraphicsEvents.OnPostRenderHudEvent += DrawHoverText;
|
||||
TimeEvents.AfterDayStarted += DayChanged;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ShowTravelingMerchant(IModHelper helper)
|
||||
{
|
||||
_helper = helper;
|
||||
|
@ -56,14 +60,20 @@ namespace UIInfoSuite.UIElements
|
|||
_travelingMerchantIsHere)
|
||||
{
|
||||
Point iconPosition = IconHandler.Handler.GetNewIconPosition();
|
||||
ClickableTextureComponent textureComponent =
|
||||
_travelingMerchantIcon =
|
||||
new ClickableTextureComponent(
|
||||
new Rectangle(iconPosition.X, iconPosition.Y, 40, 40),
|
||||
Game1.mouseCursors,
|
||||
new Rectangle(192, 1411, 20, 20),
|
||||
2f);
|
||||
textureComponent.draw(Game1.spriteBatch);
|
||||
if (textureComponent.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
||||
_travelingMerchantIcon.draw(Game1.spriteBatch);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawHoverText(object sender, EventArgs e)
|
||||
{
|
||||
if (_travelingMerchantIsHere &&
|
||||
_travelingMerchantIcon.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
||||
{
|
||||
string hoverText = _helper.SafeGetString(
|
||||
LanguageKeys.TravelingMerchantIsInTown);
|
||||
|
@ -74,4 +84,3 @@ namespace UIInfoSuite.UIElements
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"Name": "UI Info Suite",
|
||||
"Author": "Cdaragorn",
|
||||
"Version": "1.7.13",
|
||||
"Version": "1.7.18",
|
||||
"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",
|
||||
"MinimumApiVersion" : "2.6-beta",
|
||||
"MinimumApiVersion" : "2.6",
|
||||
"UpdateKeys": [ "Nexus:1150" ]
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180630" targetFramework="net45" />
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0" targetFramework="net45" />
|
||||
</packages>
|
Loading…
Reference in New Issue