travel buff fix #32409284031
This commit is contained in:
parent
40215c68df
commit
51f5c991e5
3 changed files with 21 additions and 9 deletions
|
|
@ -4,6 +4,7 @@ using Il2CppTMPro;
|
|||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using static PvZ_Fusion_Translator.Patches.Managers.TravelMgr_Patch;
|
||||
using UnityEngine;
|
||||
using MelonLoader;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
|
|
@ -16,7 +17,9 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
|||
{
|
||||
foreach (TravelBuffOptionButton button in __instance.options)
|
||||
{
|
||||
button.introduce.text = translatedTravelBuffs[buffLinks[button.buffType]][button.buffIndex];
|
||||
List<string> buffSet = translatedTravelBuffs[buffLinks[button.buffType]];
|
||||
string buffText = (button.buffIndex < buffSet.Count && button.show != null) ? buffSet[button.buffIndex] : StringStore.TranslateText(button.introduce.text);
|
||||
button.introduce.text = buffText;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using MelonLoader;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using static PvZ_Fusion_Translator.Patches.Managers.TravelMgr_Patch;
|
||||
|
||||
|
|
@ -14,8 +15,8 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
|||
private static void SetBuff(TravelBuffOptionButton __instance)
|
||||
{
|
||||
List<string> buffSet = translatedTravelBuffs[buffLinks[__instance.buffType]];
|
||||
string buffText = (__instance.buffIndex < buffSet.Count) ? buffSet[__instance.buffIndex] : StringStore.TranslateText(__instance.introduce.text);
|
||||
|
||||
string buffText = (__instance.buffIndex < buffSet.Count && __instance.show != null) ? buffSet[__instance.buffIndex] : StringStore.TranslateText(__instance.introduce.text);
|
||||
__instance.introduce.text = buffText;
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(TravelBuffOptionButton.Awake))]
|
||||
|
|
@ -23,8 +24,8 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
|||
private static void Awake(TravelBuffOptionButton __instance)
|
||||
{
|
||||
List<string> buffSet = translatedTravelBuffs[buffLinks[__instance.buffType]];
|
||||
string buffText = (__instance.buffIndex < buffSet.Count) ? buffSet[__instance.buffIndex] : StringStore.TranslateText(__instance.introduce.text);
|
||||
|
||||
string buffText = (__instance.buffIndex < buffSet.Count && __instance.show != null) ? buffSet[__instance.buffIndex] : StringStore.TranslateText(__instance.introduce.text);
|
||||
__instance.introduce.text = buffText;
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(TravelBuffOptionButton.OnAnimOver))]
|
||||
|
|
@ -32,8 +33,8 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
|||
private static void OnAnimOver(TravelBuffOptionButton __instance)
|
||||
{
|
||||
List<string> buffSet = translatedTravelBuffs[buffLinks[__instance.buffType]];
|
||||
string buffText = (__instance.buffIndex < buffSet.Count) ? buffSet[__instance.buffIndex] : StringStore.TranslateText(__instance.introduce.text);
|
||||
|
||||
string buffText = (__instance.buffIndex < buffSet.Count && __instance.show != null) ? buffSet[__instance.buffIndex] : StringStore.TranslateText(__instance.introduce.text);
|
||||
__instance.introduce.text = buffText;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
|||
if(__instance.currentSelect != null)
|
||||
{
|
||||
var buffList = translatedTravelBuffs[buffLinks[(BuffType)__instance.currentSelect.theBuffType]];
|
||||
if(__instance.currentSelect.theBuffNumber < buffList.Count)
|
||||
if(__instance.currentSelect.theBuffNumber < buffList.Count && __instance.currentSelect.theBuffNumber > -1)
|
||||
{
|
||||
text.text = buffList[__instance.currentSelect.theBuffNumber];
|
||||
}
|
||||
|
|
@ -50,7 +50,15 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
|||
{
|
||||
if (__instance.currentSelect != null)
|
||||
{
|
||||
text.text = translatedTravelBuffs[buffLinks[(BuffType)__instance.currentSelect.theBuffType]][__instance.currentSelect.theBuffNumber];
|
||||
var buffList = translatedTravelBuffs[buffLinks[(BuffType)__instance.currentSelect.theBuffType]];
|
||||
if (__instance.currentSelect.theBuffNumber < buffList.Count && __instance.currentSelect.theBuffNumber > -1)
|
||||
{
|
||||
text.text = buffList[__instance.currentSelect.theBuffNumber];
|
||||
}
|
||||
else
|
||||
{
|
||||
text.text = StringStore.TranslateText(text.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var textMesh in __instance.points)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue