Fix snap mouse and read tile bug
parent
63540393b7
commit
6c6c7bdecf
|
@ -176,16 +176,64 @@ namespace stardew_access
|
|||
int x = Game1.player.GetBoundingBox().Center.X - Game1.viewport.X;
|
||||
int y = Game1.player.GetBoundingBox().Center.Y - Game1.viewport.Y;
|
||||
|
||||
int offset = 64;
|
||||
|
||||
switch (Game1.player.FacingDirection)
|
||||
{
|
||||
case 0:
|
||||
y -= offset;
|
||||
break;
|
||||
case 1:
|
||||
x += offset;
|
||||
break;
|
||||
case 2:
|
||||
y += offset;
|
||||
break;
|
||||
case 3:
|
||||
x -= offset;
|
||||
break;
|
||||
}
|
||||
|
||||
Game1.setMousePosition(x, y);
|
||||
}
|
||||
|
||||
private static async void ReadTile()
|
||||
{
|
||||
isReadingTile = true;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
#region Get Correct Grab Tile
|
||||
int x = Game1.player.GetBoundingBox().Center.X;
|
||||
int y = Game1.player.GetBoundingBox().Center.Y;
|
||||
|
||||
int offset = 64;
|
||||
|
||||
switch (Game1.player.FacingDirection)
|
||||
{
|
||||
case 0:
|
||||
y -= offset;
|
||||
break;
|
||||
case 1:
|
||||
x += offset;
|
||||
break;
|
||||
case 2:
|
||||
y += offset;
|
||||
break;
|
||||
case 3:
|
||||
x -= offset;
|
||||
break;
|
||||
}
|
||||
|
||||
x /= Game1.tileSize;
|
||||
y /= Game1.tileSize;
|
||||
Vector2 gt = new Vector2(x, y);
|
||||
#endregion
|
||||
|
||||
if (Context.IsPlayerFree)
|
||||
{
|
||||
Dictionary<Vector2, Netcode.NetRef<TerrainFeature>> terrainFeature = Game1.currentLocation.terrainFeatures.FieldDict;
|
||||
Vector2 gt = Game1.player.GetGrabTile();
|
||||
|
||||
StardewValley.Object obj = Game1.currentLocation.getObjectAtTile((int)gt.X, (int)gt.Y);
|
||||
if (!Equals(gt, prevTile))
|
||||
|
@ -195,8 +243,6 @@ namespace stardew_access
|
|||
{
|
||||
string name = obj.name;
|
||||
|
||||
string checkQuery = $"x:{gt.X} y:{gt.Y}";
|
||||
|
||||
ScreenReader.say(name, true);
|
||||
|
||||
}
|
||||
|
@ -211,8 +257,17 @@ namespace stardew_access
|
|||
{
|
||||
string cropName = Game1.objectInformation[dirt.crop.indexOfHarvest];
|
||||
cropName = cropName.Substring(0, cropName.IndexOf("/"));
|
||||
|
||||
string toSpeak = $"{cropName}";
|
||||
|
||||
bool isWatered = dirt.state.Value == HoeDirt.watered;
|
||||
bool isHarvestable = dirt.crop.fullyGrown.Get();
|
||||
|
||||
if(isWatered)
|
||||
toSpeak = "Watered " + toSpeak;
|
||||
|
||||
if (isHarvestable)
|
||||
toSpeak = "Harvestable " + toSpeak;
|
||||
|
||||
ScreenReader.say(toSpeak, true);
|
||||
}
|
||||
}
|
||||
|
@ -220,6 +275,11 @@ namespace stardew_access
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
monitor.Log($"Error in Read Tile:\n{e.Message}\n{e.StackTrace}");
|
||||
}
|
||||
|
||||
await Task.Delay(100);
|
||||
isReadingTile = false;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"Name": "Stardew Access",
|
||||
"Author": "Mohammad Shoaib",
|
||||
"Version": "1.0.3-beta",
|
||||
"Version": "1.0.4-beta",
|
||||
"Description": "An accessibility mod with screen reader support!",
|
||||
"UniqueID": "shoaib.stardewaccess",
|
||||
"EntryDll": "stardew-access.dll",
|
||||
|
|
Loading…
Reference in New Issue