using HarmonyLib; using GadgetCore.API; using UnityEngine; using System.Collections; namespace RecipeMenuCore.Patches { [HarmonyPatch(typeof(GameScript))] [HarmonyPatch("RecipeDown")] [HarmonyGadget("RecipeMenuCore")] public static class Patch_GameScript_RecipeDown { [HarmonyPrefix] public static bool Prefix(GameScript __instance, int ___craftType, ref int ___curRecipePage) { int pages = 1; if (___craftType == 0) pages = 6 + Core.pageGearForgeInfoList.Count; else if (___craftType == 1) pages = 2 + Core.pageAlchemyStationInfoList.Count; else if (___craftType == 2) pages = 6 + Core.pageUltimateForgeInfoList.Count; else if (___craftType == MenuRegistry.Singleton["Gadget Core:Crafter Menu"].GetID()) pages = Core.pageUniversalCrafterInfoList.Count; ___curRecipePage = (___curRecipePage + pages - 1) % pages; __instance.RefreshRecipe(); return false; } } }