Patch_GameScript_RecipeUp.cs 862 B

12345678910111213141516171819202122232425262728293031323334
  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. switch (___craftType)
  17. {
  18. case 0:
  19. pages = 6 + Core.pageGearForgeInfoList.Count;
  20. break;
  21. case 1:
  22. pages = 2 + Core.pageAlchemyStationInfoList.Count;
  23. break;
  24. case 2:
  25. pages = 6 + Core.pageUltimateForgeInfoList.Count;
  26. break;
  27. }
  28. ___curRecipePage = (___curRecipePage + 1) % pages;
  29. __instance.RefreshRecipe();
  30. return false;
  31. }
  32. }
  33. }