3.0 part 1

This commit is contained in:
SillyStar-Github 2025-09-27 20:11:02 -04:00
parent dd0e392041
commit f2f5a87813
8 changed files with 108 additions and 15 deletions

View file

@ -18,7 +18,7 @@ namespace PvZ_Fusion_Translator.Patches.BaseTextObjects
__instance = StringStore.TranslateText(__instance); __instance = StringStore.TranslateText(__instance);
__instance.autoSizeTextContainer = false; __instance.autoSizeTextContainer = false;
return; return;
} else if (!(__instance.transform.name.Contains("AlmanacZombie") || __instance.transform.name.Contains("AlmanacPlant"))) } else if (!(__instance.transform.name.Contains("AlmanacZombie") || __instance.transform.name.Contains("AlmanacPlant") || __instance.transform.name.Contains("Name") || __instance.transform.name.Contains("Tips") || __instance.transform.parent.name.Contains("Signboard") || __instance.transform.parent.name.Contains("text")))
{ {
__instance = StringStore.TranslateText(__instance); __instance = StringStore.TranslateText(__instance);
__instance.autoSizeTextContainer = true; __instance.autoSizeTextContainer = true;

View file

@ -18,8 +18,11 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects.ButtonObjects
if (__instance.name == "Goback") if (__instance.name == "Goback")
{ {
Transform backgroundTransform = parentTransform.Find("Background"); Transform backgroundTransform = parentTransform.Find("Background");
if(backgroundTransform != null)
{
backgroundTransform.Find("Name").GetComponent<TMP_Text>().autoSizeTextContainer = true; backgroundTransform.Find("Name").GetComponent<TMP_Text>().autoSizeTextContainer = true;
backgroundTransform.Find("Shadow").GetComponent<TMP_Text>().autoSizeTextContainer = true; backgroundTransform.Find("Shadow").GetComponent<TMP_Text>().autoSizeTextContainer = true;
}
} }
Transform levelTransform = parentTransform.Find("Levels"); Transform levelTransform = parentTransform.Find("Levels");

View file

@ -224,7 +224,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects.ButtonObjects
} }
child.gameObject.SetActive(true); child.gameObject.SetActive(true);
Task.Delay(1000).ContinueWith(_ => System.Threading.Tasks.Task.Delay(1000).ContinueWith(_ =>
{ {
if (button != null && child != null && child.gameObject.activeSelf) if (button != null && child != null && child.gameObject.activeSelf)
{ {

View file

@ -0,0 +1,40 @@
using HarmonyLib;
using Il2Cpp;
using Il2CppTMPro;
using PvZ_Fusion_Translator.AssetStore;
using UnityEngine;
namespace PvZ_Fusion_Translator.Patches.GameObjects
{
[HarmonyPatch(typeof(GardenBagMenu))]
public static class GardenBagMenu_Patch
{
[HarmonyPatch(nameof(GardenBagMenu.SetTreasureCards))]
[HarmonyPostfix]
private static void SetTreasureCards(GardenBagMenu __instance)
{
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
foreach (TextMeshProUGUI txt in __instance.GetComponentsInChildren<TextMeshProUGUI>())
{
FileLoader.DumpUntranslatedStrings(txt.text);
txt.text = StringStore.TranslateText(txt.text);
txt.font = fontAsset;
}
}
[HarmonyPatch(nameof(GardenBagMenu.SetTreasureCard))]
[HarmonyPostfix]
private static void SetTreasureCard(GardenBagMenu __instance)
{
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
foreach (TextMeshProUGUI txt in __instance.GetComponentsInChildren<TextMeshProUGUI>())
{
FileLoader.DumpUntranslatedStrings(txt.text);
txt.text = StringStore.TranslateText(txt.text);
txt.font = fontAsset;
}
}
}
}

View file

@ -0,0 +1,24 @@
using HarmonyLib;
using Il2Cpp;
using PvZ_Fusion_Translator.AssetStore;
namespace PvZ_Fusion_Translator.Patches.GameObjects
{
[HarmonyPatch(typeof(GardenCard))]
public static class GardenCard_Patch
{
[HarmonyPatch(nameof(GardenCard.Start))]
[HarmonyPostfix]
private static void Start(GardenCard __instance)
{
__instance.text.text = StringStore.TranslateText(__instance.text.text).Replace("26", "16");
}
[HarmonyPatch(nameof(GardenCard.ChangeCardSprite))]
[HarmonyPostfix]
private static void ChangeCardSprite(GardenCard __instance)
{
__instance.text.text = StringStore.TranslateText(__instance.text.text).Replace("26", "16");
}
}
}

View file

@ -1,5 +1,6 @@
using HarmonyLib; using HarmonyLib;
using Il2Cpp; using Il2Cpp;
using Il2CppTMPro;
using PvZ_Fusion_Translator.AssetStore; using PvZ_Fusion_Translator.AssetStore;
namespace PvZ_Fusion_Translator.Patches.Managers namespace PvZ_Fusion_Translator.Patches.Managers

View file

@ -0,0 +1,22 @@
using HarmonyLib;
using Il2Cpp;
using Il2CppTMPro;
using PvZ_Fusion_Translator.AssetStore;
namespace PvZ_Fusion_Translator.Patches.Managers
{
[HarmonyPatch(typeof(Garden))]
public static class Garden_Patch
{
[HarmonyPatch(nameof(Garden.Awake))]
[HarmonyPostfix]
private static void Awake(Garden __instance)
{
foreach (TextMeshPro text in __instance.GetComponentsInChildren<TextMeshPro>())
{
text.text = StringStore.TranslateText(text.text);
text.font = FontStore.LoadTMPFont(Utils.Language.ToString());
}
}
}
}

View file

@ -13,7 +13,7 @@
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Configurations>Debug;DebugEnglish;ReleaseMulti;ReleaseEnglish;DebugTesting;ReleaseOther;DebugObfuscate;ReleaseObfuscate</Configurations> <Configurations>Debug;DebugEnglish;ReleaseMulti;ReleaseEnglish;DebugTesting;ReleaseOther;DebugObfuscate;ReleaseObfuscate</Configurations>
<GamePath>C:\Users\rainb\Desktop\PC_PVZ-Fusion_2.8.2</GamePath> <GamePath>C:\Users\rainb\Desktop\PC_PVZ-Fusion_3.0</GamePath>
<Platforms>AnyCPU;ARM64;x64</Platforms> <Platforms>AnyCPU;ARM64;x64</Platforms>
</PropertyGroup> </PropertyGroup>
@ -401,10 +401,12 @@
<Compile Include="ModFeatures.cs" /> <Compile Include="ModFeatures.cs" />
<Compile Include="AssetStore\AudioStore.cs" /> <Compile Include="AssetStore\AudioStore.cs" />
<Compile Include="Patches\GameObjects\Board_Patch.cs" /> <Compile Include="Patches\GameObjects\Board_Patch.cs" />
<Compile Include="Patches\GameObjects\GardenCard_Patch.cs" />
<Compile Include="Patches\GameObjects\MinorObjects\UIProgress2_Patch.cs" /> <Compile Include="Patches\GameObjects\MinorObjects\UIProgress2_Patch.cs" />
<Compile Include="Patches\GameObjects\MinorObjects\Jigsaw_Patch.cs" /> <Compile Include="Patches\GameObjects\MinorObjects\Jigsaw_Patch.cs" />
<Compile Include="Patches\GameObjects\PlayerShootingWindow_Patch.cs" /> <Compile Include="Patches\GameObjects\PlayerShootingWindow_Patch.cs" />
<Compile Include="Patches\GameObjects\PlayerShootingMenu_Patch.cs" /> <Compile Include="Patches\GameObjects\PlayerShootingMenu_Patch.cs" />
<Compile Include="Patches\GameObjects\GardenBagMenu_Patch.cs" />
<Compile Include="Patches\GameObjects\ShootingSelectWindow_Patch.cs" /> <Compile Include="Patches\GameObjects\ShootingSelectWindow_Patch.cs" />
<Compile Include="Patches\GameObjects\FruitNinjaSelectWindow_Patch.cs" /> <Compile Include="Patches\GameObjects\FruitNinjaSelectWindow_Patch.cs" />
<Compile Include="Patches\GameObjects\RogueCardWindow_Patch.cs" /> <Compile Include="Patches\GameObjects\RogueCardWindow_Patch.cs" />
@ -443,6 +445,7 @@
<Compile Include="Patches\GameObjects\TravelLookMenu_Patch.cs" /> <Compile Include="Patches\GameObjects\TravelLookMenu_Patch.cs" />
<Compile Include="Patches\Managers\ChessManager_Patch.cs" /> <Compile Include="Patches\Managers\ChessManager_Patch.cs" />
<Compile Include="Patches\Managers\CustomLevelShower_Patch.cs" /> <Compile Include="Patches\Managers\CustomLevelShower_Patch.cs" />
<Compile Include="Patches\Managers\Garden_Patch.cs" />
<Compile Include="Patches\Managers\DrawCardManager_Patch.cs" /> <Compile Include="Patches\Managers\DrawCardManager_Patch.cs" />
<Compile Include="Patches\Managers\TowerManager_Patch.cs" /> <Compile Include="Patches\Managers\TowerManager_Patch.cs" />
<Compile Include="Patches\Managers\SaveMenu_Patch.cs" /> <Compile Include="Patches\Managers\SaveMenu_Patch.cs" />