Some fixes

master
shoaib11120 2021-12-28 20:44:59 +05:30
parent 51dd77d9fc
commit 63eecb797e
2 changed files with 57 additions and 56 deletions

View File

@ -14,8 +14,6 @@ namespace stardew_access.Patches
private static bool isRunning = false; private static bool isRunning = false;
private static string currentLetterText = " "; private static string currentLetterText = " ";
private static string currentDailyQuestText = " "; private static string currentDailyQuestText = " ";
public static bool isJoinTabSelected = false;
public static bool isHostTabSelected = false;
internal static void CoopMenuPatch(CoopMenu __instance, CoopMenu.Tab ___currentTab) internal static void CoopMenuPatch(CoopMenu __instance, CoopMenu.Tab ___currentTab)
{ {
@ -56,8 +54,7 @@ namespace stardew_access.Patches
} }
catch (Exception e) catch (Exception e)
{ {
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
throw;
} }
} }
@ -105,8 +102,7 @@ namespace stardew_access.Patches
} }
catch (Exception e) catch (Exception e)
{ {
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
throw;
} }
} }
@ -135,73 +131,79 @@ namespace stardew_access.Patches
} }
catch (Exception e) catch (Exception e)
{ {
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
throw;
} }
} }
internal static void BillboardPatch(Billboard __instance, bool ___dailyQuestBoard) internal static void BillboardPatch(Billboard __instance, bool ___dailyQuestBoard)
{ {
if (!___dailyQuestBoard) try
{ {
#region Callender if (!___dailyQuestBoard)
for (int i = 0; i < __instance.calendarDays.Count; i++)
{ {
if (__instance.calendarDays[i].containsPoint(Game1.getMousePosition(true).X, Game1.getMousePosition(true).Y)) #region Callender
for (int i = 0; i < __instance.calendarDays.Count; i++)
{ {
string toSpeak = $"Day {i + 1}"; if (__instance.calendarDays[i].containsPoint(Game1.getMousePosition(true).X, Game1.getMousePosition(true).Y))
if (__instance.calendarDays[i].name.Length > 0)
{ {
toSpeak += $", {__instance.calendarDays[i].name}"; string toSpeak = $"Day {i + 1}";
}
if (__instance.calendarDays[i].hoverText.Length > 0)
{
toSpeak += $", {__instance.calendarDays[i].hoverText}";
}
if (Game1.dayOfMonth == i + 1) if (__instance.calendarDays[i].name.Length > 0)
toSpeak += $", Current"; {
toSpeak += $", {__instance.calendarDays[i].name}";
}
if (__instance.calendarDays[i].hoverText.Length > 0)
{
toSpeak += $", {__instance.calendarDays[i].hoverText}";
}
ScreenReader.sayWithChecker(toSpeak, true); if (Game1.dayOfMonth == i + 1)
} toSpeak += $", Current";
}
#endregion ScreenReader.sayWithChecker(toSpeak, true);
} }
else
{
#region Daily Quest Board
if (Game1.questOfTheDay == null || Game1.questOfTheDay.currentObjective == null || Game1.questOfTheDay.currentObjective.Length == 0)
{
// No quests
string toSpeak = "No quests for today!";
if(currentDailyQuestText != toSpeak)
{
currentDailyQuestText = toSpeak;
ScreenReader.say(toSpeak, true);
} }
#endregion
} }
else else
{ {
SpriteFont font = ((LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ko) ? Game1.smallFont : Game1.dialogueFont); #region Daily Quest Board
string description = Game1.parseText(Game1.questOfTheDay.questDescription, font, 640); if (Game1.questOfTheDay == null || Game1.questOfTheDay.currentObjective == null || Game1.questOfTheDay.currentObjective.Length == 0)
string toSpeak = description;
if (currentDailyQuestText != toSpeak)
{ {
currentDailyQuestText = toSpeak; // No quests
string toSpeak = "No quests for today!";
// Snap to accept quest button if (currentDailyQuestText != toSpeak)
if (__instance.acceptQuestButton.visible)
{ {
toSpeak += "\t\n Left click to accept quest."; currentDailyQuestText = toSpeak;
__instance.acceptQuestButton.snapMouseCursorToCenter(); ScreenReader.say(toSpeak, true);
} }
ScreenReader.say(toSpeak, true);
} }
} else
#endregion {
SpriteFont font = ((LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ko) ? Game1.smallFont : Game1.dialogueFont);
string description = Game1.parseText(Game1.questOfTheDay.questDescription, font, 640);
string toSpeak = description;
if (currentDailyQuestText != toSpeak)
{
currentDailyQuestText = toSpeak;
// Snap to accept quest button
if (__instance.acceptQuestButton.visible)
{
toSpeak += "\t\n Left click to accept quest.";
__instance.acceptQuestButton.snapMouseCursorToCenter();
}
ScreenReader.say(toSpeak, true);
}
}
#endregion
}
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
} }
} }
@ -292,7 +294,6 @@ namespace stardew_access.Patches
} }
catch (Exception e) catch (Exception e)
{ {
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"Name": "Stardew Access", "Name": "Stardew Access",
"Author": "Mohammad Shoaib", "Author": "Mohammad Shoaib",
"Version": "1.0.9-beta", "Version": "1.0.10-beta",
"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",