using Microsoft.Xna.Framework; using stardew_access.Features; namespace stardew_access.ScreenReader { public class API { public API() { } /// /// Search the area using Breadth First Search algorithm(BFS). /// /// The starting point. /// The limiting factor or simply radius of the search area. /// A dictionary with all the detected tiles along with the name of the object on it and it's category. public Dictionary SearchNearbyTiles(Vector2 center, int limit) { /* * How to use the Dictionary to get the name and category of a tile:- * * string tileName = detectedTiles.GetValueOrDefault(tilePosition).name; * string tileCategory = detectedTiles.GetValueOrDefault(tilePosition).category; * * Here detectedTiles is the Dictionary returned by this method */ return new Radar().SearchNearbyTiles(center, limit, false); } /// /// Search the entire location using Breadth First Search algorithm(BFS). /// /// A dictionary with all the detected tiles along with the name of the object on it and it's category. public Dictionary SearchLocation() { /* * How to use the Dictionary to get the name and category of a tile:- * * string tileName = detectedTiles.GetValueOrDefault(tilePosition).name; * string tileCategory = detectedTiles.GetValueOrDefault(tilePosition).category; * * Here detectedTiles is the Dictionary returned by this method */ return new Radar().SearchLocation(); } /// /// Check the tile for any object /// /// The tile where we want to check the name and category of object if any /// Name of the object as the first item (name) and category as the second item (category). Returns null if no object found. public (string? name, string? category) GetNameWithCategoryNameAtTile(Vector2 tile) { return TileInfo.getNameWithCategoryNameAtTile(tile); } /// /// Check the tile for any object /// /// The tile where we want to check the name and category of object if any /// Name of the object. Returns null if no object found. public string? GetNameAtTile(Vector2 tile) { return TileInfo.getNameAtTile(tile); } /// Speaks the text via the loaded screen reader (if any). /// The text to be narrated. /// Whether to skip the currently speaking text or not. public void Say(String text, Boolean interrupt) { if (MainClass.ScreenReader == null) return; MainClass.ScreenReader.Say(text, interrupt); } /// Speaks the text via the loaded screen reader (if any). ///
Skips the text narration if the previously narrated text was the same as the one provided.
/// The text to be narrated. /// Whether to skip the currently speaking text or not. public void SayWithChecker(String text, Boolean interrupt) { if (MainClass.ScreenReader == null) return; MainClass.ScreenReader.SayWithChecker(text, interrupt); } /// Speaks the text via the loaded screen reader (if any). ///
Skips the text narration if the previously narrated text was the same as the one provided. ///

Use this when narrating hovered component in menus to avoid interference.
/// The text to be narrated. /// Whether to skip the currently speaking text or not. public void SayWithMenuChecker(String text, Boolean interrupt) { if (MainClass.ScreenReader == null) return; MainClass.ScreenReader.SayWithMenuChecker(text, interrupt); } /// Speaks the text via the loaded screen reader (if any). ///
Skips the text narration if the previously narrated text was the same as the one provided. ///

Use this when narrating chat messages to avoid interference.
/// The text to be narrated. /// Whether to skip the currently speaking text or not. public void SayWithChatChecker(String text, Boolean interrupt) { if (MainClass.ScreenReader == null) return; MainClass.ScreenReader.SayWithChatChecker(text, interrupt); } /// Speaks the text via the loaded screen reader (if any). ///
Skips the text narration if the previously narrated text was the same as the one provided. ///

Use this when narrating texts based on tile position to avoid interference.
/// The text to be narrated. /// The X location of tile. /// The Y location of tile. /// Whether to skip the currently speaking text or not. public void SayWithTileQuery(String text, int x, int y, Boolean interrupt) { if (MainClass.ScreenReader == null) return; MainClass.ScreenReader.SayWithTileQuery(text, x, y, interrupt); } } }