Patched collections page's letter viewer menu
This commit is contained in:
		@@ -101,6 +101,11 @@ namespace stardew_access
 | 
				
			|||||||
                original: AccessTools.Method(typeof(JunimoNoteMenu), nameof(JunimoNoteMenu.draw), new Type[] { typeof(SpriteBatch) }),
 | 
					                original: AccessTools.Method(typeof(JunimoNoteMenu), nameof(JunimoNoteMenu.draw), new Type[] { typeof(SpriteBatch) }),
 | 
				
			||||||
                postfix: new HarmonyMethod(typeof(GameMenuPatches), nameof(GameMenuPatches.JunimoNoteMenuPatch))
 | 
					                postfix: new HarmonyMethod(typeof(GameMenuPatches), nameof(GameMenuPatches.JunimoNoteMenuPatch))
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            harmony.Patch(
 | 
				
			||||||
 | 
					                original: AccessTools.Method(typeof(CollectionsPage), nameof(CollectionsPage.draw), new Type[] { typeof(SpriteBatch) }),
 | 
				
			||||||
 | 
					                postfix: new HarmonyMethod(typeof(GameMenuPatches), nameof(GameMenuPatches.CollectionsPagePatch))
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
            #endregion
 | 
					            #endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            #region Menu Patches
 | 
					            #region Menu Patches
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -330,6 +330,17 @@ namespace stardew_access.Patches
 | 
				
			|||||||
                if (!__instance.IsActive())
 | 
					                if (!__instance.IsActive())
 | 
				
			||||||
                    return;
 | 
					                    return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                NarrateLetterContent(__instance);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            catch (Exception e)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        internal static void NarrateLetterContent(LetterViewerMenu __instance)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            int x = Game1.getMousePosition().X, y = Game1.getMousePosition().Y;
 | 
					            int x = Game1.getMousePosition().X, y = Game1.getMousePosition().Y;
 | 
				
			||||||
            #region Texts in the letter
 | 
					            #region Texts in the letter
 | 
				
			||||||
            string message = __instance.mailMessage[__instance.page];
 | 
					            string message = __instance.mailMessage[__instance.page];
 | 
				
			||||||
@@ -363,7 +374,7 @@ namespace stardew_access.Patches
 | 
				
			|||||||
                if (__instance.mailMessage.Count > 1)
 | 
					                if (__instance.mailMessage.Count > 1)
 | 
				
			||||||
                    toSpeak = $"Page {__instance.page + 1} of {__instance.mailMessage.Count}:\n\t{toSpeak}";
 | 
					                    toSpeak = $"Page {__instance.page + 1} of {__instance.mailMessage.Count}:\n\t{toSpeak}";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    MainClass.GetScreenReader().Say(toSpeak, false);
 | 
					                MainClass.GetScreenReader().Say(toSpeak, true);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            #endregion
 | 
					            #endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -390,11 +401,5 @@ namespace stardew_access.Patches
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            #endregion
 | 
					            #endregion
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
            catch (Exception e)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,6 +5,7 @@ using StardewValley.Objects;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace stardew_access.Patches
 | 
					namespace stardew_access.Patches
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    // Menus in the game menu i.e., the menu which opens when we press `e`
 | 
				
			||||||
    internal class GameMenuPatches
 | 
					    internal class GameMenuPatches
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        internal static string hoveredItemQueryKey = "";
 | 
					        internal static string hoveredItemQueryKey = "";
 | 
				
			||||||
@@ -19,11 +20,28 @@ namespace stardew_access.Patches
 | 
				
			|||||||
        internal static string socialPageQuery = "";
 | 
					        internal static string socialPageQuery = "";
 | 
				
			||||||
        internal static string profilePageQuery = "";
 | 
					        internal static string profilePageQuery = "";
 | 
				
			||||||
        internal static string junimoNoteMenuQuery = "";
 | 
					        internal static string junimoNoteMenuQuery = "";
 | 
				
			||||||
 | 
					        internal static string collectionsPageQuery = "";
 | 
				
			||||||
        internal static int currentSelectedCraftingRecipe = -1;
 | 
					        internal static int currentSelectedCraftingRecipe = -1;
 | 
				
			||||||
        internal static bool isSelectingRecipe = false;
 | 
					        internal static bool isSelectingRecipe = false;
 | 
				
			||||||
        internal static bool isUsingCustomButtons = false;
 | 
					        internal static bool isUsingCustomButtons = false;
 | 
				
			||||||
        internal static int currentIngredientListItem = -1, currentIngredientInputSlot = -1, currentInventorySlot = -1;
 | 
					        internal static int currentIngredientListItem = -1, currentIngredientInputSlot = -1, currentInventorySlot = -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        internal static void CollectionsPagePatch(CollectionsPage __instance)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            try
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                int x = Game1.getMousePosition().X, y = Game1.getMousePosition().Y;
 | 
				
			||||||
 | 
					                if (__instance.letterviewerSubMenu != null)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    DialoguePatches.NarrateLetterContent(__instance.letterviewerSubMenu);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            catch (System.Exception e)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        internal static void JunimoNoteMenuPatch(JunimoNoteMenu __instance, bool ___specificBundlePage, int ___whichArea, Bundle ___currentPageBundle)
 | 
					        internal static void JunimoNoteMenuPatch(JunimoNoteMenu __instance, bool ___specificBundlePage, int ___whichArea, Bundle ___currentPageBundle)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            try
 | 
					            try
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user