Removed AutoHotKey for performing clicks

master
Mohammad Shoaib 2022-02-04 14:26:19 +05:30
parent 5100b4fd89
commit 2298d891da
17 changed files with 309 additions and 294 deletions

View File

@ -17,21 +17,21 @@ namespace stardew_access
{
MainClass.readTile = !MainClass.readTile;
MainClass.monitor.Log("Read Tile is " + (MainClass.readTile ? "on" : "off"), LogLevel.Info);
MainClass.Monitor.Log("Read Tile is " + (MainClass.readTile ? "on" : "off"), LogLevel.Info);
});
helper.ConsoleCommands.Add("snapmouse", "Toggle snap mouse feature.", (string commmand, string[] args) =>
{
MainClass.snapMouse = !MainClass.snapMouse;
MainClass.monitor.Log("Snap Mouse is " + (MainClass.snapMouse ? "on" : "off"), LogLevel.Info);
MainClass.Monitor.Log("Snap Mouse is " + (MainClass.snapMouse ? "on" : "off"), LogLevel.Info);
});
helper.ConsoleCommands.Add("radar", "Toggle radar feature.", (string commmand, string[] args) =>
{
MainClass.radar = !MainClass.radar;
MainClass.monitor.Log("Radar " + (MainClass.radar ? "on" : "off"), LogLevel.Info);
MainClass.Monitor.Log("Radar " + (MainClass.radar ? "on" : "off"), LogLevel.Info);
});
#region Radar Feature
@ -39,21 +39,21 @@ namespace stardew_access
{
MainClass.radarDebug = !MainClass.radarDebug;
MainClass.monitor.Log("Radar debugging " + (MainClass.radarDebug ? "on" : "off"), LogLevel.Info);
MainClass.Monitor.Log("Radar debugging " + (MainClass.radarDebug ? "on" : "off"), LogLevel.Info);
});
helper.ConsoleCommands.Add("rstereo", "Toggle stereo sound in radar feature.", (string commmand, string[] args) =>
{
MainClass.radarStereoSound = !MainClass.radarStereoSound;
MainClass.monitor.Log("Stereo sound is " + (MainClass.radarStereoSound ? "on" : "off"), LogLevel.Info);
MainClass.Monitor.Log("Stereo sound is " + (MainClass.radarStereoSound ? "on" : "off"), LogLevel.Info);
});
helper.ConsoleCommands.Add("rfocus", "Toggle focus mode in radar feature.", (string commmand, string[] args) =>
{
bool focus = MainClass.radarFeature.ToggleFocus();
bool focus = MainClass.RadarFeature.ToggleFocus();
MainClass.monitor.Log("Focus mode is " + (focus ? "on" : "off"), LogLevel.Info);
MainClass.Monitor.Log("Focus mode is " + (focus ? "on" : "off"), LogLevel.Info);
});
helper.ConsoleCommands.Add("rdelay", "Set the delay of radar feature in milliseconds.", (string commmand, string[] args) =>
@ -70,21 +70,21 @@ namespace stardew_access
if (isParsable)
{
MainClass.radarFeature.delay = delay;
MainClass.RadarFeature.delay = delay;
if (delay >= 1000)
MainClass.monitor.Log($"Delay set to {MainClass.radarFeature.delay} milliseconds.", LogLevel.Info);
MainClass.Monitor.Log($"Delay set to {MainClass.RadarFeature.delay} milliseconds.", LogLevel.Info);
else
MainClass.monitor.Log($"Delay should be atleast 1 second or 1000 millisecond long.", LogLevel.Info);
MainClass.Monitor.Log($"Delay should be atleast 1 second or 1000 millisecond long.", LogLevel.Info);
}
else
{
MainClass.monitor.Log("Invalid delay amount, it can only be in numeric form.", LogLevel.Info);
MainClass.Monitor.Log("Invalid delay amount, it can only be in numeric form.", LogLevel.Info);
}
}
else
{
MainClass.monitor.Log("Enter the delay amount (in milliseconds)!", LogLevel.Info);
MainClass.Monitor.Log("Enter the delay amount (in milliseconds)!", LogLevel.Info);
}
});
@ -103,21 +103,21 @@ namespace stardew_access
if (isParsable)
{
MainClass.radarFeature.range = range;
MainClass.RadarFeature.range = range;
if (range >= 2 && range <= 10)
MainClass.monitor.Log($"Range set to {MainClass.radarFeature.range}.", LogLevel.Info);
MainClass.Monitor.Log($"Range set to {MainClass.RadarFeature.range}.", LogLevel.Info);
else
MainClass.monitor.Log($"Range should be atleast 2 and maximum 10.", LogLevel.Info);
MainClass.Monitor.Log($"Range should be atleast 2 and maximum 10.", LogLevel.Info);
}
else
{
MainClass.monitor.Log("Invalid range amount, it can only be in numeric form.", LogLevel.Info);
MainClass.Monitor.Log("Invalid range amount, it can only be in numeric form.", LogLevel.Info);
}
}
else
{
MainClass.monitor.Log("Enter the range amount!", LogLevel.Info);
MainClass.Monitor.Log("Enter the range amount!", LogLevel.Info);
}
});
@ -133,19 +133,19 @@ namespace stardew_access
if (keyToAdd != null)
{
keyToAdd = keyToAdd.Trim().ToLower();
if (!MainClass.radarFeature.exclusions.Contains(keyToAdd))
if (!MainClass.RadarFeature.exclusions.Contains(keyToAdd))
{
MainClass.radarFeature.exclusions.Add(keyToAdd);
MainClass.monitor.Log($"Added {keyToAdd} key to exclusions list.", LogLevel.Info);
MainClass.RadarFeature.exclusions.Add(keyToAdd);
MainClass.Monitor.Log($"Added {keyToAdd} key to exclusions list.", LogLevel.Info);
}
else
{
MainClass.monitor.Log($"{keyToAdd} key already present in the list.", LogLevel.Info);
MainClass.Monitor.Log($"{keyToAdd} key already present in the list.", LogLevel.Info);
}
}
else
{
MainClass.monitor.Log("Unable to add the key to exclusions list.", LogLevel.Info);
MainClass.Monitor.Log("Unable to add the key to exclusions list.", LogLevel.Info);
}
});
@ -158,48 +158,48 @@ namespace stardew_access
if (keyToAdd != null)
{
keyToAdd = keyToAdd.Trim().ToLower();
if (MainClass.radarFeature.exclusions.Contains(keyToAdd))
if (MainClass.RadarFeature.exclusions.Contains(keyToAdd))
{
MainClass.radarFeature.exclusions.Remove(keyToAdd);
MainClass.monitor.Log($"Removed {keyToAdd} key from exclusions list.", LogLevel.Info);
MainClass.RadarFeature.exclusions.Remove(keyToAdd);
MainClass.Monitor.Log($"Removed {keyToAdd} key from exclusions list.", LogLevel.Info);
}
else
{
MainClass.monitor.Log($"Cannot find {keyToAdd} key in exclusions list.", LogLevel.Info);
MainClass.Monitor.Log($"Cannot find {keyToAdd} key in exclusions list.", LogLevel.Info);
}
}
else
{
MainClass.monitor.Log("Unable to remove the key from exclusions list.", LogLevel.Info);
MainClass.Monitor.Log("Unable to remove the key from exclusions list.", LogLevel.Info);
}
});
helper.ConsoleCommands.Add("relist", "List all the exclusions in the radar feature.", (string commmand, string[] args) =>
{
if (MainClass.radarFeature.exclusions.Count > 0)
if (MainClass.RadarFeature.exclusions.Count > 0)
{
string toPrint = "";
for (int i = 0; i < MainClass.radarFeature.exclusions.Count; i++)
for (int i = 0; i < MainClass.RadarFeature.exclusions.Count; i++)
{
toPrint = $"{toPrint}\t{i + 1}: {MainClass.radarFeature.exclusions[i]}";
toPrint = $"{toPrint}\t{i + 1}: {MainClass.RadarFeature.exclusions[i]}";
}
MainClass.monitor.Log(toPrint, LogLevel.Info);
MainClass.Monitor.Log(toPrint, LogLevel.Info);
}
else
{
MainClass.monitor.Log("No exclusions found.", LogLevel.Info);
MainClass.Monitor.Log("No exclusions found.", LogLevel.Info);
}
});
helper.ConsoleCommands.Add("reclear", "Clear the focus exclusions in the radar featrure.", (string commmand, string[] args) =>
{
MainClass.radarFeature.exclusions.Clear();
MainClass.monitor.Log($"Cleared the focus list in the exclusions feature.", LogLevel.Info);
MainClass.RadarFeature.exclusions.Clear();
MainClass.Monitor.Log($"Cleared the focus list in the exclusions feature.", LogLevel.Info);
});
helper.ConsoleCommands.Add("recount", "Number of exclusions in the radar feature.", (string commmand, string[] args) =>
{
MainClass.monitor.Log($"There are {MainClass.radarFeature.exclusions.Count} exclusiond in the radar feature.", LogLevel.Info);
MainClass.Monitor.Log($"There are {MainClass.RadarFeature.exclusions.Count} exclusiond in the radar feature.", LogLevel.Info);
});
#endregion
@ -213,19 +213,19 @@ namespace stardew_access
if (keyToAdd != null)
{
keyToAdd = keyToAdd.Trim().ToLower();
if (!MainClass.radarFeature.focus.Contains(keyToAdd))
if (!MainClass.RadarFeature.focus.Contains(keyToAdd))
{
MainClass.radarFeature.focus.Add(keyToAdd);
MainClass.monitor.Log($"Added {keyToAdd} key to focus list.", LogLevel.Info);
MainClass.RadarFeature.focus.Add(keyToAdd);
MainClass.Monitor.Log($"Added {keyToAdd} key to focus list.", LogLevel.Info);
}
else
{
MainClass.monitor.Log($"{keyToAdd} key already present in the list.", LogLevel.Info);
MainClass.Monitor.Log($"{keyToAdd} key already present in the list.", LogLevel.Info);
}
}
else
{
MainClass.monitor.Log("Unable to add the key to focus list.", LogLevel.Info);
MainClass.Monitor.Log("Unable to add the key to focus list.", LogLevel.Info);
}
});
@ -238,48 +238,48 @@ namespace stardew_access
if (keyToAdd != null)
{
keyToAdd = keyToAdd.Trim().ToLower();
if (MainClass.radarFeature.focus.Contains(keyToAdd))
if (MainClass.RadarFeature.focus.Contains(keyToAdd))
{
MainClass.radarFeature.focus.Remove(keyToAdd);
MainClass.monitor.Log($"Removed {keyToAdd} key from focus list.", LogLevel.Info);
MainClass.RadarFeature.focus.Remove(keyToAdd);
MainClass.Monitor.Log($"Removed {keyToAdd} key from focus list.", LogLevel.Info);
}
else
{
MainClass.monitor.Log($"Cannot find {keyToAdd} key in focus list.", LogLevel.Info);
MainClass.Monitor.Log($"Cannot find {keyToAdd} key in focus list.", LogLevel.Info);
}
}
else
{
MainClass.monitor.Log("Unable to remove the key from focus list.", LogLevel.Info);
MainClass.Monitor.Log("Unable to remove the key from focus list.", LogLevel.Info);
}
});
helper.ConsoleCommands.Add("rflist", "List all the exclusions in the radar feature.", (string commmand, string[] args) =>
{
if (MainClass.radarFeature.focus.Count > 0)
if (MainClass.RadarFeature.focus.Count > 0)
{
string toPrint = "";
for (int i = 0; i < MainClass.radarFeature.focus.Count; i++)
for (int i = 0; i < MainClass.RadarFeature.focus.Count; i++)
{
toPrint = $"{toPrint}\t{i + 1}): {MainClass.radarFeature.focus[i]}";
toPrint = $"{toPrint}\t{i + 1}): {MainClass.RadarFeature.focus[i]}";
}
MainClass.monitor.Log(toPrint, LogLevel.Info);
MainClass.Monitor.Log(toPrint, LogLevel.Info);
}
else
{
MainClass.monitor.Log("No objects found in the focus list.", LogLevel.Info);
MainClass.Monitor.Log("No objects found in the focus list.", LogLevel.Info);
}
});
helper.ConsoleCommands.Add("rfclear", "Clear the focus list in the radar featrure.", (string commmand, string[] args) =>
{
MainClass.radarFeature.focus.Clear();
MainClass.monitor.Log($"Cleared the focus list in the radar feature.", LogLevel.Info);
MainClass.RadarFeature.focus.Clear();
MainClass.Monitor.Log($"Cleared the focus list in the radar feature.", LogLevel.Info);
});
helper.ConsoleCommands.Add("rfcount", "Number of list in the radar feature.", (string commmand, string[] args) =>
{
MainClass.monitor.Log($"There are {MainClass.radarFeature.focus.Count} objects in the focus list in the radar feature.", LogLevel.Info);
MainClass.Monitor.Log($"There are {MainClass.RadarFeature.focus.Count} objects in the focus list in the radar feature.", LogLevel.Info);
});
#endregion
@ -290,14 +290,14 @@ namespace stardew_access
{
if (Game1.currentLocation is not Farm)
{
MainClass.monitor.Log("Can only use this command in the farm", LogLevel.Info);
MainClass.Monitor.Log("Can only use this command in the farm", LogLevel.Info);
return;
}
string? indexInString = args.ElementAtOrDefault(0);
if (indexInString == null)
{
MainClass.monitor.Log("Enter the index too! Example syntax: mark 0, here 0 is the index and it can be from 0 to 9 only", LogLevel.Info);
MainClass.Monitor.Log("Enter the index too! Example syntax: mark 0, here 0 is the index and it can be from 0 to 9 only", LogLevel.Info);
return;
}
@ -306,12 +306,12 @@ namespace stardew_access
if (!isParsable || !(index >= 0 && index <= 9))
{
MainClass.monitor.Log("Index can only be a number and from 0 to 9 only", LogLevel.Info);
MainClass.Monitor.Log("Index can only be a number and from 0 to 9 only", LogLevel.Info);
return;
}
BuildingNAnimalMenuPatches.marked[index] = new Vector2((int)Game1.player.getTileX(), (int)Game1.player.getTileY());
MainClass.monitor.Log($"Location {(int)Game1.player.getTileX()}x {(int)Game1.player.getTileY()}y added at {index} index.", LogLevel.Info);
MainClass.Monitor.Log($"Location {(int)Game1.player.getTileX()}x {(int)Game1.player.getTileY()}y added at {index} index.", LogLevel.Info);
});
helper.ConsoleCommands.Add("marklist", "List all marked positions.", (string commmand, string[] args) =>
@ -326,17 +326,17 @@ namespace stardew_access
}
if (toPrint == "")
MainClass.monitor.Log("No positions marked!", LogLevel.Info);
MainClass.Monitor.Log("No positions marked!", LogLevel.Info);
else
MainClass.monitor.Log($"Marked positions:\n{toPrint}\nOpen command menu and use pageup and pagedown to check the list", LogLevel.Info);
MainClass.Monitor.Log($"Marked positions:\n{toPrint}\nOpen command menu and use pageup and pagedown to check the list", LogLevel.Info);
});
helper.ConsoleCommands.Add("buildlist", "List all buildings for selection for upgrading/demolishing/painting", (string commmand, string[] args) =>
{
MainClass.monitor.Log($"{Game1.activeClickableMenu is PurchaseAnimalsMenu}\t{BuildingNAnimalMenuPatches.isOnFarm}", LogLevel.Debug);
MainClass.Monitor.Log($"{Game1.activeClickableMenu is PurchaseAnimalsMenu}\t{BuildingNAnimalMenuPatches.isOnFarm}", LogLevel.Debug);
if ((Game1.activeClickableMenu is not CarpenterMenu && Game1.activeClickableMenu is not PurchaseAnimalsMenu) || !BuildingNAnimalMenuPatches.isOnFarm)
{
MainClass.monitor.Log($"Cannot list buildings.", LogLevel.Info);
MainClass.Monitor.Log($"Cannot list buildings.", LogLevel.Info);
return;
}
@ -357,11 +357,11 @@ namespace stardew_access
if (toPrint == "")
{
MainClass.monitor.Log("No appropriate buildings to list", LogLevel.Info);
MainClass.Monitor.Log("No appropriate buildings to list", LogLevel.Info);
}
else
{
MainClass.monitor.Log($"Available buildings:{toPrint}\nOpen command menu and use pageup and pagedown to check the list", LogLevel.Info);
MainClass.Monitor.Log($"Available buildings:{toPrint}\nOpen command menu and use pageup and pagedown to check the list", LogLevel.Info);
}
});
@ -370,14 +370,14 @@ namespace stardew_access
if ((Game1.activeClickableMenu is not CarpenterMenu && Game1.activeClickableMenu is not PurchaseAnimalsMenu) || !BuildingNAnimalMenuPatches.isOnFarm)
{
MainClass.monitor.Log($"Cannot select building.", LogLevel.Info);
MainClass.Monitor.Log($"Cannot select building.", LogLevel.Info);
return;
}
string? indexInString = args.ElementAtOrDefault(0);
if (indexInString == null)
{
MainClass.monitor.Log("Enter the index of the building too! Use buildlist", LogLevel.Info);
MainClass.Monitor.Log("Enter the index of the building too! Use buildlist", LogLevel.Info);
return;
}
@ -386,7 +386,7 @@ namespace stardew_access
if (!isParsable)
{
MainClass.monitor.Log("Index can only be a number.", LogLevel.Info);
MainClass.Monitor.Log("Index can only be a number.", LogLevel.Info);
return;
}
@ -400,13 +400,13 @@ namespace stardew_access
{
if (BuildingNAnimalMenuPatches.availableBuildings[index] == null)
{
MainClass.monitor.Log($"No building found with index {index}. Use buildlist.", LogLevel.Info);
MainClass.Monitor.Log($"No building found with index {index}. Use buildlist.", LogLevel.Info);
return;
}
if (positionIndexInString == null)
{
MainClass.monitor.Log("Enter the index of marked place too! Use marklist.", LogLevel.Info);
MainClass.Monitor.Log("Enter the index of marked place too! Use marklist.", LogLevel.Info);
return;
}
@ -414,7 +414,7 @@ namespace stardew_access
if (!isParsable)
{
MainClass.monitor.Log("Index can only be a number.", LogLevel.Info);
MainClass.Monitor.Log("Index can only be a number.", LogLevel.Info);
return;
}
}
@ -423,7 +423,7 @@ namespace stardew_access
{
if (BuildingNAnimalMenuPatches.marked[index] == Vector2.Zero)
{
MainClass.monitor.Log($"No marked position found at {index} index.", LogLevel.Info);
MainClass.Monitor.Log($"No marked position found at {index} index.", LogLevel.Info);
return;
}
}
@ -431,7 +431,7 @@ namespace stardew_access
{
if (BuildingNAnimalMenuPatches.availableBuildings[index] == null)
{
MainClass.monitor.Log($"No building found with index {index}. Use buildlist.", LogLevel.Info);
MainClass.Monitor.Log($"No building found with index {index}. Use buildlist.", LogLevel.Info);
return;
}
}
@ -450,16 +450,16 @@ namespace stardew_access
if (response != null)
{
MainClass.monitor.Log(response, LogLevel.Info);
MainClass.Monitor.Log(response, LogLevel.Info);
}
});
#endregion
helper.ConsoleCommands.Add("refsr", "Refresh screen reader", (string commmand, string[] args) =>
{
MainClass.screenReader.InitializeScreenReader();
MainClass.ScreenReader.InitializeScreenReader();
MainClass.monitor.Log("Screen Reader refreshed!", LogLevel.Info);
MainClass.Monitor.Log("Screen Reader refreshed!", LogLevel.Info);
});
}
}

View File

@ -6,7 +6,8 @@ namespace stardew_access
{
internal class CustomSoundEffects
{
internal enum TYPE{
internal enum TYPE
{
Sound,
Footstep
}
@ -54,15 +55,15 @@ namespace stardew_access
}
SoundEffect effect;
string filePath = Path.Combine(MainClass.ModHelper.DirectoryPath,"sounds" , $"{soundEffect.Key}.wav");
string filePath = Path.Combine(MainClass.ModHelper.DirectoryPath, "sounds", $"{soundEffect.Key}.wav");
using (FileStream stream = new(filePath, FileMode.Open))
{
effect = SoundEffect.FromStream(stream);
}
if(soundEffect.Value == TYPE.Sound)
if (soundEffect.Value == TYPE.Sound)
cueDefinition.SetSound(effect, Game1.audioEngine.GetCategoryIndex("Sound"), false);
else if(soundEffect.Value == TYPE.Footstep)
else if (soundEffect.Value == TYPE.Footstep)
cueDefinition.SetSound(effect, Game1.audioEngine.GetCategoryIndex("Footsteps"), false);
Game1.soundBank.AddCue(cueDefinition);
@ -70,7 +71,7 @@ namespace stardew_access
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to initialize custom sounds:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to initialize custom sounds:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
}

View File

@ -23,8 +23,8 @@ namespace stardew_access.Game
return;
previousSlotItem = currentSlotItem;
MainClass.screenReader.Say($"{currentSlotItem.DisplayName} Selected", true);
}
MainClass.ScreenReader.Say($"{currentSlotItem.DisplayName} Selected", true);
}
// Narrates current location's name
public static void narrateCurrentLocation()
@ -38,7 +38,7 @@ namespace stardew_access.Game
return;
previousLocation = currentLocation;
MainClass.screenReader.Say($"{currentLocation.Name} Entered",true);
MainClass.ScreenReader.Say($"{currentLocation.Name} Entered", true);
}
public static void SnapMouseToPlayer()
@ -89,14 +89,14 @@ namespace stardew_access.Game
{
MainClass.hudMessageQueryKey = searchQuery;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
}
}
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate hud messages:\n{e.Message}\n{e.StackTrace}", StardewModdingAPI.LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate hud messages:\n{e.Message}\n{e.StackTrace}", StardewModdingAPI.LogLevel.Error);
}
await Task.Delay(300);

View File

@ -95,7 +95,7 @@ namespace stardew_access.Game
public async void Run()
{
if (MainClass.radarDebug)
MainClass.monitor.Log($"\n\nRead Tile started", StardewModdingAPI.LogLevel.Debug);
MainClass.Monitor.Log($"\n\nRead Tile started", StardewModdingAPI.LogLevel.Debug);
isRunning = true;
Vector2 currPosition = Game1.player.getTileLocation();
@ -107,7 +107,7 @@ namespace stardew_access.Game
BFS(currPosition, range);
if (MainClass.radarDebug)
MainClass.monitor.Log($"\nRead Tile stopped\n\n", StardewModdingAPI.LogLevel.Debug);
MainClass.Monitor.Log($"\nRead Tile stopped\n\n", StardewModdingAPI.LogLevel.Debug);
await Task.Delay(delay);
isRunning = false;
@ -319,7 +319,7 @@ namespace stardew_access.Game
}
catch (Exception e)
{
MainClass.monitor.Log($"{e.Message}\n{e.StackTrace}\n{e.Source}", StardewModdingAPI.LogLevel.Error);
MainClass.Monitor.Log($"{e.Message}\n{e.StackTrace}\n{e.Source}", StardewModdingAPI.LogLevel.Error);
}
}
@ -371,7 +371,7 @@ namespace stardew_access.Game
#endregion
if (MainClass.radarDebug)
MainClass.monitor.Log($"{radarFocus}\tObject:{searchQuery.ToLower().Trim()}\tPosition: X={position.X} Y={position.Y}", StardewModdingAPI.LogLevel.Debug);
MainClass.Monitor.Log($"{radarFocus}\tObject:{searchQuery.ToLower().Trim()}\tPosition: X={position.X} Y={position.Y}", StardewModdingAPI.LogLevel.Debug);
int px = (int)Game1.player.getTileX(); // Player's X postion
int py = (int)Game1.player.getTileY(); // Player's Y postion

View File

@ -34,8 +34,8 @@ namespace stardew_access.Game
{
if (!manuallyTriggered && prevTile != gt)
{
if (MainClass.screenReader != null)
MainClass.screenReader.PrevTextTile = " ";
if (MainClass.ScreenReader != null)
MainClass.ScreenReader.PrevTextTile = " ";
}
bool isColliding = isCollidingAtTile(x, y);
@ -148,9 +148,9 @@ namespace stardew_access.Game
#region Narrate toSpeak
if (toSpeak != " ")
if (manuallyTriggered)
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
else
MainClass.screenReader.SayWithTileQuery(toSpeak, x, y, true);
MainClass.ScreenReader.SayWithTileQuery(toSpeak, x, y, true);
#endregion
#region Play colliding sound effect
@ -166,7 +166,7 @@ namespace stardew_access.Game
}
catch (Exception e)
{
MainClass.monitor.Log($"Error in Read Tile:\n{e.Message}\n{e.StackTrace}", LogLevel.Debug);
MainClass.Monitor.Log($"Error in Read Tile:\n{e.Message}\n{e.StackTrace}", LogLevel.Debug);
}
await Task.Delay(100);

View File

@ -21,17 +21,16 @@ namespace stardew_access
public static bool radar = true;
public static bool radarDebug = false;
public static bool radarStereoSound = true;
public static IMonitor monitor;
private AutoHotkeyEngine ahk;
private static IMonitor monitor;
public static string hudMessageQueryKey = "";
public static Radar radarFeature;
public static ScreenReaderInterface screenReader;
private static Radar radarFeature;
private static IScreenReader screenReader;
private static IModHelper modHelper;
private static IModHelper _modHelper;
public static IModHelper ModHelper
{
get { return _modHelper; }
}
public static IModHelper ModHelper { get => modHelper; }
public static Radar RadarFeature { get => radarFeature; set => radarFeature = value; }
public static IScreenReader ScreenReader { get => screenReader; set => screenReader = value; }
public static IMonitor Monitor { get => monitor; set => monitor = value; }
/*********
** Public methods
@ -42,22 +41,18 @@ namespace stardew_access
{
#region Initializations
monitor = Monitor; // Inititalize monitor
_modHelper = helper;
Monitor = base.Monitor; // Inititalize monitor
modHelper = helper;
Game1.options.setGamepadMode("force_on");
// Initialize AutoHotKey
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
InitializeAutoHotKey();
screenReader = new ScreenReaderController().Initialize();
ScreenReader = new ScreenReaderController().Initialize();
CustomSoundEffects.Initialize();
CustomCommands.Initialize();
radarFeature = new Radar();
RadarFeature = new Radar();
harmony = new Harmony(ModManifest.UniqueID);
HarmonyPatches.Initialize(harmony);
@ -83,8 +78,8 @@ namespace stardew_access
public void OnExit(object? sender, EventArgs? e)
{
// Don't if this ever gets called or not but, just in case if it does.
if (screenReader != null)
screenReader.CloseScreenReader();
if (ScreenReader != null)
ScreenReader.CloseScreenReader();
}
/// <summary>Returns the Screen Reader class for other mods to use.</summary>
@ -112,8 +107,8 @@ namespace stardew_access
if (!ReadTile.isReadingTile && readTile)
ReadTile.run();
if (!radarFeature.isRunning && radar)
radarFeature.Run();
if (!RadarFeature.isRunning && radar)
RadarFeature.Run();
if (!isNarratingHudMessage)
{
@ -128,10 +123,28 @@ namespace stardew_access
if (Game1.activeClickableMenu != null)
{
bool isLeftShiftPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftShift);
bool isLeftControlPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl);
// Perform Left Click
if (Equals(e.Button, SButton.OemOpenBrackets))
{
Game1.activeClickableMenu.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true));
}
if (isLeftControlPressed && Equals(e.Button, SButton.Enter))
{
Game1.activeClickableMenu.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true));
}
// Perform Right CLick
if (Equals(e.Button, SButton.OemCloseBrackets))
{
Game1.activeClickableMenu.receiveRightClick(Game1.getMouseX(true), Game1.getMouseY(true));
}
if (isLeftShiftPressed && Equals(e.Button, SButton.Enter))
{
Game1.activeClickableMenu.receiveRightClick(Game1.getMouseX(true), Game1.getMouseY(true));
}
}
if (!Context.IsPlayerFree)
@ -141,28 +154,28 @@ namespace stardew_access
if (Equals(e.Button, SButton.H))
{
string toSpeak = $"Health is {CurrentPlayer.getHealth()} and Stamina is {CurrentPlayer.getStamina()}";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
// Narrate Position
if (Equals(e.Button, SButton.K))
{
string toSpeak = $"X: {CurrentPlayer.getPositionX()} , Y: {CurrentPlayer.getPositionY()}";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
// Narrate money at hand
if (Equals(e.Button, SButton.R))
{
string toSpeak = $"You have {CurrentPlayer.getMoney()}g";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
// Narrate time and season
if (Equals(e.Button, SButton.Q))
{
string toSpeak = $"Time is {CurrentPlayer.getTimeOfDay()} and it is {CurrentPlayer.getDay()} {CurrentPlayer.getDate()} of {CurrentPlayer.getSeason()}";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
// Manual read tile
@ -177,21 +190,5 @@ namespace stardew_access
monitor.Log($"{Game1.player.controller.pathToEndPoint==null}", LogLevel.Debug); // true if path not found
}*/
}
private void InitializeAutoHotKey()
{
try
{
ahk = AutoHotkeyEngine.Instance;
ahk.ExecRaw("[::\nSend {LButton}");
ahk.ExecRaw("^Enter::\nSend {LButton}");
ahk.ExecRaw("]::\nSend {RButton}");
ahk.ExecRaw("+Enter::\nSend {RButton}");
}
catch (Exception e)
{
monitor.Log($"Unable to initialize AutoHotKey:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
}
}

View File

@ -57,7 +57,7 @@ namespace stardew_access.Patches
if (purchaseAnimalMenuQuery != toSpeak)
{
purchaseAnimalMenuQuery = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -65,7 +65,7 @@ namespace stardew_access.Patches
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -145,7 +145,7 @@ namespace stardew_access.Patches
if (carpenterMenuQuery != toSpeak)
{
carpenterMenuQuery = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -156,7 +156,7 @@ namespace stardew_access.Patches
if (carpenterMenuQuery != toSpeak)
{
carpenterMenuQuery = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -167,7 +167,7 @@ namespace stardew_access.Patches
if (carpenterMenuQuery != toSpeak)
{
carpenterMenuQuery = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -178,7 +178,7 @@ namespace stardew_access.Patches
if (carpenterMenuQuery != toSpeak)
{
carpenterMenuQuery = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -189,7 +189,7 @@ namespace stardew_access.Patches
if (carpenterMenuQuery != toSpeak)
{
carpenterMenuQuery = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -200,7 +200,7 @@ namespace stardew_access.Patches
if (carpenterMenuQuery != toSpeak)
{
carpenterMenuQuery = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -211,7 +211,7 @@ namespace stardew_access.Patches
if (carpenterMenuQuery != toSpeak)
{
carpenterMenuQuery = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -234,14 +234,14 @@ namespace stardew_access.Patches
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
private static async void SayBlueprintInfo(string info)
{
isSayingBlueprintInfo = true;
MainClass.screenReader.Say(info, true);
MainClass.ScreenReader.Say(info, true);
await Task.Delay(300);
isSayingBlueprintInfo = false;
}

View File

@ -42,13 +42,13 @@ namespace stardew_access.Patches
toSpeak += $"{message.message}, ";
});
if (toSpeak != " ")
MainClass.screenReader.SayWithChatChecker(toSpeak, false);
MainClass.ScreenReader.SayWithChatChecker(toSpeak, false);
#endregion
}
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -77,7 +77,7 @@ namespace stardew_access.Patches
toSpeak += $"{message.message}, ";
});
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
await Task.Delay(200);
isChatRunning = false;
}

View File

@ -49,9 +49,9 @@ namespace stardew_access.Patches
if (toSpeak != " ")
{
if (hasResponses)
MainClass.screenReader.SayWithChecker(toSpeak, false);
MainClass.ScreenReader.SayWithChecker(toSpeak, false);
else
MainClass.screenReader.SayWithChecker(toSpeak, true);
MainClass.ScreenReader.SayWithChecker(toSpeak, true);
}
}
else if (__instance.isQuestion)
@ -80,9 +80,9 @@ namespace stardew_access.Patches
if (toSpeak != " ")
{
if (hasResponses)
MainClass.screenReader.SayWithChecker(toSpeak, false);
MainClass.ScreenReader.SayWithChecker(toSpeak, false);
else
MainClass.screenReader.SayWithChecker(toSpeak, true);
MainClass.ScreenReader.SayWithChecker(toSpeak, true);
}
}
else if (Game1.activeClickableMenu is DialogueBox)
@ -91,13 +91,13 @@ namespace stardew_access.Patches
if (currentDialogue != __instance.getCurrentString())
{
currentDialogue = __instance.getCurrentString();
MainClass.screenReader.Say(__instance.getCurrentString(), true);
MainClass.ScreenReader.Say(__instance.getCurrentString(), true);
}
}
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate dialog:\n{e.StackTrace}\n{e.Message}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate dialog:\n{e.StackTrace}\n{e.Message}", LogLevel.Error);
}
}
@ -273,15 +273,15 @@ namespace stardew_access.Patches
if (toSpeak.ToString() != " ")
{
if (Context.IsPlayerFree)
MainClass.screenReader.SayWithChecker(toSpeak.ToString(), true); // Normal Checker
MainClass.ScreenReader.SayWithChecker(toSpeak.ToString(), true); // Normal Checker
else
MainClass.screenReader.SayWithMenuChecker(toSpeak.ToString(), true); // Menu Checker
MainClass.ScreenReader.SayWithMenuChecker(toSpeak.ToString(), true); // Menu Checker
}
#endregion
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate dialog:\n{e.StackTrace}\n{e.Message}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate dialog:\n{e.StackTrace}\n{e.Message}", LogLevel.Error);
}
}
}

View File

@ -42,7 +42,7 @@ namespace stardew_access.Patches
if (junimoNoteMenuQuery != toSpeak)
{
junimoNoteMenuQuery = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -54,7 +54,7 @@ namespace stardew_access.Patches
if (junimoNoteMenuQuery != toSpeak)
{
junimoNoteMenuQuery = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -65,7 +65,7 @@ namespace stardew_access.Patches
if (junimoNoteMenuQuery != toSpeak)
{
junimoNoteMenuQuery = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -77,7 +77,7 @@ namespace stardew_access.Patches
if (junimoNoteMenuQuery != toSpeak)
{
junimoNoteMenuQuery = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -87,7 +87,7 @@ namespace stardew_access.Patches
if (junimoNoteMenuQuery != toSpeak)
{
junimoNoteMenuQuery = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -117,19 +117,19 @@ namespace stardew_access.Patches
else if (isBackPressed && __instance.backButton != null && !__instance.backButton.containsPoint(x, y))
{
__instance.backButton.snapMouseCursorToCenter();
MainClass.screenReader.Say("Back Button", true);
MainClass.ScreenReader.Say("Back Button", true);
}
else if (isPPressed && __instance.purchaseButton != null && !__instance.purchaseButton.containsPoint(x, y))
{
__instance.purchaseButton.snapMouseCursorToCenter();
MainClass.screenReader.Say("Purchase Button", true);
MainClass.ScreenReader.Say("Purchase Button", true);
}
}
string reward = __instance.getRewardNameForArea(___whichArea);
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -193,7 +193,7 @@ namespace stardew_access.Patches
toSpeak = $"Completed {toSpeak}";
c.snapMouseCursorToCenter();
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
}
break;
@ -228,7 +228,7 @@ namespace stardew_access.Patches
}
c.snapMouseCursorToCenter();
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
}
break;
@ -281,7 +281,7 @@ namespace stardew_access.Patches
toSpeak = "Empty Slot";
}
c.snapMouseCursorToCenter();
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
}
break;
@ -289,7 +289,7 @@ namespace stardew_access.Patches
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
await Task.Delay(200);
@ -372,7 +372,7 @@ namespace stardew_access.Patches
if (socialPageQuery != toSpeak)
{
socialPageQuery = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -417,7 +417,7 @@ namespace stardew_access.Patches
if (socialPageQuery != toSpeak)
{
socialPageQuery = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -430,7 +430,7 @@ namespace stardew_access.Patches
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -461,7 +461,7 @@ namespace stardew_access.Patches
{
shopMenuQueryKey = toSpeak;
hoveredItemQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
Game1.playSound("drop_item");
}
return;
@ -473,7 +473,7 @@ namespace stardew_access.Patches
{
shopMenuQueryKey = toSpeak;
hoveredItemQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -484,7 +484,7 @@ namespace stardew_access.Patches
{
shopMenuQueryKey = toSpeak;
hoveredItemQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -531,14 +531,14 @@ namespace stardew_access.Patches
{
shopMenuQueryKey = toSpeak;
hoveredItemQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
}
#endregion
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -560,7 +560,7 @@ namespace stardew_access.Patches
if (gameMenuQueryKey != toSpeak)
{
gameMenuQueryKey = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -568,7 +568,7 @@ namespace stardew_access.Patches
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -589,7 +589,7 @@ namespace stardew_access.Patches
if (geodeMenuQueryKey != toSpeak)
{
geodeMenuQueryKey = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -602,7 +602,7 @@ namespace stardew_access.Patches
if (geodeMenuQueryKey != toSpeak)
{
geodeMenuQueryKey = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -614,7 +614,7 @@ namespace stardew_access.Patches
if (geodeMenuQueryKey != toSpeak)
{
geodeMenuQueryKey = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
Game1.playSound("drop_item");
}
return;
@ -627,7 +627,7 @@ namespace stardew_access.Patches
if (geodeMenuQueryKey != toSpeak)
{
geodeMenuQueryKey = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -639,7 +639,7 @@ namespace stardew_access.Patches
if (geodeMenuQueryKey != toSpeak)
{
geodeMenuQueryKey = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -652,7 +652,7 @@ namespace stardew_access.Patches
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -684,7 +684,7 @@ namespace stardew_access.Patches
itemGrabMenuQueryKey = toSpeak;
hoveredItemQueryKey = "";
gameMenuQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -696,7 +696,7 @@ namespace stardew_access.Patches
itemGrabMenuQueryKey = toSpeak;
gameMenuQueryKey = "";
hoveredItemQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -709,7 +709,7 @@ namespace stardew_access.Patches
itemGrabMenuQueryKey = toSpeak;
gameMenuQueryKey = "";
hoveredItemQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -722,7 +722,7 @@ namespace stardew_access.Patches
itemGrabMenuQueryKey = toSpeak;
gameMenuQueryKey = "";
hoveredItemQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -735,7 +735,7 @@ namespace stardew_access.Patches
itemGrabMenuQueryKey = toSpeak;
gameMenuQueryKey = "";
hoveredItemQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -749,7 +749,7 @@ namespace stardew_access.Patches
itemGrabMenuQueryKey = toSpeak;
gameMenuQueryKey = "";
hoveredItemQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -763,7 +763,7 @@ namespace stardew_access.Patches
itemGrabMenuQueryKey = toSpeak;
gameMenuQueryKey = "";
hoveredItemQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -776,7 +776,7 @@ namespace stardew_access.Patches
itemGrabMenuQueryKey = toSpeak;
gameMenuQueryKey = "";
hoveredItemQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
Game1.playSound("drop_item");
}
return;
@ -818,7 +818,7 @@ namespace stardew_access.Patches
itemGrabMenuQueryKey = toSpeak;
gameMenuQueryKey = "";
hoveredItemQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -843,7 +843,7 @@ namespace stardew_access.Patches
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -956,7 +956,7 @@ namespace stardew_access.Patches
{
craftingPageQueryKey = toSpeak;
hoveredItemQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -968,7 +968,7 @@ namespace stardew_access.Patches
{
craftingPageQueryKey = toSpeak;
hoveredItemQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -980,7 +980,7 @@ namespace stardew_access.Patches
{
craftingPageQueryKey = toSpeak;
hoveredItemQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -992,7 +992,7 @@ namespace stardew_access.Patches
{
craftingPageQueryKey = toSpeak;
hoveredItemQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
Game1.playSound("drop_item");
}
return;
@ -1072,7 +1072,7 @@ namespace stardew_access.Patches
craftingPageQueryKey = toSpeak;
gameMenuQueryKey = "";
hoveredItemQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -1089,7 +1089,7 @@ namespace stardew_access.Patches
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -1139,7 +1139,7 @@ namespace stardew_access.Patches
inventoryPageQueryKey = toSpeak;
gameMenuQueryKey = "";
hoveredItemQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
Game1.playSound("drop_item");
}
return;
@ -1153,7 +1153,7 @@ namespace stardew_access.Patches
inventoryPageQueryKey = toSpeak;
gameMenuQueryKey = "";
hoveredItemQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -1166,7 +1166,7 @@ namespace stardew_access.Patches
inventoryPageQueryKey = toSpeak;
gameMenuQueryKey = "";
hoveredItemQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -1179,7 +1179,7 @@ namespace stardew_access.Patches
itemGrabMenuQueryKey = toSpeak;
gameMenuQueryKey = "";
hoveredItemQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -1193,7 +1193,7 @@ namespace stardew_access.Patches
itemGrabMenuQueryKey = toSpeak;
gameMenuQueryKey = "";
hoveredItemQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -1289,7 +1289,7 @@ namespace stardew_access.Patches
inventoryPageQueryKey = toSpeak;
gameMenuQueryKey = "";
hoveredItemQueryKey = "";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -1307,7 +1307,7 @@ namespace stardew_access.Patches
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -1352,7 +1352,7 @@ namespace stardew_access.Patches
{
gameMenuQueryKey = "";
optionsPageQueryKey = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -1360,7 +1360,7 @@ namespace stardew_access.Patches
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -1376,7 +1376,7 @@ namespace stardew_access.Patches
{
gameMenuQueryKey = "";
exitPageQueryKey = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
@ -1388,14 +1388,14 @@ namespace stardew_access.Patches
{
gameMenuQueryKey = "";
exitPageQueryKey = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -1527,7 +1527,7 @@ namespace stardew_access.Patches
if (hoveredItemQueryKey != $"{toSpeak}:{i}")
{
hoveredItemQueryKey = $"{toSpeak}:{i}";
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
return true;
}

View File

@ -38,7 +38,7 @@ namespace stardew_access.Patches
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
return true;
@ -52,13 +52,13 @@ namespace stardew_access.Patches
if (__instance.nextPageButton != null && __instance.nextPageButton.containsPoint(x, y))
{
MainClass.screenReader.SayWithMenuChecker($"Next Page Button", true);
MainClass.ScreenReader.SayWithMenuChecker($"Next Page Button", true);
return;
}
if (__instance.previousPageButton != null && __instance.previousPageButton.containsPoint(x, y))
{
MainClass.screenReader.SayWithMenuChecker($"Previous Page Button", true);
MainClass.ScreenReader.SayWithMenuChecker($"Previous Page Button", true);
return;
}
@ -66,14 +66,14 @@ namespace stardew_access.Patches
{
if (__instance.languages[i].containsPoint(x, y))
{
MainClass.screenReader.SayWithMenuChecker($"{__instance.languageList[i]} Button", true);
MainClass.ScreenReader.SayWithMenuChecker($"{__instance.languageList[i]} Button", true);
break;
}
}
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -86,14 +86,14 @@ namespace stardew_access.Patches
{
if (___elevators[i].containsPoint(x, y))
{
MainClass.screenReader.SayWithMenuChecker($"{___elevators[i].name} level", true);
MainClass.ScreenReader.SayWithMenuChecker($"{___elevators[i].name} level", true);
break;
}
}
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -105,11 +105,11 @@ namespace stardew_access.Patches
___textBox.SelectMe();
string toSpeak = $"{title}";
MainClass.screenReader.SayWithChecker(toSpeak, true);
MainClass.ScreenReader.SayWithChecker(toSpeak, true);
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -119,19 +119,19 @@ namespace stardew_access.Patches
{
int x = Game1.getMouseX(), y = Game1.getMouseY();
MainClass.screenReader.SayWithMenuChecker(___message, true);
MainClass.ScreenReader.SayWithMenuChecker(___message, true);
if (__instance.okButton.containsPoint(x, y))
{
MainClass.screenReader.SayWithMenuChecker("Ok Button", false);
MainClass.ScreenReader.SayWithMenuChecker("Ok Button", false);
}
else if (__instance.cancelButton.containsPoint(x, y))
{
MainClass.screenReader.SayWithMenuChecker("Cancel Button", false);
MainClass.ScreenReader.SayWithMenuChecker("Cancel Button", false);
}
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -188,16 +188,16 @@ namespace stardew_access.Patches
}
if (toSpeak != " ")
MainClass.screenReader.SayWithMenuChecker(toSpeak, true);
MainClass.ScreenReader.SayWithMenuChecker(toSpeak, true);
else if (__instance.isProfessionChooser && currentLevelUpTitle != $"{___title}. Select a new profession.")
{
MainClass.screenReader.SayWithMenuChecker($"{___title}. Select a new profession.", true);
MainClass.ScreenReader.SayWithMenuChecker($"{___title}. Select a new profession.", true);
currentLevelUpTitle = $"{___title}. Select a new profession.";
}
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -212,21 +212,21 @@ namespace stardew_access.Patches
if (__instance.okButton.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
{
toSpeak = $"{total}g in total. Press left mouse button to save.";
MainClass.screenReader.SayWithChecker(toSpeak, true);
MainClass.ScreenReader.SayWithChecker(toSpeak, true);
}
for (int i = 0; i < __instance.categories.Count; i++)
{
if (__instance.categories[i].containsPoint(Game1.getMouseX(), Game1.getMouseY()))
{
toSpeak = $"Money recieved from {__instance.getCategoryName(i)}: {___categoryTotals[i]}g.";
MainClass.screenReader.SayWithChecker(toSpeak, true);
MainClass.ScreenReader.SayWithChecker(toSpeak, true);
}
}
}
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -266,7 +266,7 @@ namespace stardew_access.Patches
toSpeak += "\t\n Left click to accept quest.";
__instance.acceptQuestButton.snapMouseCursorToCenter();
}
MainClass.screenReader.Say(toSpeak, false);
MainClass.ScreenReader.Say(toSpeak, false);
}
#endregion
@ -279,7 +279,7 @@ namespace stardew_access.Patches
string label = c.label;
if (c.containsPoint(Game1.getMousePosition().X, Game1.getMousePosition().Y))
MainClass.screenReader.SayWithChecker($"Grab: {name} \t\n {label}", false);
MainClass.ScreenReader.SayWithChecker($"Grab: {name} \t\n {label}", false);
}
}
#endregion
@ -287,7 +287,7 @@ namespace stardew_access.Patches
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -329,7 +329,7 @@ namespace stardew_access.Patches
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -371,14 +371,14 @@ namespace stardew_access.Patches
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
internal static void ExitEventPatch()
{
if (MainClass.screenReader != null)
MainClass.screenReader.CloseScreenReader();
if (MainClass.ScreenReader != null)
MainClass.ScreenReader.CloseScreenReader();
}
internal static void resetGlobalVars()
{

View File

@ -23,7 +23,7 @@ namespace stardew_access.Patches
toSpeak = $"Left Quest:\n\t{toSpeak}\n\tPress left click to accept this quest.";
MainClass.screenReader.SayWithMenuChecker(toSpeak, true);
MainClass.ScreenReader.SayWithMenuChecker(toSpeak, true);
return;
}
@ -33,13 +33,13 @@ namespace stardew_access.Patches
toSpeak = $"Right Quest:\n\t{toSpeak}\n\tPress left click to accept this quest.";
MainClass.screenReader.SayWithMenuChecker(toSpeak, true);
MainClass.ScreenReader.SayWithMenuChecker(toSpeak, true);
return;
}
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -99,7 +99,7 @@ namespace stardew_access.Patches
if (Game1.dayOfMonth == i + 1)
toSpeak += $", Current";
MainClass.screenReader.SayWithChecker(toSpeak, true);
MainClass.ScreenReader.SayWithChecker(toSpeak, true);
}
}
#endregion
@ -114,7 +114,7 @@ namespace stardew_access.Patches
if (currentDailyQuestText != toSpeak)
{
currentDailyQuestText = toSpeak;
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
}
else
@ -134,7 +134,7 @@ namespace stardew_access.Patches
__instance.acceptQuestButton.snapMouseCursorToCenter();
}
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
}
#endregion
@ -142,7 +142,7 @@ namespace stardew_access.Patches
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
#endregion
@ -171,7 +171,7 @@ namespace stardew_access.Patches
toSpeak += ___pages[___currentPage][i].ShouldDisplayAsComplete() ? " completed!" : "";
if (__instance.questLogButtons[i].containsPoint(Game1.getOldMouseX(), Game1.getOldMouseY()))
{
MainClass.screenReader.SayWithChecker(toSpeak, true);
MainClass.ScreenReader.SayWithChecker(toSpeak, true);
}
}
}
@ -218,10 +218,13 @@ namespace stardew_access.Patches
toSpeak += $"\t\nOrder {j + 1}: {parsed_text} \t\n";
}
int daysLeft = ____shownQuest.GetDaysLeft();
if (____shownQuest != null)
{
int daysLeft = ____shownQuest.GetDaysLeft();
if (daysLeft > 0)
toSpeak += $"\t\n{daysLeft} days left.";
if (daysLeft > 0)
toSpeak += $"\t\n{daysLeft} days left.";
}
#endregion
}
@ -229,13 +232,13 @@ namespace stardew_access.Patches
if (snapMouseToRewardBox)
__instance.rewardBox.snapMouseCursorToCenter();
MainClass.screenReader.SayWithChecker(toSpeak, true);
MainClass.ScreenReader.SayWithChecker(toSpeak, true);
#endregion
}
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
#endregion

View File

@ -45,11 +45,11 @@ namespace stardew_access.Patches
#endregion
if (toSpeak != " ")
MainClass.screenReader.SayWithChecker(toSpeak, true);
MainClass.ScreenReader.SayWithChecker(toSpeak, true);
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -95,15 +95,15 @@ namespace stardew_access.Patches
if (TitleMenu.subMenu != null && __instance.backButton.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
{
string text = "Back Button";
MainClass.screenReader.SayWithChecker(text, true);
MainClass.ScreenReader.SayWithChecker(text, true);
}
if (TitleMenu.subMenu == null && toSpeak != "")
MainClass.screenReader.SayWithChecker(toSpeak, true);
MainClass.ScreenReader.SayWithChecker(toSpeak, true);
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -119,7 +119,7 @@ namespace stardew_access.Patches
#region Farms
if (___menu.deleteButtons.Count > 0 && ___menu.deleteButtons[i].containsPoint(x, y))
{
MainClass.screenReader.SayWithChecker($"Delete {__instance.Farmer.farmName} Farm", true);
MainClass.ScreenReader.SayWithChecker($"Delete {__instance.Farmer.farmName} Farm", true);
return;
}
@ -128,14 +128,14 @@ namespace stardew_access.Patches
// Used diff. functions to narrate to prevent it from speaking the message again on selecting another button.
string message = "Really delete farm?";
MainClass.screenReader.SayWithChecker(message, true);
MainClass.ScreenReader.SayWithChecker(message, true);
if (___menu.okDeleteButton.containsPoint(x, y))
{
MainClass.screenReader.SayWithMenuChecker("Ok Button", false);
MainClass.ScreenReader.SayWithMenuChecker("Ok Button", false);
}
else if (___menu.cancelDeleteButton.containsPoint(x, y))
{
MainClass.screenReader.SayWithMenuChecker("Cancel Button", false);
MainClass.ScreenReader.SayWithMenuChecker("Cancel Button", false);
}
return;
}
@ -150,14 +150,14 @@ namespace stardew_access.Patches
string toSpeak = $"{farmName} Farm Selected, \t\n Farmer:{farmerName}, \t\nMoney:{money}, \t\nHours Played:{hoursPlayed}, \t\nDate:{dateStringForSaveGame}";
MainClass.screenReader.SayWithChecker(toSpeak, true);
MainClass.ScreenReader.SayWithChecker(toSpeak, true);
#endregion
}
}
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -179,7 +179,7 @@ namespace stardew_access.Patches
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
MainClass.Monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
@ -640,7 +640,7 @@ namespace stardew_access.Patches
if (toSpeak != " ")
{
MainClass.screenReader.Say(toSpeak, true);
MainClass.ScreenReader.Say(toSpeak, true);
}
await Task.Delay(200);

View File

@ -2,16 +2,21 @@ using System.Runtime.InteropServices;
namespace stardew_access.ScreenReader
{
public class ScreenReaderController{
public ScreenReaderInterface? Initialize(){
ScreenReaderInterface? ScreenReader = null;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)){
public class ScreenReaderController
{
public IScreenReader? Initialize()
{
IScreenReader? ScreenReader = null;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
ScreenReaderWindows screenReaderWindows = new ScreenReaderWindows();
screenReaderWindows.InitializeScreenReader();
ScreenReader = screenReaderWindows;
} else if(RuntimeInformation.IsOSPlatform(OSPlatform.Linux)){
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
ScreenReaderLinux screenReaderLinux = new ScreenReaderLinux();
screenReaderLinux.InitializeScreenReader();

View File

@ -1,12 +1,14 @@
namespace stardew_access.ScreenReader
{
public interface ScreenReaderInterface{
public interface IScreenReader
{
public string PrevTextTile{
public string PrevTextTile
{
get;
set;
}
/// <summary>Initializes the screen reader.</summary>
public void InitializeScreenReader();
@ -45,6 +47,6 @@ namespace stardew_access.ScreenReader
/// <param name="x">The X location of tile.</param>
/// <param name="y">The Y location of tile.</param>
/// <param name="interrupt">Whether to skip the currently speaking text or not.</param>
public void SayWithTileQuery(string text, int x, int y, bool interrupt);
public void SayWithTileQuery(string text, int x, int y, bool interrupt);
}
}

View File

@ -14,7 +14,7 @@ namespace stardew_access.ScreenReader
}
}
public class ScreenReaderLinux : ScreenReaderInterface
public class ScreenReaderLinux : IScreenReader
{
[DllImport("libspeechdwrapper.so")]
private static extern int Initialize();
@ -28,21 +28,25 @@ namespace stardew_access.ScreenReader
public string prevText = "", prevTextTile = " ", prevChatText = "", prevMenuText = "";
private bool initialized = false;
public string PrevTextTile{
get{ return prevTextTile; }
set{ prevTextTile=value; }
public string PrevTextTile
{
get { return prevTextTile; }
set { prevTextTile = value; }
}
public void InitializeScreenReader()
{
int res = Initialize();
if(res==1){
if (res == 1)
{
initialized = true;
}
}
public void CloseScreenReader(){
if(initialized){
public void CloseScreenReader()
{
if (initialized)
{
Close();
initialized = false;
}
@ -50,7 +54,8 @@ namespace stardew_access.ScreenReader
public void Say(string text, bool interrupt)
{
if(initialized){
if (initialized)
{
GoString str = new GoString(text, text.Length);
Speak(str, interrupt);
}
@ -82,7 +87,7 @@ namespace stardew_access.ScreenReader
Say(text, interrupt);
}
}
public void SayWithTileQuery(string text, int x, int y, bool interrupt)
{
string query = $"{text} x:{x} y:{y}";

View File

@ -2,19 +2,20 @@
namespace stardew_access.ScreenReader
{
public class ScreenReaderWindows : ScreenReaderInterface
public class ScreenReaderWindows : IScreenReader
{
public IAccessibleOutput? screenReader = null;
public string prevText = "", prevTextTile = " ", prevChatText = "", prevMenuText = "";
public string PrevTextTile{
get{ return prevTextTile; }
set{ prevTextTile=value; }
public string PrevTextTile
{
get { return prevTextTile; }
set { prevTextTile = value; }
}
public void InitializeScreenReader()
{
NvdaOutput? nvdaOutput = null;
JawsOutput? jawsOutput = null;
SapiOutput? sapiOutput = null;
@ -38,7 +39,7 @@ namespace stardew_access.ScreenReader
{
sapiOutput = new SapiOutput();
}
catch (Exception){ }
catch (Exception) { }
if (nvdaOutput != null && nvdaOutput.IsAvailable())
screenReader = nvdaOutput;
@ -48,8 +49,9 @@ namespace stardew_access.ScreenReader
screenReader = sapiOutput;
}
public void CloseScreenReader(){
public void CloseScreenReader()
{
}
public void Say(string text, bool interrupt)
@ -95,7 +97,7 @@ namespace stardew_access.ScreenReader
Say(text, interrupt);
}
}
public void SayWithTileQuery(string text, int x, int y, bool interrupt)
{
if (screenReader == null)