| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using HarmonyLib;
- using GadgetCore.API;
- using UnityEngine;
- using System.Collections;
- namespace VendingMachine.Patches
- {
- [HarmonyPatch(typeof(GameScript))]
- [HarmonyPatch("RefreshRecipe")]
- [HarmonyGadget("VendingMachine")]
- public static class Patch_GameScript_RefreshRecipe
- {
- [HarmonyPrefix]
- public static bool Prefix(GameScript __instance, int ___craftType, int ___curRecipePage)
- {
- if (___craftType == 0)
- {
- __instance.txtRecipeName[0].text = string.Empty + __instance.GetRecipeName0(___curRecipePage);
- __instance.txtRecipeUnlocked[0].text = "Page " + (___curRecipePage + 1) + "/6";
- }
- else if (___craftType == 1)
- {
- __instance.txtRecipeName[0].text = string.Empty + __instance.GetRecipeName1(___curRecipePage);
- __instance.txtRecipeUnlocked[0].text = "Page " + (___curRecipePage + 1) + "/2";
- }
- else if (___craftType == 2)
- {
- __instance.txtRecipeName[0].text = string.Empty + __instance.GetRecipeName2(___curRecipePage);
- __instance.txtRecipeUnlocked[0].text = "Page " + (___curRecipePage + 1) + "/7";
- }
- __instance.txtRecipeUnlocked[0].gameObject.GetComponent<Animation>().Play();
- __instance.txtRecipeName[0].gameObject.GetComponent<Animation>().Play();
- __instance.txtRecipeName[1].text = __instance.txtRecipeName[0].text;
- __instance.txtRecipeUnlocked[1].text = __instance.txtRecipeUnlocked[0].text;
- if (___craftType != 2 || ___curRecipePage <= 5)
- {
- __instance.menuRecipe.GetComponent<Renderer>().material = (Material)Resources.Load(string.Concat(new object[] { "mat/r", ___curRecipePage, "t", ___craftType }));
- }
- else
- {
- __instance.txtRecipeName[0].text = "Rings";
- __instance.menuRecipe.GetComponent<Renderer>().material = new Material(Shader.Find("Unlit/Transparent"))
- {
- mainTexture = GadgetCoreAPI.LoadTexture2D("recipesEmpty.png")
- };
- }
- __instance.RefreshRecipeUnlock();
- return false;
- }
- }
- }
|