TravelStore fix
This commit is contained in:
parent
4c15c96d0d
commit
311086a845
1 changed files with 19 additions and 28 deletions
|
|
@ -7,42 +7,33 @@ using UnityEngine;
|
||||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||||
{
|
{
|
||||||
[HarmonyPatch(typeof(TravelStore))]
|
[HarmonyPatch(typeof(TravelStore))]
|
||||||
internal class TravelStore_Patch
|
public static class TravelStore_Patch
|
||||||
{
|
{
|
||||||
[HarmonyPatch(nameof(TravelStore.Update))]
|
[HarmonyPatch(nameof(TravelStore.Update))]
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
private static void Update(TravelStore __instance)
|
private static void Update(TravelStore __instance)
|
||||||
{
|
{
|
||||||
foreach (TextMeshProUGUI text in __instance.introduces)
|
foreach (TextMeshProUGUI intr in __instance.introduces)
|
||||||
{
|
StringStore.TranslateTextUI(intr);
|
||||||
text.text = StringStore.TranslateText(text.text);
|
foreach (var textMesh in __instance.points)
|
||||||
|
StringStore.TranslateTextUI(textMesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
Transform moneyTransform = __instance.transform.Find("Money");
|
[HarmonyPatch(nameof(TravelStore.RefreshBuff))]
|
||||||
if (moneyTransform != null)
|
|
||||||
{
|
|
||||||
StringStore.TranslateTextTransform(moneyTransform);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (TextMeshProUGUI text in __instance.points)
|
|
||||||
{
|
|
||||||
text.text = StringStore.TranslateText(text.text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[HarmonyPatch(nameof(TravelStore.SetText), new Type[] { typeof(string)})]
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
private static void ShowText(TravelStore __instance)
|
private static void RefreshBuff(TravelStore __instance)
|
||||||
{
|
{
|
||||||
foreach (TextMeshProUGUI text in __instance.introduces)
|
foreach (TravelBuff buff in __instance.travelBuffs)
|
||||||
{
|
{
|
||||||
text.text = StringStore.TranslateText(text.text);
|
TextMeshProUGUI cost = buff.transform.GetChild(1).GetComponent<TextMeshProUGUI>();
|
||||||
}
|
if (!cost.text.Contains('0'))
|
||||||
|
StringStore.TranslateTextUI(cost);
|
||||||
foreach (TextMeshProUGUI text in __instance.points)
|
cost.font = Resources.Load<TMP_FontAsset>("fonts/Dynamic");
|
||||||
{
|
|
||||||
text.text = StringStore.TranslateText(text.text);
|
|
||||||
}
|
}
|
||||||
|
foreach (TextMeshProUGUI intr in __instance.introduces)
|
||||||
|
StringStore.TranslateTextUI(intr);
|
||||||
|
foreach (var textMesh in __instance.points)
|
||||||
|
StringStore.TranslateTextUI(textMesh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue