Improved game menu patch code
- Added active suffix if the hovered tab button matches the current tabmaster
parent
911c93a555
commit
15380e5b76
|
@ -11,26 +11,28 @@ namespace stardew_access.Patches
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Continue if only in the Inventory Page or Crafting Page
|
// Skip if in map page
|
||||||
if (__instance.currentTab != 0 && __instance.currentTab != 4 && __instance.currentTab != 6 && __instance.currentTab != 7)
|
if (__instance.currentTab == 3)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
||||||
|
|
||||||
for (int i = 0; i < __instance.tabs.Count; i++)
|
for (int i = 0; i < __instance.tabs.Count; i++)
|
||||||
{
|
{
|
||||||
if (__instance.tabs[i].containsPoint(x, y))
|
if (!__instance.tabs[i].containsPoint(x, y))
|
||||||
{
|
continue;
|
||||||
string toSpeak = $"{GameMenu.getLabelOfTabFromIndex(i)} Tab";
|
|
||||||
|
string toSpeak = $"{GameMenu.getLabelOfTabFromIndex(i)} Tab" + ((i == __instance.currentTab) ? " Active" : "");
|
||||||
if (gameMenuQueryKey != toSpeak)
|
if (gameMenuQueryKey != toSpeak)
|
||||||
{
|
{
|
||||||
MainClass.DebugLog("here");
|
|
||||||
gameMenuQueryKey = toSpeak;
|
gameMenuQueryKey = toSpeak;
|
||||||
MainClass.ScreenReader.Say(toSpeak, true);
|
MainClass.ScreenReader.Say(toSpeak, true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// If not hovering on any tab button
|
||||||
|
Cleanup();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue