| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System;
- using System.Collections;
- using GadgetCore.API;
- using HarmonyLib;
- using UnityEngine;
- namespace PlatformBlock.Patches
- {
- [HarmonyPatch(typeof(KylockeStand))]
- [HarmonyPatch("Set")]
- [HarmonyGadget("PlatformBlock")]
- public static class Patch_KylockeStand_Set
- {
- [HarmonyPostfix]
- public static bool Prefix(KylockeStand __instance, int[] p)
- {
- if (p[0] == Core.itemPlatformId)
- {
- __instance.itemID = p[0];
- __instance.cost = p[1];
- __instance.icon.GetComponent<Renderer>().material = (Material)Resources.Load("i/i" + __instance.itemID.ToString());
- __instance.txtCost[0].text = string.Empty + __instance.cost.ToString();
- __instance.txtCost[1].text = __instance.txtCost[0].text;
- __instance.txtName[0].text = string.Empty + ItemRegistry.GetItem(__instance.itemID).GetName();
- __instance.txtName[1].text = __instance.txtName[0].text;
- __instance.StartCoroutine(Patch_KylockeStand_Set.DoUpdatePlatformStand(__instance));
- return false;
- }
- return true;
- }
- private static IEnumerator DoUpdatePlatformStand(KylockeStand instance)
- {
- instance.isBuild = true;
- instance.isCredits = false;
- instance.isTrophies = false;
- instance.currency.GetComponent<Renderer>().material = (Material)Resources.Load("i/i57");
- yield break;
- }
- }
- }
|