Patch_GameScript_RefreshRecipeUnlock.cs 911 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using HarmonyLib;
  2. using GadgetCore.API;
  3. using UnityEngine;
  4. using System.Collections;
  5. namespace VendingMachine.Patches
  6. {
  7. [HarmonyPatch(typeof(GameScript))]
  8. [HarmonyPatch("RefreshRecipeUnlock")]
  9. [HarmonyGadget("VendingMachine")]
  10. public static class Patch_GameScript_RefreshRecipeUnlock
  11. {
  12. [HarmonyPrefix]
  13. public static bool Prefix(GameScript __instance,
  14. int ___craftType,
  15. int ___curRecipePage,
  16. GameObject ___ultLocksObj,
  17. GameObject ___recipeButtons,
  18. GameObject[] ___recipeLock,
  19. int[,] ___ultLocksUnlocked,
  20. GameObject[] ___ultLocks)
  21. {
  22. if (___craftType == 2 && ___curRecipePage >= 6)
  23. {
  24. ___ultLocksObj.SetActive(true);
  25. ___recipeButtons.SetActive(false);
  26. for (int i = 0; i < 36; i++)
  27. {
  28. if (i < 12)
  29. {
  30. ___recipeLock[i].SetActive(false);
  31. }
  32. ___ultLocks[i].SetActive(false);
  33. }
  34. return false;
  35. }
  36. return true;
  37. }
  38. }
  39. }