zombie spawn info + shadow popup fix

This commit is contained in:
SillyStar-Github 2026-01-24 19:07:34 -05:00
parent b5a1c031af
commit 20d088239a
2 changed files with 23 additions and 4 deletions

View file

@ -21,7 +21,7 @@ namespace PvZ_Fusion_Translator.Patches.BaseTextObjects
foreach (TextMeshProUGUI txt in __instance.GetComponentsInChildren<TextMeshProUGUI>()) foreach (TextMeshProUGUI txt in __instance.GetComponentsInChildren<TextMeshProUGUI>())
{ {
string travelMatch = TravelMgr_Patch.MatchTravelBuff(txt.text); string travelMatch = TravelMgr_Patch.MatchTravelBuff(txt.text);
string originalText = ""; string originalText = txt.text;
if (txt.gameObject.name.Contains("shadow")) if (txt.gameObject.name.Contains("shadow"))
{ {
@ -31,6 +31,15 @@ namespace PvZ_Fusion_Translator.Patches.BaseTextObjects
if (travelMatch != "") if (travelMatch != "")
{ {
txt.text = travelMatch; txt.text = travelMatch;
if (txt.gameObject.name.Contains("main"))
{
originalText = txt.text;
Transform shadowText = txt.transform.parent.Find("Text_shadow");
if (shadowText != null)
{
shadowText.GetComponent<TextMeshProUGUI>().text = Utils.RemoveColorTags(originalText);
}
}
} }
else if(Regex.Match(txt.text, @"(<color[^>]*>.*?</color>)", RegexOptions.Singleline).Success) else if(Regex.Match(txt.text, @"(<color[^>]*>.*?</color>)", RegexOptions.Singleline).Success)
{ {

View file

@ -35,9 +35,10 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
TMP_FontAsset fontAsset = (hasAlmanacFont) ? FontStore.LoadTMPFontAlmanac(Utils.Language.ToString()) : FontStore.LoadTMPFont(Utils.Language.ToString()); TMP_FontAsset fontAsset = (hasAlmanacFont) ? FontStore.LoadTMPFontAlmanac(Utils.Language.ToString()) : FontStore.LoadTMPFont(Utils.Language.ToString());
ZombieAlmanacData zombieData = JsonUtility.FromJson<ZombieAlmanacData>(json); ZombieAlmanacData zombieAlmanacData = JsonUtility.FromJson<ZombieAlmanacData>(json);
var zombieDataDic = ZombieDataManager.zombieDataDic;
foreach (ZombieInfo zombieInfo in zombieData.zombies) foreach (ZombieInfo zombieInfo in zombieAlmanacData.zombies)
{ {
if (zombieInfo.theZombieType == __instance.currentZombieType) if (zombieInfo.theZombieType == __instance.currentZombieType)
{ {
@ -49,7 +50,16 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
text.fontSizeMax = 21; text.fontSizeMax = 21;
} }
__instance.showedZombieIntroduce.text = Utils.RemoveSizeTags(zombieInfo.info) + "\n\n" + Utils.RemoveSizeTags(zombieInfo.introduce) + "\n\n"; ZombieDataManager.ZombieData zombieData = zombieDataDic[__instance.currentZombieType];
string spawnInfo = "";
string spawnInfoFormat = StringStore.translationStringRegex["出怪等级: (\\d+)\n出怪权重: (\\d+)"];
if(spawnInfoFormat != null)
{
spawnInfo = string.Format(spawnInfoFormat, [zombieData.summonLevel, zombieData.summonWeight]) + "\n\n";
}
__instance.showedZombieIntroduce.text = Utils.RemoveSizeTags(zombieInfo.info) + "\n\n" + spawnInfo + Utils.RemoveSizeTags(zombieInfo.introduce) + "\n\n";
__instance.showedZombieIntroduce.font = fontAsset; __instance.showedZombieIntroduce.font = fontAsset;
__instance.showedZombieIntroduce.fontSizeMax = 21; __instance.showedZombieIntroduce.fontSizeMax = 21;
__instance.showedZombieIntroduce.margin = new Vector4(3, 2, 12, 0); __instance.showedZombieIntroduce.margin = new Vector4(3, 2, 12, 0);