-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
861b5d7
commit 8f2a3eb
Showing
11 changed files
with
149 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#if USE_TRANSLATE | ||
using HarmonyLib; | ||
using Il2Cpp; | ||
using Il2CppTMPro; | ||
using UnityEngine; | ||
using static Il2Cpp.AlmanacMgr; | ||
|
||
namespace PVZ_Hyper_Fusion.Patches | ||
{ | ||
[HarmonyPatch(typeof(AlmanacMgrZombie))] | ||
public static class AlmanacMgrZombie_Patch | ||
{ | ||
[HarmonyPatch(nameof(AlmanacMgrZombie.InitNameAndInfoFromJson))] | ||
[HarmonyPrefix] | ||
private static bool InitNameAndInfoFromJson(AlmanacMgrZombie __instance) | ||
{ | ||
string basePatch = Path.Combine(Core.MOD_DIRECTORY, "PVZ_Hyper_Fusion"); | ||
string path = Path.Combine(basePatch, "ZombieStringsTranslate.json"); | ||
|
||
// Read the JSON content from the file or resources | ||
if (!File.Exists(path)) return true; | ||
|
||
string json; | ||
json = File.ReadAllText(path); | ||
|
||
TextMeshPro component = __instance.info.GetComponent<TextMeshPro>(); | ||
TextMeshPro component2 = __instance.zombieName.GetComponent<TextMeshPro>(); | ||
TextMeshPro component3 = __instance.zombieName.transform.GetChild(0).GetComponent<TextMeshPro>(); | ||
|
||
// Parse the JSON data | ||
AlmanacMgrZombie.ZombieAlmanacData zombieData = JsonUtility.FromJson<AlmanacMgrZombie.ZombieAlmanacData>(json); | ||
foreach (AlmanacMgrZombie.ZombieInfo zombieInfo in zombieData.zombies) | ||
{ | ||
if (zombieInfo.theZombieType == __instance.theZombieType) | ||
{ | ||
component.text = zombieInfo.info + "\n\n" + zombieInfo.introduce; | ||
component2.text = zombieInfo.name; | ||
component2.autoSizeTextContainer = true; | ||
component3.text = zombieInfo.name; | ||
component3.autoSizeTextContainer = true; | ||
break; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using HarmonyLib; | ||
using Il2Cpp; | ||
using Il2CppTMPro; | ||
using PVZ_Hyper_Fusion.AssetStore; | ||
|
||
namespace PVZ_Hyper_Fusion.Patches | ||
{ | ||
[HarmonyPatch(typeof(IZEMgr))] | ||
public static class IZEMgr_Patch | ||
{ | ||
[HarmonyPatch(nameof(IZEMgr.Start))] | ||
[HarmonyPostfix] | ||
public static void Start(IZEMgr __instance) | ||
{ | ||
TextMeshProUGUI[] array = new TextMeshProUGUI[] | ||
{ | ||
__instance.transform.GetChild(0).GetComponent<TextMeshProUGUI>(), | ||
__instance.transform.GetChild(0).GetChild(0).GetComponent<TextMeshProUGUI>(), | ||
}; | ||
for (int i = 0; i < array.Length; i++) | ||
{ | ||
array[i].text = StringStore.TranslateText(array[i].text).Replace("\n", " "); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.