diff --git a/src/MusicAnnouncementsConfig.cs b/src/MusicAnnouncementsConfig.cs index 8a7a5c9..99b45f4 100644 --- a/src/MusicAnnouncementsConfig.cs +++ b/src/MusicAnnouncementsConfig.cs @@ -6,6 +6,7 @@ namespace MusicAnnouncements public class MusicAnnouncementsConfig : OptionInterface { public static Configurable pauseMenuText; + public static Configurable ingameText; public MusicAnnouncementsConfig() { @@ -13,6 +14,10 @@ public MusicAnnouncementsConfig() { "Show currently playing song in the pause menu" })); + ingameText = config.Bind("ingameText", true, new ConfigurableInfo("Announce the name of the currently playing song in the bottom left of the screen.", tags: new object[] + { + "Announce currently playing song in the bottom left" + })); } // Called when the config menu is opened by the player. (I think) @@ -27,7 +32,8 @@ public override void Initialize() AddDivider(593f); AddTitle(); AddDivider(540f); - AddCheckbox(); + AddCheckbox(pauseMenuText, 500f); + AddCheckbox(ingameText, 460f); } private void AddDivider(float y) @@ -59,16 +65,16 @@ private void AddTitle() }); } - private void AddCheckbox() + private void AddCheckbox(Configurable optionText, float y) { - OpCheckBox checkbox = new OpCheckBox(pauseMenuText, new Vector2(150f, 500f)) + OpCheckBox checkbox = new OpCheckBox(optionText, new Vector2(150f, y)) { - description = pauseMenuText.info.description + description = optionText.info.description }; - OpLabel checkboxLabel = new OpLabel(150f + 40f, 500f + 2f, pauseMenuText.info.Tags[0] as string) + OpLabel checkboxLabel = new OpLabel(150f + 40f, y + 2f, optionText.info.Tags[0] as string) { - description = pauseMenuText.info.description + description = optionText.info.description }; Tabs[0].AddItems(new UIelement[] diff --git a/src/MusicAnnouncementsMod.cs b/src/MusicAnnouncementsMod.cs index ad7682d..bcadf2b 100644 --- a/src/MusicAnnouncementsMod.cs +++ b/src/MusicAnnouncementsMod.cs @@ -65,7 +65,15 @@ private void SongHK(On.Music.Song.orig_ctor orig, Song self, MusicPlayer musicPl // The full `name` will be something like "RW_24 - Kayava". We only want to announce the part after the dash. songToAnnounce = Regex.Split(name, " - ")[1]; - announceAttempts = 500; // 500 attempts + + if (MusicAnnouncementsConfig.inGameText.Value) // Gameplay announcements are enabled. + { + announceAttempts = 500; // 500 attempts + } + else + { + Debug.Log("(MusicAnnouncements) Skipping gameplay announcement due to config"); + } } // Called when a song ends (or is otherwise deleted).