56 lines
1.9 KiB
C#
56 lines
1.9 KiB
C#
using HarmonyLib;
|
|
using PvZ_Fusion_Translator.AssetStore;
|
|
|
|
namespace PvZ_Fusion_Translator.Patches.Modes.Harvest;
|
|
|
|
[HarmonyPatch(typeof(TreasureWarehouseMenu))]
|
|
public static class TreasureWarehouseMenu_Patch
|
|
{
|
|
[HarmonyPatch(nameof(TreasureWarehouseMenu.InitCards)), HarmonyPostfix]
|
|
private static void InitCards(TreasureWarehouseMenu __instance)
|
|
{
|
|
var fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
|
|
|
foreach (var txt in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
|
{
|
|
txt.text = StringStore.TranslateText(txt.text);
|
|
txt.font = fontAsset;
|
|
}
|
|
}
|
|
|
|
[HarmonyPatch(nameof(TreasureWarehouseMenu.QuickSell)), HarmonyPostfix]
|
|
private static void QuickSell(TreasureWarehouseMenu __instance)
|
|
{
|
|
var fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
|
|
|
foreach (var txt in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
|
{
|
|
txt.text = StringStore.TranslateText(txt.text);
|
|
txt.font = fontAsset;
|
|
}
|
|
}
|
|
|
|
[HarmonyPatch(nameof(TreasureWarehouseMenu.FastSell)), HarmonyPostfix]
|
|
private static void FastSell(TreasureWarehouseMenu __instance)
|
|
{
|
|
var fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
|
|
|
foreach (var txt in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
|
{
|
|
txt.text = StringStore.TranslateText(txt.text);
|
|
txt.font = fontAsset;
|
|
}
|
|
}
|
|
|
|
[HarmonyPatch(nameof(TreasureWarehouseMenu.EnterStore)), HarmonyPostfix]
|
|
private static void EnterStore(TreasureWarehouseMenu __instance)
|
|
{
|
|
var fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
|
|
|
foreach (var txt in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
|
{
|
|
txt.text = StringStore.TranslateText(txt.text);
|
|
txt.font = fontAsset;
|
|
}
|
|
}
|
|
}
|