Potential fix for Leos's problem

"I dont know the reproducing step for this but, sometimes when i go to the seed shop, this message keeps looping when i talk to piere to buy things. Welcome to
Pierre's! Need
some supplies?"
master
shoaib11120 2021-12-29 19:57:22 +05:30
parent aa0f36cad1
commit 0b96c72137
3 changed files with 21 additions and 3 deletions

View File

@ -199,7 +199,13 @@ namespace stardew_access.Patches
#endregion #endregion
#region Narrate toSpeak #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 #endregion
} }
catch (Exception e) catch (Exception e)

View File

@ -6,7 +6,7 @@ namespace stardew_access
internal class ScreenReader internal class ScreenReader
{ {
public static IAccessibleOutput? screenReader = null; public static IAccessibleOutput? screenReader = null;
internal static string prevText = "", prevTextTile = " ", prevChatText = ""; internal static string prevText = "", prevTextTile = " ", prevChatText = "", prevMenuText = "";
public static void initializeScreenReader() 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) public static void sayWithChatChecker(string text, bool interrupt)
{ {
if (screenReader == null) if (screenReader == null)

View File

@ -1,7 +1,7 @@
{ {
"Name": "Stardew Access", "Name": "Stardew Access",
"Author": "Mohammad Shoaib", "Author": "Mohammad Shoaib",
"Version": "1.0.10-beta", "Version": "1.0.11-beta",
"Description": "An accessibility mod with screen reader support!", "Description": "An accessibility mod with screen reader support!",
"UniqueID": "shoaib.stardewaccess", "UniqueID": "shoaib.stardewaccess",
"EntryDll": "stardew-access.dll", "EntryDll": "stardew-access.dll",