Making geode menu accessible
parent
d9b92e7203
commit
12bd0bea80
|
@ -118,15 +118,15 @@ namespace stardew_access
|
||||||
postfix: new HarmonyMethod(typeof(GameMenuPatches), nameof(GameMenuPatches.InventoryMenuPatch))
|
postfix: new HarmonyMethod(typeof(GameMenuPatches), nameof(GameMenuPatches.InventoryMenuPatch))
|
||||||
);
|
);
|
||||||
|
|
||||||
/*harmony.Patch(
|
|
||||||
original: AccessTools.Method(typeof(MenuWithInventory), nameof(MenuWithInventory.draw), new Type[] { typeof(SpriteBatch) }),
|
|
||||||
postfix: new HarmonyMethod(typeof(GameMenuPatches), nameof(GameMenuPatches.MenuWithInventoryPatch))
|
|
||||||
);*/
|
|
||||||
|
|
||||||
harmony.Patch(
|
harmony.Patch(
|
||||||
original: AccessTools.Method(typeof(ItemGrabMenu), nameof(ItemGrabMenu.draw), new Type[] { typeof(SpriteBatch) }),
|
original: AccessTools.Method(typeof(ItemGrabMenu), nameof(ItemGrabMenu.draw), new Type[] { typeof(SpriteBatch) }),
|
||||||
postfix: new HarmonyMethod(typeof(GameMenuPatches), nameof(GameMenuPatches.ItemGrabMenuPatch))
|
postfix: new HarmonyMethod(typeof(GameMenuPatches), nameof(GameMenuPatches.ItemGrabMenuPatch))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
harmony.Patch(
|
||||||
|
original: AccessTools.Method(typeof(GeodeMenu), nameof(GeodeMenu.draw), new Type[] { typeof(SpriteBatch) }),
|
||||||
|
postfix: new HarmonyMethod(typeof(GameMenuPatches), nameof(GameMenuPatches.GeodeMenuPatch))
|
||||||
|
);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Menu Patches
|
#region Menu Patches
|
||||||
|
@ -190,6 +190,13 @@ namespace stardew_access
|
||||||
);
|
);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region On Menu CLose Patch
|
||||||
|
harmony.Patch(
|
||||||
|
original: AccessTools.Method(typeof(IClickableMenu), nameof(IClickableMenu.exitThisMenu)),
|
||||||
|
postfix: new HarmonyMethod(typeof(MenuPatches), nameof(MenuPatches.IClickableMenuOnExitPatch))
|
||||||
|
);
|
||||||
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Custom Commands
|
#region Custom Commands
|
||||||
|
@ -228,10 +235,8 @@ namespace stardew_access
|
||||||
// Get the audio file and add it to a SoundEffect.
|
// Get the audio file and add it to a SoundEffect.
|
||||||
SoundEffect sound_effect;
|
SoundEffect sound_effect;
|
||||||
string filePathCombined = Path.Combine(this.Helper.DirectoryPath, "mySound.wav");
|
string filePathCombined = Path.Combine(this.Helper.DirectoryPath, "mySound.wav");
|
||||||
using (var stream = new System.IO.FileStream(filePathCombined, System.IO.FileMode.Open))
|
System.IO.FileStream stream = new System.IO.FileStream(filePathCombined, System.IO.FileMode.Open)
|
||||||
{
|
sound_effect = SoundEffect.FromStream(stream);*/
|
||||||
sound_effect = SoundEffect.FromStream(stream);
|
|
||||||
}*/
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
helper.Events.Input.ButtonPressed += this.OnButtonPressed;
|
helper.Events.Input.ButtonPressed += this.OnButtonPressed;
|
||||||
|
|
|
@ -122,6 +122,9 @@ namespace stardew_access.Patches
|
||||||
if (Game1.activeClickableMenu is Billboard)
|
if (Game1.activeClickableMenu is Billboard)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (Game1.activeClickableMenu is GeodeMenu)
|
||||||
|
return;
|
||||||
|
|
||||||
StringBuilder toSpeak = new StringBuilder(" ");
|
StringBuilder toSpeak = new StringBuilder(" ");
|
||||||
|
|
||||||
#region Add item count before title
|
#region Add item count before title
|
||||||
|
|
|
@ -7,6 +7,106 @@ namespace stardew_access.Patches
|
||||||
{
|
{
|
||||||
internal class GameMenuPatches
|
internal class GameMenuPatches
|
||||||
{
|
{
|
||||||
|
internal static string geodeMenuQueryKey = "";
|
||||||
|
|
||||||
|
internal static void GeodeMenuPatch(GeodeMenu __instance)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int x = Game1.getMousePosition(true).X, y = Game1.getMousePosition(true).Y; // Mouse x and y position
|
||||||
|
|
||||||
|
if (__instance.geodeSpot != null && __instance.geodeSpot.containsPoint(x, y))
|
||||||
|
{
|
||||||
|
string toSpeak = "Place geode here";
|
||||||
|
if (geodeMenuQueryKey != toSpeak)
|
||||||
|
{
|
||||||
|
geodeMenuQueryKey = toSpeak;
|
||||||
|
ScreenReader.say(toSpeak, true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (__instance.dropItemInvisibleButton != null && __instance.dropItemInvisibleButton.containsPoint(x, y))
|
||||||
|
{
|
||||||
|
string toSpeak = "Drop item here";
|
||||||
|
|
||||||
|
if (geodeMenuQueryKey != toSpeak)
|
||||||
|
{
|
||||||
|
geodeMenuQueryKey = toSpeak;
|
||||||
|
ScreenReader.say(toSpeak, true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (__instance.trashCan != null && __instance.trashCan.containsPoint(x, y))
|
||||||
|
{
|
||||||
|
string toSpeak = "Trash can";
|
||||||
|
|
||||||
|
if (geodeMenuQueryKey != toSpeak)
|
||||||
|
{
|
||||||
|
geodeMenuQueryKey = toSpeak;
|
||||||
|
ScreenReader.say(toSpeak, true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (__instance.okButton != null && __instance.okButton.containsPoint(x, y))
|
||||||
|
{
|
||||||
|
string toSpeak = "Ok button";
|
||||||
|
|
||||||
|
if (geodeMenuQueryKey != toSpeak)
|
||||||
|
{
|
||||||
|
geodeMenuQueryKey = toSpeak;
|
||||||
|
ScreenReader.say(toSpeak, true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < __instance.inventory.inventory.Count; i++)
|
||||||
|
{
|
||||||
|
if(__instance.inventory.inventory[i].containsPoint(x, y))
|
||||||
|
{
|
||||||
|
string toSpeak = "";
|
||||||
|
if ((i + 1) <= __instance.inventory.actualInventory.Count)
|
||||||
|
{
|
||||||
|
if (__instance.inventory.actualInventory[i] != null)
|
||||||
|
{
|
||||||
|
string name = __instance.inventory.actualInventory[i].DisplayName;
|
||||||
|
int stack = __instance.inventory.actualInventory[i].Stack;
|
||||||
|
|
||||||
|
if(stack>1)
|
||||||
|
toSpeak = $"{stack} {name}";
|
||||||
|
else
|
||||||
|
toSpeak = $"{name}";
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// For empty slot
|
||||||
|
toSpeak = "Empty Slot";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// For empty slot
|
||||||
|
toSpeak = "Empty Slot";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (geodeMenuQueryKey != $"{toSpeak}:{i}")
|
||||||
|
{
|
||||||
|
geodeMenuQueryKey = $"{toSpeak}:{i}";
|
||||||
|
ScreenReader.say(toSpeak, true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal static void ItemGrabMenuPatch(ItemGrabMenu __instance)
|
internal static void ItemGrabMenuPatch(ItemGrabMenu __instance)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -256,6 +256,21 @@ namespace stardew_access.Patches
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static void IClickableMenuOnExitPatch(IClickableMenu __instance)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(__instance is GeodeMenu)
|
||||||
|
{
|
||||||
|
GameMenuPatches.geodeMenuQueryKey = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal static void resetGlobalVars()
|
internal static void resetGlobalVars()
|
||||||
{
|
{
|
||||||
currentLetterText = " ";
|
currentLetterText = " ";
|
||||||
|
|
Loading…
Reference in New Issue