From 6a58c97831f44c752a62b2d2ef8a40b6949db284 Mon Sep 17 00:00:00 2001 From: FinneDude <41249406+FinneDude@users.noreply.github.com> Date: Fri, 29 Nov 2024 18:12:15 +0100 Subject: [PATCH 1/8] Update ModConfig.cs Add option to not show train content --- TrainInfo/ModConfig.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/TrainInfo/ModConfig.cs b/TrainInfo/ModConfig.cs index eefc9c9..fd83aa8 100644 --- a/TrainInfo/ModConfig.cs +++ b/TrainInfo/ModConfig.cs @@ -3,5 +3,6 @@ internal class ModConfig { public int NotificationTime { get; set; } = 1800; + public bool DisableTrainContentDisplay { get; set; } = false; } } From 8b86a43e97854db64cf63c0fe443e3be9ae09cb4 Mon Sep 17 00:00:00 2001 From: FinneDude <41249406+FinneDude@users.noreply.github.com> Date: Fri, 29 Nov 2024 19:02:57 +0100 Subject: [PATCH 2/8] Update ModConfig.cs --- TrainInfo/ModConfig.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TrainInfo/ModConfig.cs b/TrainInfo/ModConfig.cs index fd83aa8..0f8cccf 100644 --- a/TrainInfo/ModConfig.cs +++ b/TrainInfo/ModConfig.cs @@ -3,6 +3,6 @@ internal class ModConfig { public int NotificationTime { get; set; } = 1800; - public bool DisableTrainContentDisplay { get; set; } = false; + public bool ShowContent { get; set; } = false; } } From a15354368975e1d998e96942cb7c6317f3a5f87f Mon Sep 17 00:00:00 2001 From: FinneDude <41249406+FinneDude@users.noreply.github.com> Date: Fri, 29 Nov 2024 19:03:13 +0100 Subject: [PATCH 3/8] Update ModConfig.cs --- TrainInfo/ModConfig.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TrainInfo/ModConfig.cs b/TrainInfo/ModConfig.cs index 0f8cccf..e22fb03 100644 --- a/TrainInfo/ModConfig.cs +++ b/TrainInfo/ModConfig.cs @@ -3,6 +3,6 @@ internal class ModConfig { public int NotificationTime { get; set; } = 1800; - public bool ShowContent { get; set; } = false; + public bool ShowContent { get; set; } = true; } } From 371ac3234280ebba2e83ac06f16ed3e8d173839a Mon Sep 17 00:00:00 2001 From: FinneDude <41249406+FinneDude@users.noreply.github.com> Date: Fri, 29 Nov 2024 19:07:59 +0100 Subject: [PATCH 4/8] Update ModEntry.cs Add ShowContent to Generic Mod Config Menu --- TrainInfo/ModEntry.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/TrainInfo/ModEntry.cs b/TrainInfo/ModEntry.cs index 80f29f1..567ea2e 100644 --- a/TrainInfo/ModEntry.cs +++ b/TrainInfo/ModEntry.cs @@ -80,6 +80,13 @@ private void OnGameLaunched(object sender, GameLaunchedEventArgs e) 100, value => Game1.getTimeOfDayString(value) ); + configMenuApi.AddBoolOption( + ModManifest, + name: () => this.Helper.Translation.Get("config.option.show_content.name"), + tooltip: () => this.Helper.Translation.Get("config.option.show_content.description"), + getValue: () => Config.ShowContent, + setValue: value => Config.ShowContent = value + ); } } @@ -214,4 +221,4 @@ public void DisplayTrainContents(Dictionary trainItems) Game1.addHUDMessage(trainContentsMessage); } } -} \ No newline at end of file +} From 45ba8f8b1bf936e6188d3383ca2b284ac14f2095 Mon Sep 17 00:00:00 2001 From: FinneDude <41249406+FinneDude@users.noreply.github.com> Date: Fri, 29 Nov 2024 19:12:01 +0100 Subject: [PATCH 5/8] Update ModEntry.cs Check for Content.ShowContent before displaying train contents --- TrainInfo/ModEntry.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/TrainInfo/ModEntry.cs b/TrainInfo/ModEntry.cs index 567ea2e..67d2d6f 100644 --- a/TrainInfo/ModEntry.cs +++ b/TrainInfo/ModEntry.cs @@ -211,14 +211,17 @@ public void HandleTrainContents(Train train) public void DisplayTrainContents(Dictionary trainItems) { - string message = string.Join(Environment.NewLine, trainItems.Select(item => $"{item.Value} {ItemRegistry.Create(item.Key).DisplayName}")); - message = string.IsNullOrEmpty(message) ? this.Helper.Translation.Get("empty_train") : message; - CustomHUDMessage trainContentsMessage = new(message) + if (Config.ShowContent) { - timeLeft = 7000f, - titleText = this.Helper.Translation.Get("list_title") - }; - Game1.addHUDMessage(trainContentsMessage); + string message = string.Join(Environment.NewLine, trainItems.Select(item => $"{item.Value} {ItemRegistry.Create(item.Key).DisplayName}")); + message = string.IsNullOrEmpty(message) ? this.Helper.Translation.Get("empty_train") : message; + CustomHUDMessage trainContentsMessage = new(message) + { + timeLeft = 7000f, + titleText = this.Helper.Translation.Get("list_title") + }; + Game1.addHUDMessage(trainContentsMessage); + } } } } From 3427053ac69557853723d73c37849c111c0694d1 Mon Sep 17 00:00:00 2001 From: FinneDude <41249406+FinneDude@users.noreply.github.com> Date: Fri, 29 Nov 2024 19:15:49 +0100 Subject: [PATCH 6/8] Update default.json Added config.option.show_content --- TrainInfo/i18n/default.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/TrainInfo/i18n/default.json b/TrainInfo/i18n/default.json index f60d14d..e6eadbb 100644 --- a/TrainInfo/i18n/default.json +++ b/TrainInfo/i18n/default.json @@ -1,8 +1,10 @@ { "config.option.notification_time.name": "Train tomorrow notification time", "config.option.notification_time.description": "When to display the notification that a train is coming tomorrow", + "config.option.show_content.name": "Display train content", + "config.option.show_content.description": "Set to false, if you don't want to see a message about the content of the coming train", "list_title": "Train Contents", "train_today": "A train will be passing through Stardew Valley today at {{time}}", "train_tomorrow": "A train will be passing through Stardew Valley tomorrow at {{time}}", "empty_train": "None" -} \ No newline at end of file +} From e09a507915df3a6650350f27b2096bc1705b9b23 Mon Sep 17 00:00:00 2001 From: FinneDude <41249406+FinneDude@users.noreply.github.com> Date: Fri, 29 Nov 2024 19:21:32 +0100 Subject: [PATCH 7/8] Update manifest.json Change manifest for FinneDude's testing --- TrainInfo/manifest.json | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/TrainInfo/manifest.json b/TrainInfo/manifest.json index 4e004d7..99c87de 100644 --- a/TrainInfo/manifest.json +++ b/TrainInfo/manifest.json @@ -1,13 +1,11 @@ { - "Name": "Train Info", - "Author": "BinaryLip", - "Version": "1.0.1", - "Description": "Displays a popup of what's going to be in the train passing through Stardew Valley", - "UniqueID": "BinaryLip.TrainInfo", + "Name": "Train Info Test", + "Author": "FinneDude", + "Version": "1.0", + "Description": "Attempt to add config options to BinaryLip's Train Info", + "UniqueID": "FinneDude.TrainInfo", "EntryDll": "TrainInfo.dll", "MinimumApiVersion": "4.0.0", "UpdateKeys": [ - "Nexus:21883", - "CurseForge:1035850" ] -} \ No newline at end of file +} From 498e3e2469ab68e0a3c8ce04c93294e30baddf7e Mon Sep 17 00:00:00 2001 From: FinneDude <41249406+FinneDude@users.noreply.github.com> Date: Fri, 29 Nov 2024 20:20:23 +0100 Subject: [PATCH 8/8] Update manifest.json Reverted manifest to before I did anything --- TrainInfo/manifest.json | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/TrainInfo/manifest.json b/TrainInfo/manifest.json index 99c87de..4c134f1 100644 --- a/TrainInfo/manifest.json +++ b/TrainInfo/manifest.json @@ -1,11 +1,13 @@ { - "Name": "Train Info Test", - "Author": "FinneDude", - "Version": "1.0", - "Description": "Attempt to add config options to BinaryLip's Train Info", - "UniqueID": "FinneDude.TrainInfo", + "Name": "Train Info", + "Author": "BinaryLip", + "Version": "1.0.1", + "Description": "Displays a popup of what's going to be in the train passing through Stardew Valley", + "UniqueID": "BinaryLip.TrainInfo", "EntryDll": "TrainInfo.dll", "MinimumApiVersion": "4.0.0", "UpdateKeys": [ + "Nexus:21883", + "CurseForge:1035850" ] }