diff --git a/stardew-access/Patches/DialoguePatcher.cs b/stardew-access/Patches/DialoguePatcher.cs index 27ef816..6733fae 100644 --- a/stardew-access/Patches/DialoguePatcher.cs +++ b/stardew-access/Patches/DialoguePatcher.cs @@ -199,7 +199,13 @@ namespace stardew_access.Patches #endregion #region Narrate toSpeak - ScreenReader.sayWithChecker(toSpeak.ToString(), true); + + // To prevent it from getting conflicted by two hover texts at the same time, two seperate methods are used. + // For example, sometimes `Welcome to Pierre's` and the items in seeds shop get conflicted causing it to speak infinitely. + if(Context.IsPlayerFree) + ScreenReader.sayWithChecker(toSpeak.ToString(), true); // Normal Checker + else + ScreenReader.sayWithMenuChecker(toSpeak.ToString(), true); // Normal Checker #endregion } catch (Exception e) diff --git a/stardew-access/ScreenReader.cs b/stardew-access/ScreenReader.cs index 557742d..a526ff2 100644 --- a/stardew-access/ScreenReader.cs +++ b/stardew-access/ScreenReader.cs @@ -6,7 +6,7 @@ namespace stardew_access internal class ScreenReader { public static IAccessibleOutput? screenReader = null; - internal static string prevText = "", prevTextTile = " ", prevChatText = ""; + internal static string prevText = "", prevTextTile = " ", prevChatText = "", prevMenuText = ""; public static void initializeScreenReader() { @@ -65,6 +65,18 @@ namespace stardew_access } } + public static void sayWithMenuChecker(string text, bool interrupt) + { + if (screenReader == null) + return; + + if (prevMenuText != text) + { + prevMenuText = text; + screenReader.Speak(text, interrupt); + } + } + public static void sayWithChatChecker(string text, bool interrupt) { if (screenReader == null) diff --git a/stardew-access/manifest.json b/stardew-access/manifest.json index 94abb5c..0559b8b 100644 --- a/stardew-access/manifest.json +++ b/stardew-access/manifest.json @@ -1,7 +1,7 @@ { "Name": "Stardew Access", "Author": "Mohammad Shoaib", - "Version": "1.0.10-beta", + "Version": "1.0.11-beta", "Description": "An accessibility mod with screen reader support!", "UniqueID": "shoaib.stardewaccess", "EntryDll": "stardew-access.dll",