Patched advanced options menu
parent
157bdd0150
commit
617251c3de
|
@ -50,6 +50,11 @@ namespace stardew_access
|
||||||
original: AccessTools.Method(typeof(CoopMenu), nameof(CoopMenu.update), new Type[] { typeof(GameTime) }),
|
original: AccessTools.Method(typeof(CoopMenu), nameof(CoopMenu.update), new Type[] { typeof(GameTime) }),
|
||||||
postfix: new HarmonyMethod(typeof(TitleMenuPatches), nameof(TitleMenuPatches.CoopMenuPatch))
|
postfix: new HarmonyMethod(typeof(TitleMenuPatches), nameof(TitleMenuPatches.CoopMenuPatch))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
harmony.Patch(
|
||||||
|
original: AccessTools.Method(typeof(AdvancedGameOptions), nameof(AdvancedGameOptions.draw), new Type[] { typeof(SpriteBatch) }),
|
||||||
|
postfix: new HarmonyMethod(typeof(TitleMenuPatches), nameof(TitleMenuPatches.AdvancedGameOptionsPatch))
|
||||||
|
);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Game Menu Patches
|
#region Game Menu Patches
|
||||||
|
|
|
@ -11,8 +11,64 @@ namespace stardew_access.Patches
|
||||||
private static int saveGameIndex = -1;
|
private static int saveGameIndex = -1;
|
||||||
private static bool isRunning = false;
|
private static bool isRunning = false;
|
||||||
public static string characterCreationMenuQueryKey = " ";
|
public static string characterCreationMenuQueryKey = " ";
|
||||||
|
public static string advancedGameOptionsQueryKey = " ";
|
||||||
public static string prevPetName = " ";
|
public static string prevPetName = " ";
|
||||||
|
|
||||||
|
internal static void AdvancedGameOptionsPatch(AdvancedGameOptions __instance)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int currentItemIndex = Math.Max(0, Math.Min(__instance.options.Count - 7, __instance.currentItemIndex));
|
||||||
|
int x = Game1.getMouseX(true), y = Game1.getMouseY(true);
|
||||||
|
for (int i = 0; i < __instance.optionSlots.Count; i++)
|
||||||
|
{
|
||||||
|
if (__instance.optionSlots[i].bounds.Contains(x, y) && currentItemIndex + i < __instance.options.Count && __instance.options[currentItemIndex + i].bounds.Contains(x - __instance.optionSlots[i].bounds.X, y - __instance.optionSlots[i].bounds.Y))
|
||||||
|
{
|
||||||
|
OptionsElement optionsElement = __instance.options[currentItemIndex + i];
|
||||||
|
string toSpeak = optionsElement.label;
|
||||||
|
|
||||||
|
if (optionsElement is OptionsButton)
|
||||||
|
toSpeak = $" {toSpeak} Button";
|
||||||
|
else if (optionsElement is OptionsCheckbox)
|
||||||
|
toSpeak = (((OptionsCheckbox)optionsElement).isChecked ? "Enabled" : "Disabled") + $" {toSpeak} Checkbox";
|
||||||
|
else if (optionsElement is OptionsDropDown)
|
||||||
|
toSpeak = $"{toSpeak} Dropdown, option {((OptionsDropDown)optionsElement).dropDownDisplayOptions[((OptionsDropDown)optionsElement).selectedOption]} selected";
|
||||||
|
else if (optionsElement is OptionsSlider)
|
||||||
|
toSpeak = $"{((OptionsSlider)optionsElement).value}% {toSpeak} Slider";
|
||||||
|
else if (optionsElement is OptionsPlusMinus)
|
||||||
|
toSpeak = $"{((OptionsPlusMinus)optionsElement).displayOptions[((OptionsPlusMinus)optionsElement).selected]} selected of {toSpeak}";
|
||||||
|
else if (optionsElement is OptionsInputListener)
|
||||||
|
{
|
||||||
|
string buttons = "";
|
||||||
|
((OptionsInputListener)optionsElement).buttonNames.ForEach(name => { buttons += $", {name}"; });
|
||||||
|
toSpeak = $"{toSpeak} is bound to {buttons}. Left click to change.";
|
||||||
|
}
|
||||||
|
else if (optionsElement is OptionsTextEntry)
|
||||||
|
{
|
||||||
|
toSpeak = $"Seed text box";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (toSpeak.Contains(":"))
|
||||||
|
toSpeak = toSpeak.Replace(":", "");
|
||||||
|
|
||||||
|
toSpeak = $"{toSpeak} Options:";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (advancedGameOptionsQueryKey != toSpeak)
|
||||||
|
{
|
||||||
|
advancedGameOptionsQueryKey = toSpeak;
|
||||||
|
MainClass.ScreenReader.Say(toSpeak, true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal static void CoopMenuPatch(CoopMenu __instance, CoopMenu.Tab ___currentTab)
|
internal static void CoopMenuPatch(CoopMenu __instance, CoopMenu.Tab ___currentTab)
|
||||||
{
|
{
|
||||||
|
@ -327,6 +383,9 @@ namespace stardew_access.Patches
|
||||||
if (__instance.skipIntroButton != null && __instance.skipIntroButton.visible)
|
if (__instance.skipIntroButton != null && __instance.skipIntroButton.visible)
|
||||||
buttons.Add(__instance.skipIntroButton, (___skipIntro ? "Enabled" : "Disabled") + " Skip Intro Button");
|
buttons.Add(__instance.skipIntroButton, (___skipIntro ? "Enabled" : "Disabled") + " Skip Intro Button");
|
||||||
|
|
||||||
|
if (__instance.advancedOptionsButton != null && __instance.advancedOptionsButton.visible)
|
||||||
|
buttons.Add(__instance.advancedOptionsButton, "Advanced Options Button");
|
||||||
|
|
||||||
if (__instance.okButton != null && __instance.okButton.visible)
|
if (__instance.okButton != null && __instance.okButton.visible)
|
||||||
buttons.Add(__instance.okButton, "OK Button");
|
buttons.Add(__instance.okButton, "OK Button");
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"Name": "Stardew Access",
|
"Name": "Stardew Access",
|
||||||
"Author": "Mohammad Shoaib",
|
"Author": "Mohammad Shoaib",
|
||||||
"Version": "1.2.4",
|
"Version": "1.2.5",
|
||||||
"Description": "An accessibility mod with screen reader support!",
|
"Description": "An accessibility mod with screen reader support!",
|
||||||
"UniqueID": "shoaib.stardewaccess",
|
"UniqueID": "shoaib.stardewaccess",
|
||||||
"EntryDll": "stardew-access.dll",
|
"EntryDll": "stardew-access.dll",
|
||||||
|
|
Loading…
Reference in New Issue