Skip to content

Commit

Permalink
Bumped minor version
Browse files Browse the repository at this point in the history
Changed bounding of the Emoji box to prevent weird wrapping
Removed the redundant "Spirits" from the message since the icon is present
Changed "Stardew Valley" weather to simply "Pelican Town"
  • Loading branch information
GStefanowich committed Jul 3, 2022
1 parent e39ad58 commit ad1b1c5
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 14 deletions.
4 changes: 2 additions & 2 deletions ForecasterConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ public void RegisterConfigManager(IGenericModConfigMenuApi configMenu) {
this.AddWeatherDropdown(
() => this.ModConfig.StardewValleyWeather,
display => this.ModConfig.StardewValleyWeather = display,
"Stardew Valley",
"When to show the weather for Stardew Valley"
"Pelican Town",
"When to show the weather for Pelican Town"
);

this.AddWeatherDropdown(
Expand Down
2 changes: 1 addition & 1 deletion ForecasterText.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<AssemblyName>ForecasterText</AssemblyName>
<RootNamespace>ForecasterText</RootNamespace>
<Version>1.1.0</Version>
<Version>1.1.1</Version>
<TargetFramework>net5.0</TargetFramework>
<GamePath>/mnt/gaming/Steam/steamapps/common/Stardew Valley/</GamePath>
</PropertyGroup>
Expand Down
30 changes: 25 additions & 5 deletions Objects/ConfigEmojiMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ public override void OnDraw(SpriteBatch b, Vector2I vector) {
int offset = index + this.PageIndex;

// Get the emoji
ClickableComponent emoji = this.Emojis[index];
if (this.Emojis[index] is not ClickableComponent emoji || !this.WithinBounds(offset))
continue;

// Update the scale of the icon
bool selected = this.Value == offset;
Expand Down Expand Up @@ -139,12 +140,17 @@ protected override void OnClick(Vector2I bounds, Vector2I mouse) {

this.PageIndex = Math.Max(0, this.PageIndex - ConfigEmojiMenu.SHIFT);
this.UpArrow.scale = 0.75f;

this.ResetIcons();
} else if (mouse.IsIn(increase)) {
if (this.PageIndex != this.TotalEmojis - ConfigEmojiMenu.SHIFT)
if (this.PageIndex < this.TotalEmojis - ConfigEmojiMenu.SHIFT)
Game1.playSound("Cowboy_Footstep");

this.PageIndex = Math.Min(this.TotalEmojis - ConfigEmojiMenu.SHIFT, this.PageIndex + ConfigEmojiMenu.SHIFT);
this.PageIndex = Math.Min(this.PageIndex + ConfigEmojiMenu.SHIFT, ConfigEmojiMenu.SHIFT * (int)(Math.Floor((double)this.TotalEmojis / ConfigEmojiMenu.SHIFT)));
//this.PageIndex += ConfigEmojiMenu.SHIFT;
this.DownArrow.scale = 0.75f;

this.ResetIcons();
} else {
Vector2I relative = mouse - bounds;

Expand All @@ -154,21 +160,35 @@ protected override void OnClick(Vector2I bounds, Vector2I mouse) {
if (top >= 0.0f && left >= 0.0f) {
uint column = (uint)Math.Floor(left);
uint row = (uint)Math.Floor(top);
int emote = (int)((row * ConfigEmojiMenu.PER_ROW) + column + this.PageIndex);

if (column <= ConfigEmojiMenu.PER_ROW && row <= ConfigEmojiMenu.ROWS) {
this.Value = (uint)((row * ConfigEmojiMenu.PER_ROW) + column + this.PageIndex);
if (column < ConfigEmojiMenu.PER_ROW && row < ConfigEmojiMenu.ROWS && this.WithinBounds(emote)) {
this.Value = (uint)emote;
Game1.playSound("coin");
}
}
}
}

public bool WithinBounds(int emote)
=> emote >= 0 && emote < this.TotalEmojis;

public void ResetView() {
this.PageIndex = 0;

// Make sure we scroll the current emoji into view by default
while (this.Value > this.PageIndex + ConfigEmojiMenu.SHIFT)
this.PageIndex += ConfigEmojiMenu.SHIFT;

this.ResetIcons();
}

public void ResetIcons() {
// Reset the emoji scale
this.Emojis.ForEach(icon => icon.scale = 1.0f);

// Reset the pulse
this.Blinking.Reset();
}
}
}
3 changes: 2 additions & 1 deletion Objects/ConfigEmojiMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private void DrawShiftedVector(SpriteBatch b, Vector2I vector) {
b.DrawString(ChatBox.messageFont(this.Language), this.Snippets[index].message, new Vector2((float) vector.X + num1, (float) vector.Y + num2), this.Color * this.Alpha, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.99f);
}
num1 += this.Snippets[index].myLength;
if ((double) num1 >= 888.0) {
if ((double) num1 >= 888.0d) {
num1 = 0.0f;
num2 += ChatBox.messageFont(this.Language).MeasureString("(").Y;
if (this.Snippets.Count > index + 1 && this.Snippets[index + 1].message != null && this.Snippets[index + 1].message.Equals(Environment.NewLine))
Expand All @@ -91,6 +91,7 @@ private void UpdateText() {
try {
// Clear the snippets
this.Snippets.Clear();
this.Snippets.Add(new ChatSnippet("> TV: ", this.Language));
if (this.Setter is {} renderer && renderer(this) is {} ienumerable)
this.Snippets.AddRange(ienumerable);
} finally {
Expand Down
7 changes: 3 additions & 4 deletions TVEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@ private string GetTownForecast() {
return this.GetTownForecast(!Game1.IsMasterGame ? Game1.getWeatherModificationsForDate(date, Game1.netWorldState.Value.WeatherForTomorrow) : Game1.getWeatherModificationsForDate(date, Game1.weatherForTomorrow));
}

public string GetTownForecast(int weather) {
return this.GetWeatherInformation(this.Config.StardewValleyWeather, "Pelican Town forecast", weather);
}
public string GetTownForecast(int weather)
=> this.GetWeatherInformation(this.Config.StardewValleyWeather, "Pelican Town forecast", weather);

private string GetIslandForecast() {
if (!ModEntry.PlayerBeenToIsland())
Expand Down Expand Up @@ -161,7 +160,7 @@ private string GetDailyLuck(Farmer who) {
}

public string GetDailyLuck(SpiritMoods mood)
=> $"[{this.Config.SpiritsEmoji}]spirits are[{this.ConfigManager.GetEmoji(mood)}]today";
=> $"[{this.Config.SpiritsEmoji}]are[{this.ConfigManager.GetEmoji(mood)}]today";

private SpiritMoods GetSpiritMood(Farmer who) {
if (who.team.sharedDailyLuck.Value == -0.12)
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Name": "Forecaster Text",
"Author": "TheElm",
"Version": "1.1.0",
"Version": "1.1.1",
"Description": "Receive messages from the News station every day",
"UniqueID": "TheElm.ForecasterText",
"EntryDll": "ForecasterText.dll",
Expand Down

0 comments on commit ad1b1c5

Please sign in to comment.