| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- using HarmonyLib;
- using GadgetCore.API;
- using UnityEngine;
- using System.Collections;
- namespace RecipeMenuCore.Patches
- {
- [HarmonyPatch(typeof(GameScript))]
- [HarmonyPatch("RefreshRecipe")]
- [HarmonyGadget("RecipeMenuCore")]
- 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 + Core.pageGearForgeInfoList.Count);
- }
- else if (___craftType == 1)
- {
- __instance.txtRecipeName[0].text = string.Empty + __instance.GetRecipeName1(___curRecipePage);
- __instance.txtRecipeUnlocked[0].text = "Page " + (___curRecipePage + 1) + "/" + (2 + Core.pageAlchemyStationInfoList.Count);
- }
- else if (___craftType == 2)
- {
- __instance.txtRecipeName[0].text = string.Empty + __instance.GetRecipeName2(___curRecipePage);
- __instance.txtRecipeUnlocked[0].text = "Page " + (___curRecipePage + 1) + "/" + (6 + Core.pageUltimateForgeInfoList.Count);
- }
- __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 != 0 || ___curRecipePage <= 5)
- && (___craftType != 1 || ___curRecipePage <= 1)
- && (___craftType != 2 || ___curRecipePage <= 5))
- {
- __instance.menuRecipe.GetComponent<Renderer>().material = (Material)Resources.Load(string.Concat(new object[] { "mat/r", ___curRecipePage, "t", ___craftType }));
- }
- else
- {
- if (___craftType == 0)
- {
- __instance.txtRecipeName[0].text = Core.pageGearForgeInfoList[___curRecipePage - 6].Title;
- __instance.txtRecipeName[1].text = __instance.txtRecipeName[0].text;
- __instance.menuRecipe.GetComponent<Renderer>().material = Core.pageGearForgeInfoList[___curRecipePage - 6].Mat;
- }
- else if (___craftType == 1)
- {
- __instance.txtRecipeName[0].text = Core.pageAlchemyStationInfoList[___curRecipePage - 2].Title;
- __instance.txtRecipeName[1].text = __instance.txtRecipeName[0].text;
- __instance.menuRecipe.GetComponent<Renderer>().material = Core.pageAlchemyStationInfoList[___curRecipePage - 2].Mat;
- }
- else if (___craftType == 2)
- {
- __instance.txtRecipeName[0].text = Core.pageUltimateForgeInfoList[___curRecipePage - 6].Title;
- __instance.txtRecipeName[1].text = __instance.txtRecipeName[0].text;
- __instance.menuRecipe.GetComponent<Renderer>().material = Core.pageUltimateForgeInfoList[___curRecipePage - 6].Mat;
- }
- }
- __instance.RefreshRecipeUnlock();
- return false;
- }
- }
- }
|