| 123456789101112131415161718192021222324252627282930313233343536 |
- 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;
- else if (CraftTypeHelper.IsCraftTypeRegisteredAsCustom(___craftType))
- {
- string s = CraftTypeHelper.GetNameFromCraftTypeRegisteredAsCustom(___craftType);
- pages = Core.pageCustomCrafterInfoLists[s].Count;
- }
- ___curRecipePage = (___curRecipePage + pages - 1) % pages;
- __instance.RefreshRecipe();
- return false;
- }
- }
- }
|