| 12345678910111213141516171819202122232425262728293031323334 |
- using HarmonyLib;
- using GadgetCore.API;
- using UnityEngine;
- using System.Collections;
- using System.Reflection;
- using System.Collections.Generic;
- namespace RecipeMenuCore.Patches
- {
- [HarmonyPatch(typeof(CraftMenuInfo))]
- [HarmonyPatch("AllowQuickCrafting")]
- [HarmonyGadget("RecipeMenuCore")]
- public static class Patch_CraftMenuInfo_AllowQuickCrafting
- {
- [HarmonyPrefix]
- public static bool Prefix(CraftMenuInfo __instance, ref bool __result)
- {
- if(__instance.GetRegistryName() == "Gadget Core:Crafter Menu")
- {
- __result = Core.pageUniversalCrafterInfoList.Count > 0;
- return false;
- }
- foreach(var crafter in Core.pageCustomCrafterInfoLists.Keys)
- {
- if (__instance.GetRegistryName() == crafter)
- {
- __result = Core.pageCustomCrafterInfoLists[crafter].Count > 0;
- return false;
- }
- }
- return true;
- }
- }
- }
|