forked from cdaragorn/Ui-Info-Suite
-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
377 additions
and
236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
using Microsoft.Xna.Framework; | ||
using StardewModdingAPI; | ||
using StardewModdingAPI.Events; | ||
using StardewValley; | ||
using StardewValley.Menus; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using UIInfoSuite.Infrastructure; | ||
using UIInfoSuite.Infrastructure.Extensions; | ||
|
||
namespace UIInfoSuite.UIElements | ||
{ | ||
class ShowRainyDayIcon : IDisposable | ||
{ | ||
#region Properties | ||
private bool _IsNextDayRainy; | ||
Rectangle? _weatherIconSpriteLocation; | ||
private string _hoverText; | ||
private ClickableTextureComponent _rainyDayIcon; | ||
|
||
private readonly IModHelper _helper; | ||
#endregion | ||
|
||
#region Lifecycle | ||
public ShowRainyDayIcon(IModHelper helper) | ||
{ | ||
_helper = helper; | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
ToggleOption(false); | ||
} | ||
|
||
public void ToggleOption(bool showTravelingMerchant) | ||
{ | ||
_helper.Events.Display.RenderingHud -= OnRenderingHud; | ||
_helper.Events.Display.RenderedHud -= OnRenderedHud; | ||
|
||
if (showTravelingMerchant) | ||
{ | ||
_helper.Events.Display.RenderingHud += OnRenderingHud; | ||
_helper.Events.Display.RenderedHud += OnRenderedHud; | ||
} | ||
} | ||
#endregion | ||
|
||
#region Event subscriptions | ||
private void OnRenderingHud(object sender, RenderingHudEventArgs e) | ||
{ | ||
GetWeatherIconSpriteLocation(); | ||
|
||
// Draw icon | ||
if (!Game1.eventUp && _IsNextDayRainy && _weatherIconSpriteLocation.HasValue) | ||
{ | ||
Point iconPosition = IconHandler.Handler.GetNewIconPosition(); | ||
_rainyDayIcon = | ||
new ClickableTextureComponent( | ||
new Rectangle(iconPosition.X, iconPosition.Y, 40, 40), | ||
Game1.animations, | ||
_weatherIconSpriteLocation.Value, | ||
2f); | ||
_rainyDayIcon.draw(Game1.spriteBatch); | ||
} | ||
} | ||
|
||
private void OnRenderedHud(object sender, RenderedHudEventArgs e) | ||
{ | ||
// Show text on hover | ||
if (_IsNextDayRainy && (_rainyDayIcon?.containsPoint(Game1.getMouseX(), Game1.getMouseY()) ?? false) && !String.IsNullOrEmpty(_hoverText)) | ||
{ | ||
IClickableMenu.drawHoverText( | ||
Game1.spriteBatch, | ||
_hoverText, | ||
Game1.dialogueFont | ||
); | ||
} | ||
} | ||
#endregion | ||
|
||
#region Logic | ||
private void GetWeatherIconSpriteLocation() | ||
{ | ||
switch (Game1.weatherForTomorrow) | ||
{ | ||
case Game1.weather_sunny: | ||
case Game1.weather_debris: | ||
case Game1.weather_festival: | ||
case Game1.weather_wedding: | ||
_IsNextDayRainy = false; | ||
break; | ||
|
||
case Game1.weather_rain: | ||
_IsNextDayRainy = true; | ||
_weatherIconSpriteLocation = new Rectangle(268, 1750, 20, 20); | ||
_hoverText = _helper.SafeGetString(LanguageKeys.RainNextDay); | ||
break; | ||
|
||
case Game1.weather_lightning: | ||
_IsNextDayRainy = true; | ||
_weatherIconSpriteLocation = new Rectangle(272, 1641, 20, 20); | ||
_hoverText = _helper.SafeGetString(LanguageKeys.ThunderstormNextDay); | ||
break; | ||
|
||
case Game1.weather_snow: | ||
_IsNextDayRainy = true; | ||
_weatherIconSpriteLocation = new Rectangle(260, 680, 20, 20); | ||
_hoverText = _helper.SafeGetString(LanguageKeys.SnowNextDay); | ||
break; | ||
|
||
default: | ||
_IsNextDayRainy = false; | ||
break; | ||
} | ||
} | ||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,40 @@ | ||
{ | ||
"Billboard" : "Billboard", | ||
"Calendar" : "Calendar", | ||
"Days" : "days", | ||
"DaysToMature" : "days to mature", | ||
"FeelingLucky" : "You're feelin' lucky!!", | ||
"HarvestPrice" : "Harvest price", | ||
"Hours" : "hours", | ||
"LevelUp" : "Level Up", | ||
"LuckyButNotTooLucky" : "Feelin' lucky... but not too lucky", | ||
"MaybeStayHome" : "Maybe you should stay home today...", | ||
"Minutes" : "minutes", | ||
"NotFeelingLuckyAtAll" : "You're not feeling lucky at all today...", | ||
"ReadyToHarvest" : "Ready To Harvest!", | ||
"TodaysRecipe" : "Today's Recipe: ", | ||
"TravelingMerchantIsInTown" : "Traveling merchant is in town!", | ||
"DaysUntilToolIsUpgraded" : "{0} days until {1} is finished being upgraded", | ||
"ToolIsFinishedBeingUpgraded" : "{0} is finished!", | ||
"ShowLuckIcon" : "Show luck icon", | ||
"ShowLevelUpAnimation" : "Show level up animation", | ||
"ShowExperienceBar" : "Show experience bar", | ||
"AllowExperienceBarToFadeOut" : "Allow experience bar to fade out", | ||
"ShowExperienceGain" : "Show experience gain", | ||
"ShowLocationOfTownsPeople" : "Show townspeople on map", | ||
"ShowBirthdayIcon" : "Show Birthday icon", | ||
"ShowHeartFills" : "Show heart fills", | ||
"ShowAnimalsNeedPets" : "Show when animals need pets", | ||
"DisplayCalendarAndBillboard" : "Show calendar/billboard button", | ||
"ShowCropAndBarrelTooltip" : "Show crop and barrel times", | ||
"ShowItemEffectRanges" : "Show scarecrow and sprinkler range", | ||
"ShowExtraItemInformation" : "Show item hover information", | ||
"ShowTravelingMerchant" : "Show Traveling Merchant", | ||
"ShowHarvestPricesInShop" : "Show shop harvest prices", | ||
"ShowWhenNewRecipesAreAvailable" : "Show when new recipes are available", | ||
"ShowToolUpgradeStatus" : "Show tool upgrade status" | ||
"Billboard": "Billboard", | ||
"Calendar": "Calendar", | ||
"Days": "days", | ||
"DaysToMature": "days to mature", | ||
"FeelingLucky": "You're feelin' lucky!!", | ||
"HarvestPrice": "Harvest price", | ||
"Hours": "hours", | ||
"LevelUp": "Level Up", | ||
"LuckyButNotTooLucky": "Feelin' lucky... but not too lucky", | ||
"MaybeStayHome": "Maybe you should stay home today...", | ||
"Minutes": "minutes", | ||
"NotFeelingLuckyAtAll": "You're not feeling lucky at all today...", | ||
"ReadyToHarvest": "Ready To Harvest!", | ||
"TodaysRecipe": "Today's Recipe: ", | ||
"TravelingMerchantIsInTown": "Traveling merchant is in town!", | ||
"RainNextDay": "There will be rain tomorrow", | ||
"ThunderstormNextDay": "There will be a thunderstorm tomorrow", | ||
"SnowNextDay": "There will be snow tomorrow", | ||
"DaysUntilToolIsUpgraded": "{0} days until {1} is finished being upgraded", | ||
"ToolIsFinishedBeingUpgraded": "{0} is finished!", | ||
"ShowLuckIcon": "Show luck icon", | ||
"ShowLevelUpAnimation": "Show level up animation", | ||
"ShowExperienceBar": "Show experience bar", | ||
"AllowExperienceBarToFadeOut": "Allow experience bar to fade out", | ||
"ShowExperienceGain": "Show experience gain", | ||
"ShowLocationOfTownsPeople": "Show townspeople on map", | ||
"ShowBirthdayIcon": "Show Birthday icon", | ||
"ShowHeartFills": "Show heart fills", | ||
"ShowAnimalsNeedPets": "Show when animals need pets", | ||
"DisplayCalendarAndBillboard": "Show calendar/billboard button", | ||
"ShowCropAndBarrelTooltip": "Show crop and barrel times", | ||
"ShowItemEffectRanges": "Show scarecrow and sprinkler range", | ||
"ShowExtraItemInformation": "Show item hover information", | ||
"ShowTravelingMerchant": "Show Traveling Merchant", | ||
"ShowRainyDay": "Show rainy days", | ||
"ShowHarvestPricesInShop": "Show shop harvest prices", | ||
"ShowWhenNewRecipesAreAvailable": "Show when new recipes are available", | ||
"ShowToolUpgradeStatus": "Show tool upgrade status" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,37 @@ | ||
{ | ||
"Billboard" : "Tablón de anuncios", | ||
"Calendar" : "Calendario", | ||
"Days" : "días", | ||
"DaysToMature" : "días para madurar", | ||
"FeelingLucky" : "¡Tienes suerte!", | ||
"HarvestPrice" : "Precio de la cosecha", | ||
"Hours" : "horas", | ||
"LevelUp" : "Subida de nivel", | ||
"LuckyButNotTooLucky" : "Te sientes con suerte... aunque no demasiado", | ||
"MaybeStayHome" : "Tal vez deberías quedarte en casa hoy", | ||
"Minutes" : "minutos", | ||
"NotFeelingLuckyAtAll" : "No te sientes afortunado en absoluto...", | ||
"ReadyToHarvest" : "¡Listo para cosechar!", | ||
"TodaysRecipe" : "Receta de hoy: ", | ||
"TravelingMerchantIsInTown" : "¡El comerciante ambulante está en la zona!", | ||
"DaysUntilToolIsUpgraded" : "{0} días hasta que {1} termine de actualizarse", | ||
"ToolIsFinishedBeingUpgraded" : "¡{0} está terminado!", | ||
"ShowLuckIcon" : "Mostrar icono de suerte", | ||
"ShowLevelUpAnimation" : "Mostrar animación de subida de nivel", | ||
"ShowExperienceBar" : "Mostrar barra de experiencia", | ||
"AllowExperienceBarToFadeOut" : "Permitir que la barra de experiencia se desvanezca", | ||
"ShowExperienceGain" : "Mostrar ganancia de experiencia", | ||
"ShowLocationOfTownsPeople" : "Mostrar a la gente del pueblo en el mapa", | ||
"ShowBirthdayIcon" : "Mostrar icono de cumpleaños", | ||
"ShowHeartFills" : "Mostrar rellenos de corazón", | ||
"ShowAnimalsNeedPets" : "Mostrar si los animales necesitan caricias", | ||
"DisplayCalendarAndBillboard" : "Mostrar el botón de calendario/tablón", | ||
"ShowCropAndBarrelTooltip" : "Mostrar tiempo restante de cosechas y barriles", | ||
"ShowItemEffectRanges" : "Mostrar rango de espantapájaros y aspersores", | ||
"ShowExtraItemInformation" : "Mostrar información extra de objetos", | ||
"ShowTravelingMerchant" : "Mostrar comerciante ambulante", | ||
"ShowHarvestPricesInShop" : "Mostrar los precios de cosechas de la tienda", | ||
"ShowWhenNewRecipesAreAvailable" : "Mostrar cuando hay nuevas recetas disponibles", | ||
"ShowToolUpgradeStatus" : "Mostrar el estado de actualización de la herramienta" | ||
"Billboard": "Tablón de anuncios", | ||
"Calendar": "Calendario", | ||
"Days": "días", | ||
"DaysToMature": "días para madurar", | ||
"FeelingLucky": "¡Tienes suerte!", | ||
"HarvestPrice": "Precio de la cosecha", | ||
"Hours": "horas", | ||
"LevelUp": "Subida de nivel", | ||
"LuckyButNotTooLucky": "Te sientes con suerte... aunque no demasiado", | ||
"MaybeStayHome": "Tal vez deberías quedarte en casa hoy", | ||
"Minutes": "minutos", | ||
"NotFeelingLuckyAtAll": "No te sientes afortunado en absoluto...", | ||
"ReadyToHarvest": "¡Listo para cosechar!", | ||
"TodaysRecipe": "Receta de hoy: ", | ||
"TravelingMerchantIsInTown": "¡El comerciante ambulante está en la zona!", | ||
"DaysUntilToolIsUpgraded": "{0} días hasta que {1} termine de actualizarse", | ||
"ToolIsFinishedBeingUpgraded": "¡{0} está terminado!", | ||
"ShowLuckIcon": "Mostrar icono de suerte", | ||
"ShowLevelUpAnimation": "Mostrar animación de subida de nivel", | ||
"ShowExperienceBar": "Mostrar barra de experiencia", | ||
"AllowExperienceBarToFadeOut": "Permitir que la barra de experiencia se desvanezca", | ||
"ShowExperienceGain": "Mostrar ganancia de experiencia", | ||
"ShowLocationOfTownsPeople": "Mostrar a la gente del pueblo en el mapa", | ||
"ShowBirthdayIcon": "Mostrar icono de cumpleaños", | ||
"ShowHeartFills": "Mostrar rellenos de corazón", | ||
"ShowAnimalsNeedPets": "Mostrar si los animales necesitan caricias", | ||
"DisplayCalendarAndBillboard": "Mostrar el botón de calendario/tablón", | ||
"ShowCropAndBarrelTooltip": "Mostrar tiempo restante de cosechas y barriles", | ||
"ShowItemEffectRanges": "Mostrar rango de espantapájaros y aspersores", | ||
"ShowExtraItemInformation": "Mostrar información extra de objetos", | ||
"ShowTravelingMerchant": "Mostrar comerciante ambulante", | ||
"ShowRainyDay": "Show rainy days", // TODO | ||
"ShowHarvestPricesInShop": "Mostrar los precios de cosechas de la tienda", | ||
"ShowWhenNewRecipesAreAvailable": "Mostrar cuando hay nuevas recetas disponibles", | ||
"ShowToolUpgradeStatus": "Mostrar el estado de actualización de la herramienta" | ||
} |
Oops, something went wrong.