Now it narrates tiles even if they update
parent
dd0889e7fb
commit
8fe6d37d4b
|
@ -251,12 +251,9 @@ namespace stardew_access
|
||||||
{
|
{
|
||||||
Dictionary<Vector2, Netcode.NetRef<TerrainFeature>> terrainFeature = Game1.currentLocation.terrainFeatures.FieldDict;
|
Dictionary<Vector2, Netcode.NetRef<TerrainFeature>> terrainFeature = Game1.currentLocation.terrainFeatures.FieldDict;
|
||||||
|
|
||||||
if (!Equals(gt, prevTile))
|
if (Game1.currentLocation.isWaterTile(x, y))
|
||||||
{
|
{
|
||||||
prevTile = gt;
|
ScreenReader.sayWithTileQuery("Water", x, y, true);
|
||||||
|
|
||||||
if (Game1.currentLocation.isWaterTile(x, y)){
|
|
||||||
ScreenReader.say("Water", true);
|
|
||||||
}
|
}
|
||||||
else if (Game1.currentLocation.getObjectAtTile(x, y) != null)
|
else if (Game1.currentLocation.getObjectAtTile(x, y) != null)
|
||||||
{
|
{
|
||||||
|
@ -273,7 +270,7 @@ namespace stardew_access
|
||||||
name = "Copper " + name;
|
name = "Copper " + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenReader.say(name, true);
|
ScreenReader.sayWithTileQuery(name, x, y, true);
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
else if (terrainFeature.ContainsKey(gt))
|
else if (terrainFeature.ContainsKey(gt))
|
||||||
|
@ -302,7 +299,7 @@ namespace stardew_access
|
||||||
if (isHarvestable)
|
if (isHarvestable)
|
||||||
toSpeak = "Harvestable " + toSpeak;
|
toSpeak = "Harvestable " + toSpeak;
|
||||||
|
|
||||||
ScreenReader.say(toSpeak, true);
|
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -316,13 +313,13 @@ namespace stardew_access
|
||||||
if (isFertilized)
|
if (isFertilized)
|
||||||
toSpeak = "Fertilized " + toSpeak;
|
toSpeak = "Fertilized " + toSpeak;
|
||||||
|
|
||||||
ScreenReader.say(toSpeak, true);
|
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (terrain.Get() is Bush)
|
else if (terrain.Get() is Bush)
|
||||||
{
|
{
|
||||||
string toSpeak = "Bush";
|
string toSpeak = "Bush";
|
||||||
ScreenReader.say(toSpeak, true);
|
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
||||||
}
|
}
|
||||||
else if (terrain.Get() is CosmeticPlant)
|
else if (terrain.Get() is CosmeticPlant)
|
||||||
{
|
{
|
||||||
|
@ -335,7 +332,7 @@ namespace stardew_access
|
||||||
if (toSpeak.Contains("feature"))
|
if (toSpeak.Contains("feature"))
|
||||||
toSpeak.Replace("feature", "");
|
toSpeak.Replace("feature", "");
|
||||||
|
|
||||||
ScreenReader.say(toSpeak, true);
|
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
||||||
}
|
}
|
||||||
else if (terrain.Get() is Flooring)
|
else if (terrain.Get() is Flooring)
|
||||||
{
|
{
|
||||||
|
@ -351,29 +348,21 @@ namespace stardew_access
|
||||||
if (isSteppingStone)
|
if (isSteppingStone)
|
||||||
toSpeak = "Stepping Stone";
|
toSpeak = "Stepping Stone";
|
||||||
|
|
||||||
ScreenReader.say(toSpeak, true);
|
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
||||||
}
|
}
|
||||||
else if (terrain.Get() is FruitTree)
|
else if (terrain.Get() is FruitTree)
|
||||||
{
|
{
|
||||||
FruitTree fruitTree = (FruitTree)terrain.Get();
|
FruitTree fruitTree = (FruitTree)terrain.Get();
|
||||||
string toSpeak = Game1.objectInformation[fruitTree.treeType].Split('/')[0];
|
string toSpeak = Game1.objectInformation[fruitTree.treeType].Split('/')[0];
|
||||||
|
|
||||||
ScreenReader.say(toSpeak, true);
|
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
||||||
}
|
|
||||||
else if (terrain.Get() is ResourceClump)
|
|
||||||
{
|
|
||||||
ResourceClump resourceClump = (ResourceClump)terrain.Get();
|
|
||||||
monitor.Log(Game1.objectInformation[resourceClump.parentSheetIndex], LogLevel.Debug);
|
|
||||||
string toSpeak = Game1.objectInformation[resourceClump.parentSheetIndex].Split('/')[0];
|
|
||||||
|
|
||||||
ScreenReader.say(toSpeak, true);
|
|
||||||
}
|
}
|
||||||
else if (terrain.Get() is Grass)
|
else if (terrain.Get() is Grass)
|
||||||
{
|
{
|
||||||
Grass grass = (Grass)terrain.Get();
|
Grass grass = (Grass)terrain.Get();
|
||||||
string toSpeak = "Grass";
|
string toSpeak = "Grass";
|
||||||
|
|
||||||
ScreenReader.say(toSpeak, true);
|
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
||||||
}
|
}
|
||||||
else if (terrain.Get() is Tree)
|
else if (terrain.Get() is Tree)
|
||||||
{
|
{
|
||||||
|
@ -397,17 +386,17 @@ namespace stardew_access
|
||||||
|
|
||||||
toSpeak += $", {stage} stage";
|
toSpeak += $", {stage} stage";
|
||||||
|
|
||||||
ScreenReader.say(toSpeak, true);
|
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
||||||
}
|
}
|
||||||
else if (terrain.Get() is Quartz)
|
else if (terrain.Get() is Quartz)
|
||||||
{
|
{
|
||||||
string toSpeak = "Quartz";
|
string toSpeak = "Quartz";
|
||||||
ScreenReader.say(toSpeak, true);
|
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
||||||
}
|
}
|
||||||
else if (terrain.Get() is Leaf)
|
else if (terrain.Get() is Leaf)
|
||||||
{
|
{
|
||||||
string toSpeak = "Leaf";
|
string toSpeak = "Leaf";
|
||||||
ScreenReader.say(toSpeak, true);
|
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
@ -446,7 +435,7 @@ namespace stardew_access
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenReader.say(toSpeak, true);
|
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -459,21 +448,23 @@ namespace stardew_access
|
||||||
{
|
{
|
||||||
if (Equals(x, ydoor.X) && Equals(y, ydoor.Y))
|
if (Equals(x, ydoor.X) && Equals(y, ydoor.Y))
|
||||||
{
|
{
|
||||||
ScreenReader.say("Door", true);
|
ScreenReader.sayWithTileQuery("Door", x, y, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Ladder
|
||||||
if (Game1.inMine || Game1.currentLocation is Mine)
|
if (Game1.inMine || Game1.currentLocation is Mine)
|
||||||
{
|
{
|
||||||
int index = Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y].TileIndex;
|
int index = Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y].TileIndex;
|
||||||
|
|
||||||
if (index == 173 || index == 174)
|
if (index == 173 || index == 174)
|
||||||
ScreenReader.say("Ladder", true);
|
ScreenReader.sayWithTileQuery("Ladder", x, y, true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
|
@ -73,5 +73,19 @@ namespace stardew_access
|
||||||
screenReader.Speak(text, interrupt);
|
screenReader.Speak(text, interrupt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void sayWithTileQuery(string text, int x, int y, bool interrupt)
|
||||||
|
{
|
||||||
|
if (screenReader == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
string query = $"{text} x:{x} y:{y}";
|
||||||
|
|
||||||
|
if (prevText != query)
|
||||||
|
{
|
||||||
|
prevText = query;
|
||||||
|
screenReader.Speak(text, interrupt);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue