Options page is now accessible

master
shoaib11120 2021-12-28 19:00:51 +05:30
parent 28d6628b40
commit d16f53723a
1 changed files with 17 additions and 29 deletions

View File

@ -14,8 +14,6 @@ namespace stardew_access.Patches
private static string currentLetterText = " ";
private static string currentDailyQuestText = " ";
private static int? prev = null;
internal static void OptionsPagePatch(OptionsPage __instance)
{
int currentItemIndex = Math.Max(0, Math.Min(__instance.options.Count - 7, __instance.currentItemIndex));
@ -30,41 +28,31 @@ namespace stardew_access.Patches
if (optionsElement is OptionsButton)
toSpeak = $" {toSpeak} Button";
else if (optionsElement is OptionsCheckbox)
toSpeak = (optionsElement as OptionsCheckbox).isChecked ? "Enabled":"Disabled" + $" {toSpeak} Checkbox";
toSpeak = ((optionsElement as OptionsCheckbox).isChecked ? "Enabled" : "Disabled") + $" {toSpeak} Checkbox";
else if (optionsElement is OptionsDropDown)
toSpeak = $"{toSpeak} Dropdown, option {(optionsElement as OptionsDropDown).dropDownDisplayOptions[(optionsElement as OptionsDropDown).selectedOption]} selected";
else if (optionsElement is OptionsSlider)
toSpeak = $"{(optionsElement as OptionsSlider).value}% {toSpeak} Slider";
else if (optionsElement is OptionsPlusMinus)
toSpeak = $"{(optionsElement as OptionsPlusMinus).displayOptions[(optionsElement as OptionsPlusMinus).selected]} selected of {toSpeak}";
else if (optionsElement is OptionsInputListener)
{
string buttons = "";
(optionsElement as OptionsInputListener).buttonNames.ForEach(name => { buttons += $", {name}"; });
toSpeak = $"{toSpeak} is bound to {buttons}. Left click to change.";
}
else
{
if(toSpeak.Contains(':'))
toSpeak = toSpeak.Remove(':');
MainClass.monitor.Log(toSpeak, LogLevel.Debug);
toSpeak = $"{toSpeak} Options:";
}
ScreenReader.sayWithChecker(toSpeak, true);
break;
}
}
/*__instance.optionSlots.ForEach(slot =>
{
int index;
try
{
index = int.Parse(slot.name);
}
catch
{
index = 0;
}
if (prev != index && slot.containsPoint(Game1.getMousePosition(true).X, Game1.getMousePosition(true).Y))
{
prev = index;
MainClass.monitor.Log($"{__instance.options[index].label}", LogLevel.Debug);
if (__instance.options[index] is OptionsButton)
MainClass.monitor.Log($"Button", LogLevel.Debug);
else if (__instance.options[index] is OptionsCheckbox)
MainClass.monitor.Log($"Checkbox {(__instance.options[index] as OptionsCheckbox).isChecked}", LogLevel.Debug);
else if (__instance.options[index] is OptionsDropDown)
MainClass.monitor.Log($"Dropdown {(__instance.options[index] as OptionsDropDown).dropDownDisplayOptions[(__instance.options[index] as OptionsDropDown).selectedOption]}", LogLevel.Debug);
else if (__instance.options[index] is OptionsSlider)
MainClass.monitor.Log($"Slider {(__instance.options[index] as OptionsSlider).value}", LogLevel.Debug);
}
});*/
}
internal static void ShippingMenuPatch(ShippingMenu __instance, List<int> ___categoryTotals)