Added command to toggle tts

master
Mohammad Shoaib Khan 2022-10-09 13:50:35 +05:30
parent 452bbdf86c
commit b600eda78e
4 changed files with 20 additions and 5 deletions

View File

@ -521,6 +521,14 @@ namespace stardew_access
MainClass.DebugLog("Warnings is " + (MainClass.Config.Warning ? "on" : "off")); MainClass.DebugLog("Warnings is " + (MainClass.Config.Warning ? "on" : "off"));
}); });
helper.ConsoleCommands.Add("tts", "Toggles the screen reader/tts", (string commmand, string[] args) =>
{
MainClass.Config.TTS = !MainClass.Config.TTS;
helper.WriteConfig(MainClass.Config);
MainClass.DebugLog("TTS is " + (MainClass.Config.TTS ? "on" : "off"));
});
#endregion #endregion
} }
} }

View File

@ -78,6 +78,7 @@ namespace stardew_access
public Boolean VerboseCoordinates { get; set; } = true; public Boolean VerboseCoordinates { get; set; } = true;
public Boolean SnapMouse { get; set; } = true; // Toggles the snap mouse feature public Boolean SnapMouse { get; set; } = true; // Toggles the snap mouse feature
public Boolean Warning { get; set; } = true; // Toggles the warnings feature public Boolean Warning { get; set; } = true; // Toggles the warnings feature
public Boolean TTS { get; set; } = true; // Toggles the screen reader/tts.
// TODO add command to toggle warning feature // TODO add command to toggle warning feature
#endregion #endregion

View File

@ -62,11 +62,14 @@ namespace stardew_access.ScreenReader
if (text == null) if (text == null)
return; return;
if (initialized) if (!initialized)
{ return;
GoString str = new GoString(text, text.Length);
Speak(str, interrupt); if (!MainClass.Config.TTS)
} return;
GoString str = new GoString(text, text.Length);
Speak(str, interrupt);
} }
public void SayWithChecker(string text, bool interrupt) public void SayWithChecker(string text, bool interrupt)

View File

@ -62,6 +62,9 @@ namespace stardew_access.ScreenReader
if (screenReader == null) if (screenReader == null)
return; return;
if (!MainClass.Config.TTS)
return;
screenReader.Speak(text, interrupt); screenReader.Speak(text, interrupt);
} }