using GadgetCore.API; using HarmonyLib; using System.Collections; using System.Reflection; using UnityEngine; namespace StorageExpansion.Patches { [HarmonyPatch(typeof(GameScript))] [HarmonyPatch("RefreshSlotStorage")] [HarmonyGadget("StorageExpansion")] public static class Patch_GameScript_RefreshSlotStorage { [HarmonyPrefix] public static bool Prefix(GameScript __instance, int i, Item[] ___storage, GameObject[] ___storageIconBack, GameObject[] ___storageIcon, int ___curStoragePage, TextMesh[] ___txtQStorage) { int num = i + ___curStoragePage * Core.settingAmountSlots; ___storageIcon[i].GetComponent().material = (Material)Resources.Load("i/i" + ___storage[num].id); AnimIcon animIcon = (AnimIcon)___storageIconBack[i].GetComponent("AnimIcon"); if (___storage[num].id < 300 || ___storage[num].id >= 2000) { ___storageIconBack[i].SetActive(false); animIcon.anim = 0; } else { ___storageIconBack[i].GetComponent().material = (Material)Resources.Load("iBack" + ___storage[num].tier); if (___storage[num].tier == 3) { animIcon.anim = 1; } else { animIcon.anim = 0; } ___storageIconBack[i].SetActive(true); } if (___storage[num].q > 1) { ___txtQStorage[i].text = string.Empty + ___storage[num].q; } else { ___txtQStorage[i].text = string.Empty; } return false; } } }