Patch_GameScript_RecipeUp.cs 959 B

12345678910111213141516171819202122232425262728293031
  1. using HarmonyLib;
  2. using GadgetCore.API;
  3. using UnityEngine;
  4. using System.Collections;
  5. namespace RecipeMenuCore.Patches
  6. {
  7. [HarmonyPatch(typeof(GameScript))]
  8. [HarmonyPatch("RecipeUp")]
  9. [HarmonyGadget("RecipeMenuCore")]
  10. public static class Patch_GameScript_RecipeUp
  11. {
  12. [HarmonyPrefix]
  13. public static bool Prefix(GameScript __instance, int ___craftType, ref int ___curRecipePage)
  14. {
  15. int pages = 1;
  16. if (___craftType == 0)
  17. pages = 6 + Core.pageGearForgeInfoList.Count;
  18. else if (___craftType == 1)
  19. pages = 2 + Core.pageAlchemyStationInfoList.Count;
  20. else if (___craftType == 2)
  21. pages = 6 + Core.pageUltimateForgeInfoList.Count;
  22. else if (___craftType == MenuRegistry.Singleton["Gadget Core:Crafter Menu"].GetID())
  23. pages = Core.pageUniversalCrafterInfoList.Count;
  24. ___curRecipePage = (___curRecipePage + 1) % pages;
  25. __instance.RefreshRecipe();
  26. return false;
  27. }
  28. }
  29. }