3.4.2 changes, the calm before the storm

This commit is contained in:
SillyStar-Github 2026-02-21 01:32:12 -05:00
parent 2e7ed77f1b
commit cf4c022522
9 changed files with 359 additions and 259 deletions

View file

@ -1,234 +1,234 @@
using System.Runtime.CompilerServices; //using System.Runtime.CompilerServices;
using Il2Cpp; //using Il2Cpp;
using Il2CppTMPro; //using Il2CppTMPro;
using MelonLoader; //using MelonLoader;
using UnityEngine; //using UnityEngine;
using UnityEngine.TextCore.Text; //using UnityEngine.TextCore.Text;
using static MelonLoader.MelonLogger; //using static MelonLoader.MelonLogger;
namespace PvZ_Fusion_Translator.AssetStore //namespace PvZ_Fusion_Translator.AssetStore
{ //{
public static class WarningStore // public static class WarningStore
{ // {
#if MULTI_LANGUAGE // #if MULTI_LANGUAGE
private static Dictionary<string, (string, string)> warningMessages = new() // private static Dictionary<string, (string, string)> warningMessages = new()
{ // {
{ "English", ("<size=10>The only valid source of this translation is from this community:\n" + // { "English", ("<size=10>The only valid source of this translation is from this community:\n" +
"<color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. If you got this <i>anywhere</i> else like \n" + // "<color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. If you got this <i>anywhere</i> else like \n" +
"<color=#8B0000>Plants Hybrid</color> and <color=#8B0000>superhybrid.online</color>, they stole it.\n" + // "<color=#8B0000>Plants Hybrid</color> and <color=#8B0000>superhybrid.online</color>, they stole it.\n" +
"Stray away from other sources as they may contain viruses.\n" + // "Stray away from other sources as they may contain viruses.\n" +
"Please visit our community for future updates.</size>", // "Please visit our community for future updates.</size>",
"Okay! Got it.") }, // "Okay! Got it.") },
{ "French", ("<size=9.5>La seule source valide pour cette traduction provient de cette\n" + // { "French", ("<size=9.5>La seule source valide pour cette traduction provient de cette\n" +
"communauté :<color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Si vous l'avez obtenue \n" + // "communauté :<color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Si vous l'avez obtenue \n" +
"<i>ailleurs</i>, comme <color=#8B0000>Plants Hybrid</color> ou <color=#8B0000>superhybrid.online</color>, ils l'ont volée.\n" + // "<i>ailleurs</i>, comme <color=#8B0000>Plants Hybrid</color> ou <color=#8B0000>superhybrid.online</color>, ils l'ont volée.\n" +
"Évitez les autres sources, car elles peuvent contenir des virus.\n" + // "Évitez les autres sources, car elles peuvent contenir des virus.\n" +
"Veuillez visiter notre communauté pour les mises à jour futures.", // "Veuillez visiter notre communauté pour les mises à jour futures.",
"D'accord !") }, // "D'accord !") },
{ "Italian", ("<size=10>L'unica fonte valida di questa traduzione è questa community:\n" + // { "Italian", ("<size=10>L'unica fonte valida di questa traduzione è questa community:\n" +
"<color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Se l'hai ottenuta <i>altrove</i>, come \n" + // "<color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Se l'hai ottenuta <i>altrove</i>, come \n" +
"<color=#8B0000>Plants Hybrid</color> e <color=#8B0000>superhybrid.online</color>, l'hanno rubata.\n" + // "<color=#8B0000>Plants Hybrid</color> e <color=#8B0000>superhybrid.online</color>, l'hanno rubata.\n" +
"Evita altre fonti, potrebbero contenere virus.\n" + // "Evita altre fonti, potrebbero contenere virus.\n" +
"Visita la nostra community per aggiornamenti futuri.</size>", // "Visita la nostra community per aggiornamenti futuri.</size>",
"Va bene! Ho capito.") }, // "Va bene! Ho capito.") },
{ "German", ("<size=10>Die einzige gültige Quelle für diese Übersetzung stammt aus\n" + // { "German", ("<size=10>Die einzige gültige Quelle für diese Übersetzung stammt aus\n" +
"dieser Community: <color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Wenn Sie diese \n" + // "dieser Community: <color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Wenn Sie diese \n" +
"<i>irgendwo</i> anders gefunden haben, z. B. bei <color=#8B0000>Plants Hybrid</color> oder \n" + // "<i>irgendwo</i> anders gefunden haben, z. B. bei <color=#8B0000>Plants Hybrid</color> oder \n" +
"<color=#8B0000>superhybrid.online</color>, dann haben sie sie gestohlen.\n" + // "<color=#8B0000>superhybrid.online</color>, dann haben sie sie gestohlen.\n" +
"Meiden Sie andere Quellen, da diese Viren enthalten könnten.\n" + // "Meiden Sie andere Quellen, da diese Viren enthalten könnten.\n" +
"Bitte besuchen Sie unsere Community für zukünftige Updates.", // "Bitte besuchen Sie unsere Community für zukünftige Updates.",
"Okay, verstanden!") }, // "Okay, verstanden!") },
{ "Spanish", ("<size=10>La única fuente válida de esta traducción proviene de esta\n" + // { "Spanish", ("<size=10>La única fuente válida de esta traducción proviene de esta\n" +
"comunidad: <color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Si la obtuvo <i>en cualquier</i>\n" + // "comunidad: <color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Si la obtuvo <i>en cualquier</i>\n" +
"otro lugar como <color=#8B0000>Plants Hybrid</color> o <color=#8B0000>superhybrid.online</color>, la robaron.\n" + // "otro lugar como <color=#8B0000>Plants Hybrid</color> o <color=#8B0000>superhybrid.online</color>, la robaron.\n" +
"Manténgase alejado de otras fuentes, ya que podrían contener virus.\n" + // "Manténgase alejado de otras fuentes, ya que podrían contener virus.\n" +
"Por favor, visite nuestra comunidad para futuras actualizaciones.", // "Por favor, visite nuestra comunidad para futuras actualizaciones.",
"¡Entendido!") }, // "¡Entendido!") },
{ "Portuguese", ("<size=10>O lugar original e seguro dessa tradução vem daqui:\n" + // { "Portuguese", ("<size=10>O lugar original e seguro dessa tradução vem daqui:\n" +
"<color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Se você baixou ela de <i>qualquer \n" + // "<color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Se você baixou ela de <i>qualquer \n" +
"lugar</i> como <color=#8B0000>Plants Hybrid</color> ou <color=#8B0000>superhybrid.online</color>, eles\n" + // "lugar</i> como <color=#8B0000>Plants Hybrid</color> ou <color=#8B0000>superhybrid.online</color>, eles\n" +
"roubaram. Evite baixar deles, pode conter vírus.\n" + // "roubaram. Evite baixar deles, pode conter vírus.\n" +
"Por favor, visite nossa comunidade para atualizações futuras.</size>", // "Por favor, visite nossa comunidade para atualizações futuras.</size>",
"Okay, entendido.") }, // "Okay, entendido.") },
{ "Filipino", ("<size=9>Ang tanging opisyal na source ng pagsasaling ito ay mula\n" + // { "Filipino", ("<size=9>Ang tanging opisyal na source ng pagsasaling ito ay mula\n" +
"lamang dito: <color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Kung nakuha nmo ito <i>kahit \n" + // "lamang dito: <color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Kung nakuha nmo ito <i>kahit \n" +
"saan pa</i> tulad ng <color=#8B0000>Plants Hybrid</color> at <color=#8B0000>superhybrid.online</color>, ito ay ninakaw. \n" + // "saan pa</i> tulad ng <color=#8B0000>Plants Hybrid</color> at <color=#8B0000>superhybrid.online</color>, ito ay ninakaw. \n" +
"Lumayo sa ibang source dahil posibleng may kasamang virus.\n" + // "Lumayo sa ibang source dahil posibleng may kasamang virus.\n" +
"Paki-bisita ang aming komunidad para sa mga darating na update.</size>" , // "Paki-bisita ang aming komunidad para sa mga darating na update.</size>" ,
"Naiintindihan!") }, // "Naiintindihan!") },
{ "Vietnamese", ("<size=8>Nguồn duy nhất hợp lệ của bản dịch này là từ cộng\n" + // { "Vietnamese", ("<size=8>Nguồn duy nhất hợp lệ của bản dịch này là từ cộng\n" +
"đồng này: <color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Nếu bạn nhận \n" + // "đồng này: <color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Nếu bạn nhận \n" +
"được nó <i>ở bất cứ nơi nào</i> khác như <color=#8B0000>Plants Hybrid</color> \n" + // "được nó <i>ở bất cứ nơi nào</i> khác như <color=#8B0000>Plants Hybrid</color> \n" +
"hoặc <color=#8B0000>superhybrid.online</color>, họ đã ăn cắp nó.\n" + // "hoặc <color=#8B0000>superhybrid.online</color>, họ đã ăn cắp nó.\n" +
"Tránh xa các nguồn khác vì chúng có thể chứa \n" + // "Tránh xa các nguồn khác vì chúng có thể chứa \n" +
"virus. Hãy ghé thăm cộng đồng của chúng tôi để \n" + // "virus. Hãy ghé thăm cộng đồng của chúng tôi để \n" +
"cập nhật trong tương lai.</size>", // "cập nhật trong tương lai.</size>",
"Đồng ý!") }, // "Đồng ý!") },
{ "Indonesian", ("<size=10>Satu-satunya sumber resmi dari terjemahan ini adalah \n" + // { "Indonesian", ("<size=10>Satu-satunya sumber resmi dari terjemahan ini adalah \n" +
"komunitas kami: <color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Jika Anda \n" + // "komunitas kami: <color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Jika Anda \n" +
"mendapatkannya dari <i>sumber lain</i> seperti <color=#8B0000>Plants Hybrid</color> \n" + // "mendapatkannya dari <i>sumber lain</i> seperti <color=#8B0000>Plants Hybrid</color> \n" +
"dan <color=#8B0000>superhybrid.online</color>, mereka mencurinya. \n" + // "dan <color=#8B0000>superhybrid.online</color>, mereka mencurinya. \n" +
"Jauhi sumber lain karena mungkin ada virus.\n" + // "Jauhi sumber lain karena mungkin ada virus.\n" +
"Silakan kunjungi komunitas kami untuk pembaruan berikutnya.</size>", // "Silakan kunjungi komunitas kami untuk pembaruan berikutnya.</size>",
"Oke! Mengerti.") }, // "Oke! Mengerti.") },
{ "Russian", ("<size=9>Единственный проверенный источник этого перевода —\n" + // { "Russian", ("<size=9>Единственный проверенный источник этого перевода —\n" +
"сообщество <color=#E6E6FA>discord.gg/DPAC5ZVJ8T</color>.\n" + // "сообщество <color=#E6E6FA>discord.gg/DPAC5ZVJ8T</color>.\n" +
"Или же его замена <color=#E6E6FA>https://t.me/nekoshkindom</color>\n" + // "Или же его замена <color=#E6E6FA>https://t.me/nekoshkindom</color>\n" +
"Если вы скачали этот мод <i>где-либо ещё</i>, возможно он содержит вирусы.\n" + // "Если вы скачали этот мод <i>где-либо ещё</i>, возможно он содержит вирусы.\n" +
"Программист перевода: LancerX0.\n" + // "Программист перевода: LancerX0.\n" +
"Переводчик: Nekosha.", "Хорошо!") }, // "Переводчик: Nekosha.", "Хорошо!") },
{ "Japanese", ("<size=6>この翻訳の唯一の有効なソースは、このコミュニティからです:\n" + // { "Japanese", ("<size=6>この翻訳の唯一の有効なソースは、このコミュニティからです:\n" +
"<color=#64DD17>discord.gg/DPAC5ZVJ8T</color>.<color=#8B0000>Plants Hybrid</color>や<color=#8B0000>superhybrid.online</color>、\n" + // "<color=#64DD17>discord.gg/DPAC5ZVJ8T</color>.<color=#8B0000>Plants Hybrid</color>や<color=#8B0000>superhybrid.online</color>、\n" +
"<color=#8B0000>YoutubeのBlue Fly</color>が作っているもの、他のどこかでこれを入手した場合、\n" + // "<color=#8B0000>YoutubeのBlue Fly</color>が作っているもの、他のどこかでこれを入手した場合、\n" +
"彼らはそれを盗んだことになります。ウイルスが含まれている可能性があるので、\n" + // "彼らはそれを盗んだことになります。ウイルスが含まれている可能性があるので、\n" +
"他のソースからは離れてください。今後のアップデートについては、\n私たちのコミュニティをご覧ください。</size>", // "他のソースからは離れてください。今後のアップデートについては、\n私たちのコミュニティをご覧ください。</size>",
"了解しました!") }, // "了解しました!") },
{ "Korean", ("<size=8>이 번역은 Bloom(<color=#64DD17>discord.gg/DPAC5ZVJ8T</color>)에서만\n" + // { "Korean", ("<size=8>이 번역은 Bloom(<color=#64DD17>discord.gg/DPAC5ZVJ8T</color>)에서만\n" +
"제공됩니다. Bloom 디스코드 이외의 다른</i>서드 파티 사이트, \n" + // "제공됩니다. Bloom 디스코드 이외의 다른</i>서드 파티 사이트, \n" +
"예를 들어 <color=#8B0000>Plants Hybrid</color> 및 <color=#8B0000>superhybrid.online</color>, 또는\n" + // "예를 들어 <color=#8B0000>Plants Hybrid</color> 및 <color=#8B0000>superhybrid.online</color>, 또는\n" +
"<color=#8B0000>유튜브 Blue Fly</color>등에서 제공하는 파일은 무단으로 재배포된 것이며,\n" + // "<color=#8B0000>유튜브 Blue Fly</color>등에서 제공하는 파일은 무단으로 재배포된 것이며,\n" +
"이런 사이트들에는 바이러스가 포함되어 있을 가능성이 높습니다. \n향후 업데이트를 위해 저희 디스코드를 방문해 주세요.", // "이런 사이트들에는 바이러스가 포함되어 있을 가능성이 높습니다. \n향후 업데이트를 위해 저희 디스코드를 방문해 주세요.",
"확인") }, // "확인") },
{ "Javanese" , ("<size=10>Sumber mung sing sah kanggo terjemahan iki saka komunitas iki:\n" + // { "Javanese" , ("<size=10>Sumber mung sing sah kanggo terjemahan iki saka komunitas iki:\n" +
"<color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Yen sampeyan nemokake iki <i>ing papan\n" + // "<color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Yen sampeyan nemokake iki <i>ing papan\n" +
"liya</i> kaya <color=#8B0000>Plants Hybrid</color> lan <color=#8B0000>superhybrid.online</color>, iku dicolong.\n" + // "liya</i> kaya <color=#8B0000>Plants Hybrid</color> lan <color=#8B0000>superhybrid.online</color>, iku dicolong.\n" +
"Aja nyedhaki sumber liya amarga bisa ngandhut virus. Mangga\n" + // "Aja nyedhaki sumber liya amarga bisa ngandhut virus. Mangga\n" +
"ngunjungi komunitas kita kanggo nganyari ing mangsa ngarep.</size>", // "ngunjungi komunitas kita kanggo nganyari ing mangsa ngarep.</size>",
"Oke! Ngertos.") }, // "Oke! Ngertos.") },
{ "Polish" , ("<size=8>Jedynym wiarygodnym źródłem tego tłumaczenia jest ta społeczność:\n" + // { "Polish" , ("<size=8>Jedynym wiarygodnym źródłem tego tłumaczenia jest ta społeczność:\n" +
"<color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Jeśli znalazłeś to <i>gdziekolwiek</i> indziej, np. \n" + // "<color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Jeśli znalazłeś to <i>gdziekolwiek</i> indziej, np. \n" +
"<color=#8B0000>Plants Hybrid</color> i <color=#8B0000>superhybrid.online</color>, ukradli to.\n" + // "<color=#8B0000>Plants Hybrid</color> i <color=#8B0000>superhybrid.online</color>, ukradli to.\n" +
"Omijaj inne źródła, ponieważ mogą zawierać wirusy.\n" + // "Omijaj inne źródła, ponieważ mogą zawierać wirusy.\n" +
"Odwiedź naszą społeczność, aby uzyskać przyszłe aktualizacje.</size>", // "Odwiedź naszą społeczność, aby uzyskać przyszłe aktualizacje.</size>",
"Okay! Rozumiem.") }, // "Okay! Rozumiem.") },
{ "Hungarian" , ("<size=8>Ennek a fordításnak az egyetlen érvényes forrása ebből a közösségből származik:\n" + // { "Hungarian" , ("<size=8>Ennek a fordításnak az egyetlen érvényes forrása ebből a közösségből származik:\n" +
"<color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Ha ezt <i>valahol</i> máshol szerezted, például \n" + // "<color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Ha ezt <i>valahol</i> máshol szerezted, például \n" +
"<color=#8B0000>Plants Hybrid</color> és <color=#8B0000>superhybrid.online</color> oldalakon, akkor ők lopták.\n" + // "<color=#8B0000>Plants Hybrid</color> és <color=#8B0000>superhybrid.online</color> oldalakon, akkor ők lopták.\n" +
"Kerüld a többi forrást, mert vírusokat tartalmazhatnak.\n" + // "Kerüld a többi forrást, mert vírusokat tartalmazhatnak.\n" +
"Kérjük, látogass el közösségünkbe a jövőbeli frissítésekért.</size>", // "Kérjük, látogass el közösségünkbe a jövőbeli frissítésekért.</size>",
"Oké! Értem.") }, // "Oké! Értem.") },
{ "Arabic" , ("<size=10>The only valid source of this translation is from this community:\n" + // { "Arabic" , ("<size=10>The only valid source of this translation is from this community:\n" +
"<color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. If you got this <i>anywhere</i> else like \n" + // "<color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. If you got this <i>anywhere</i> else like \n" +
"<color=#8B0000>Plants Hybrid</color> and <color=#8B0000>superhybrid.online</color>, they stole it.\n" + // "<color=#8B0000>Plants Hybrid</color> and <color=#8B0000>superhybrid.online</color>, they stole it.\n" +
"Stray away from other sources as they may contain viruses.\n" + // "Stray away from other sources as they may contain viruses.\n" +
"Please visit our community for future updates.</size>", // "Please visit our community for future updates.</size>",
"Okay! Got it.") }, // "Okay! Got it.") },
// { "OTHER" , ("<size=10>A única fonte válida dessa tradução é desta\ncomunidade: <color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Se você obteve \nisso <i>em qualquer lugar</i> como <color=#8B0000>Plants Hybrid</color>\ne <color=#8B0000>superhybrid.online</color>,ou Blue Fly do Youtube,\nelses roubaram. Fique longe de sites falsos. Por favor,\nvisite nossa comunidade para futuras atualizações.</size>", "¡Okei! Entendido.") } // // { "OTHER" , ("<size=10>A única fonte válida dessa tradução é desta\ncomunidade: <color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Se você obteve \nisso <i>em qualquer lugar</i> como <color=#8B0000>Plants Hybrid</color>\ne <color=#8B0000>superhybrid.online</color>,ou Blue Fly do Youtube,\nelses roubaram. Fique longe de sites falsos. Por favor,\nvisite nossa comunidade para futuras atualizações.</size>", "¡Okei! Entendido.") }
// { "OTHER" , ("<size=9.5>Ang translation na ito ay galing dito lamang:\n<color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Pag nakuha niyo ito <i>sa iba pa</i>\nkagaya ng <color=#8B0000>Plants Hybrid</color> o <color=#8B0000>superhybrid.online</color>, anumang\nginawagawa ng <color=#8B0000>Blue Fly mula sa Youtube</color>, o anumang\n<color=#8B0000>Sub2Unlock links</color>, scam sila. MAG INGAT dahil\nkasi baka may virus 'jan. Join kayo sa discord namin!\nFilipino Translation by ColinPogi</size>" , "Tayo magsi-laro!") } // // { "OTHER" , ("<size=9.5>Ang translation na ito ay galing dito lamang:\n<color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Pag nakuha niyo ito <i>sa iba pa</i>\nkagaya ng <color=#8B0000>Plants Hybrid</color> o <color=#8B0000>superhybrid.online</color>, anumang\nginawagawa ng <color=#8B0000>Blue Fly mula sa Youtube</color>, o anumang\n<color=#8B0000>Sub2Unlock links</color>, scam sila. MAG INGAT dahil\nkasi baka may virus 'jan. Join kayo sa discord namin!\nFilipino Translation by ColinPogi</size>" , "Tayo magsi-laro!") }
}; // };
#else // #else
public static string warningMessage = "<size=10>La única fuente válida de esta traducción proviene de esta\ncomunidad: <color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Si la obtuvo <i>en cualquier</i>\notro lugar como <color=#8B0000>Plants Hybrid</color> o <color=#8B0000>superhybrid.online</color>, la robaron.\nManténgase alejado de otras fuentes, ya que podrían contener virus.\nPor favor, visite nuestra comunidad para futuras actualizaciones."; // public static string warningMessage = "<size=10>La única fuente válida de esta traducción proviene de esta\ncomunidad: <color=#64DD17>discord.gg/DPAC5ZVJ8T</color>. Si la obtuvo <i>en cualquier</i>\notro lugar como <color=#8B0000>Plants Hybrid</color> o <color=#8B0000>superhybrid.online</color>, la robaron.\nManténgase alejado de otras fuentes, ya que podrían contener virus.\nPor favor, visite nuestra comunidad para futuras actualizaciones.";
public static string okayButton = "¡Entendido!"; // public static string okayButton = "¡Entendido!";
#endif // #endif
#if MULTI_LANGUAGE // #if MULTI_LANGUAGE
public static (string, string) GetWarningMessage(Utils.LanguageEnum language) // public static (string, string) GetWarningMessage(Utils.LanguageEnum language)
{ // {
if (warningMessages.TryGetValue(language.ToString(), out var message)) // if (warningMessages.TryGetValue(language.ToString(), out var message))
{ // {
return message; // return message;
} // }
else // else
{ // {
return warningMessages["English"]; // Default to English if language code is not found // return warningMessages["English"]; // Default to English if language code is not found
} // }
} // }
#endif //#endif
public static void WarningLoad(NoticeMenu noticeMenu) // public static void WarningLoad(NoticeMenu noticeMenu)
{ // {
if (noticeMenu == null || noticeMenu.transform == null) // if (noticeMenu == null || noticeMenu.transform == null)
{ // {
MelonLogger.Warning("[WarningStore] NoticeMenu or transform is null - ABORTING"); // MelonLogger.Warning("[WarningStore] NoticeMenu or transform is null - ABORTING");
return; // return;
} // }
#if MULTI_LANGUAGE //#if MULTI_LANGUAGE
try // try
{ // {
var (warningMessage, okayButton) = GetWarningMessage(Utils.Language); // var (warningMessage, okayButton) = GetWarningMessage(Utils.Language);
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString()); // TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
Transform warningTransform = noticeMenu.transform.Find("窗口"); // Transform warningTransform = noticeMenu.transform.Find("窗口");
if (warningTransform == null) // if (warningTransform == null)
{ // {
MelonLogger.Warning("[WarningStore] '窗口' transform not found - ABORTING"); // MelonLogger.Warning("[WarningStore] '窗口' transform not found - ABORTING");
return; // return;
} // }
Transform warningTextTransform = warningTransform.Find("文字"); // Transform warningTextTransform = warningTransform.Find("文字");
Transform warningTextShadowTransform = warningTransform.Find("文字2"); // Transform warningTextShadowTransform = warningTransform.Find("文字2");
if (warningTextTransform == null || warningTextShadowTransform == null) // if (warningTextTransform == null || warningTextShadowTransform == null)
{ // {
MelonLogger.Warning("[WarningStore] Could not find text components (文字/文字2)"); // MelonLogger.Warning("[WarningStore] Could not find text components (文字/文字2)");
return; // return;
} // }
TextMeshProUGUI warningText = warningTextTransform.GetComponent<TextMeshProUGUI>(); // TextMeshProUGUI warningText = warningTextTransform.GetComponent<TextMeshProUGUI>();
TextMeshProUGUI shadowText = warningTextShadowTransform.GetComponent<TextMeshProUGUI>(); // TextMeshProUGUI shadowText = warningTextShadowTransform.GetComponent<TextMeshProUGUI>();
if (warningText == null || shadowText == null) // if (warningText == null || shadowText == null)
{ // {
MelonLogger.Warning("[WarningStore] TextMeshProUGUI components missing"); // MelonLogger.Warning("[WarningStore] TextMeshProUGUI components missing");
return; // return;
} // }
warningText.text = warningMessage; // warningText.text = warningMessage;
shadowText.text = warningMessage; // shadowText.text = warningMessage;
if (fontAsset != null) // if (fontAsset != null)
{ // {
warningText.font = fontAsset; // warningText.font = fontAsset;
shadowText.font = fontAsset; // shadowText.font = fontAsset;
} // }
else // else
{ // {
MelonLogger.Warning("[WarningStore] Font asset is null"); // MelonLogger.Warning("[WarningStore] Font asset is null");
} // }
MelonLogger.Msg("Warning message loaded successfully!"); // MelonLogger.Msg("Warning message loaded successfully!");
} // }
catch (Exception e) // catch (Exception e)
{ // {
MelonLogger.Error($"Critical error in WarningLoad: {e}"); // MelonLogger.Error($"Critical error in WarningLoad: {e}");
} // }
#endif //#endif
} // }
#if MULTI_LANGUAGE //#if MULTI_LANGUAGE
public static bool isWarningMessageLoaded = false; // public static bool isWarningMessageLoaded = false;
public static void WarningReload(Utils.LanguageEnum language, NoticeMenu noticeMenu) // public static void WarningReload(Utils.LanguageEnum language, NoticeMenu noticeMenu)
{ // {
if (noticeMenu == null) // if (noticeMenu == null)
{ // {
MelonLogger.Warning("[WarningStore] NoticeMenu is null in WarningReload"); // MelonLogger.Warning("[WarningStore] NoticeMenu is null in WarningReload");
return; // return;
} // }
if (Utils.OldLanguage.ToString() == language.ToString() && Utils.OldLanguage.ToString() != "English") // if (Utils.OldLanguage.ToString() == language.ToString() && Utils.OldLanguage.ToString() != "English")
{ // {
return; // return;
} // }
if (!isWarningMessageLoaded) // if (!isWarningMessageLoaded)
{ // {
WarningLoad(noticeMenu); // WarningLoad(noticeMenu);
isWarningMessageLoaded = true; // isWarningMessageLoaded = true;
} // }
} // }
#else //#else
public static bool isWarningMessageLoaded = false; // public static bool isWarningMessageLoaded = false;
public static void WarningReload() // public static void WarningReload()
{ // {
if (!WarningStore.isWarningMessageLoaded) // if (!WarningStore.isWarningMessageLoaded)
{ // {
WarningStore.WarningLoad(); // WarningStore.WarningLoad();
WarningStore.isWarningMessageLoaded = true; // WarningStore.isWarningMessageLoaded = true;
} // }
} // }
#endif //#endif
} // }
} //}

View file

@ -11,9 +11,24 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
public static class BaseMenu_Patch public static class BaseMenu_Patch
{ {
[HarmonyPatch(nameof(BaseMenu.Awake))] [HarmonyPatch(nameof(BaseMenu.Awake))]
[HarmonyPostfix] [HarmonyPrefix]
private static void Awake(BaseMenu __instance) private static void Pre_Awake(BaseMenu __instance)
{ {
if(__instance.name.Contains("NoticePauseMenu"))
{
NoticePauseMenu_Patch.Pre_Awake(__instance);
}
}
[HarmonyPatch(nameof(BaseMenu.Awake))]
[HarmonyPostfix]
private static void Post_Awake(BaseMenu __instance)
{
if(__instance.name.Contains("NoticePauseMenu"))
{
NoticePauseMenu_Patch.Post_Awake(__instance);
}
TranslateBaseMenu(__instance, "Level"); TranslateBaseMenu(__instance, "Level");
TranslateBaseMenu(__instance, "Levels"); TranslateBaseMenu(__instance, "Levels");
TranslateBaseMenu(__instance, "CustomLevel"); TranslateBaseMenu(__instance, "CustomLevel");

View file

@ -1,24 +1,24 @@
using HarmonyLib; //using HarmonyLib;
using Il2Cpp; //using Il2Cpp;
using PvZ_Fusion_Translator.AssetStore; //using PvZ_Fusion_Translator.AssetStore;
using UnityEngine; //using UnityEngine;
namespace PvZ_Fusion_Translator.Patches.GameObjects //namespace PvZ_Fusion_Translator.Patches.GameObjects
{ //{
[HarmonyPatch(typeof(MainMenu))] // [HarmonyPatch(typeof(MainMenu))]
public class MainMenu_Patch // public class MainMenu_Patch
{ // {
private static bool _warningShown = false; // private static bool _warningShown = false;
[HarmonyPostfix] // [HarmonyPostfix]
[HarmonyPatch(nameof(MainMenu.AnimOver))] // [HarmonyPatch(nameof(MainMenu.AnimOver))]
private static void AnimOver(MainMenu __instance) // private static void AnimOver(MainMenu __instance)
{ // {
if (_warningShown || NoticeMenu.Instance == null) // if (_warningShown || NoticeMenu.Instance == null)
return; // return;
WarningStore.WarningReload(Utils.Language, NoticeMenu.Instance); // WarningStore.WarningReload(Utils.Language, NoticeMenu.Instance);
_warningShown = true; // _warningShown = true;
} // }
} // }
} //}

View file

@ -7,12 +7,9 @@ using UnityEngine.UI;
namespace PvZ_Fusion_Translator.Patches.GameObjects namespace PvZ_Fusion_Translator.Patches.GameObjects
{ {
[HarmonyPatch(typeof(NoticeMenu))]
public class NoticePauseMenu_Patch public class NoticePauseMenu_Patch
{ {
[HarmonyPrefix] public static void Pre_Awake(BaseMenu __instance)
[HarmonyPatch(nameof(NoticeMenu.Awake))]
private static void Pre_Awake(NoticeMenu __instance)
{ {
GameObject contentObject = __instance.transform.FindChild("Scroll View/Viewport/Content").gameObject; GameObject contentObject = __instance.transform.FindChild("Scroll View/Viewport/Content").gameObject;
@ -28,9 +25,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
} }
} }
[HarmonyPostfix] public static void Post_Awake(BaseMenu __instance)
[HarmonyPatch(nameof(NoticeMenu.Awake))]
private static void Post_Awake(NoticeMenu __instance)
{ {
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString()); TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
string stringDir = FileLoader.GetAssetDir(FileLoader.AssetType.Strings, Utils.Language); string stringDir = FileLoader.GetAssetDir(FileLoader.AssetType.Strings, Utils.Language);

View file

@ -0,0 +1,81 @@
using HarmonyLib;
using Il2Cpp;
using Il2CppTMPro;
using PvZ_Fusion_Translator.AssetStore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace PvZ_Fusion_Translator.Patches.GameObjects
{
[HarmonyPatch(typeof(PlantDataMenu))]
public static class PlantDataMenu_Patch
{
[HarmonyPatch(nameof(PlantDataMenu.Start))]
[HarmonyPostfix]
public static void Post_Start(PlantDataMenu __instance)
{
TranslatePlantDataMenu(__instance);
}
[HarmonyPatch(nameof(PlantDataMenu.Update))]
[HarmonyPostfix]
public static void Post_Update(PlantDataMenu __instance)
{
TranslatePlantDataMenu(__instance);
}
public static void TranslatePlantDataMenu(PlantDataMenu __instance)
{
PlantType thePlantType = __instance.plant.thePlantType;
string plantName = Utils.GetPlantNameFromAlmanac(thePlantType);
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
foreach(TextMeshProUGUI text in __instance.nameText)
{
text.text = plantName;
text.font = fontAsset;
}
foreach(TextMeshProUGUI text in __instance.infoText)
{
string toTranslate = text.text;
string startColorTag = "";
string colorPattern = @"(<color=[^>]+>)(.*?)(</color>)";
Match match = Regex.Match(toTranslate, colorPattern);
if(match.Success)
{
startColorTag = match.Groups[1].Value;
toTranslate = match.Groups[2].Value;
Log.LogDebug(toTranslate);
}
string[] parts = toTranslate.Split("\n");
List<string> translatedParts = new List<string>();
foreach(string part in parts)
{
translatedParts.Add(StringStore.TranslateText(part));
}
string joinedTranslation = String.Join("\n", translatedParts);
if(startColorTag != "")
{
text.text = startColorTag + joinedTranslation + "</color>";
}
else
{
text.text = joinedTranslation;
}
text.font = fontAsset;
}
}
}
}

View file

@ -15,11 +15,11 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
{ {
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString()); TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
foreach (TextMeshProUGUI txt in __instance.GetComponentsInChildren<TextMeshProUGUI>()) //foreach (TextMeshProUGUI txt in __instance.GetComponentsInChildren<TextMeshProUGUI>())
{ //{
txt.text = StringStore.TranslateText(txt.text); // txt.text = StringStore.TranslateText(txt.text);
txt.font = fontAsset; // txt.font = fontAsset;
} //}
Transform safetyBoxButtonTransform = __instance.transform.FindChild("SafeBox").FindChild("StartSafeMode"); Transform safetyBoxButtonTransform = __instance.transform.FindChild("SafeBox").FindChild("StartSafeMode");

View file

@ -41,8 +41,12 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
TextMeshProUGUI text = normalModeTransform.Find("text").GetComponent<TextMeshProUGUI>(); TextMeshProUGUI text = normalModeTransform.Find("text").GetComponent<TextMeshProUGUI>();
TextMeshProUGUI textShadow = normalModeTransform.Find("text (1)").GetComponent<TextMeshProUGUI>(); TextMeshProUGUI textShadow = normalModeTransform.Find("text (1)").GetComponent<TextMeshProUGUI>();
text.text = Utils.RemoveColorTags(StringStore.TranslateText(text.text)); text.text = StringStore.translationString.ContainsKey("普通模式_IV") ? StringStore.TranslateText("普通模式_IV") : Utils.RemoveColorTags(StringStore.TranslateText(text.text));
textShadow.text = Utils.RemoveColorTags(textShadow.text); text.alignment = TextAlignmentOptions.Center;
text.autoSizeTextContainer = true;
textShadow.text = Utils.RemoveColorTags(text.text);
textShadow.alignment = TextAlignmentOptions.Center;
textShadow.autoSizeTextContainer = true;
} }
if (challengeModeTransform != null) if (challengeModeTransform != null)
@ -50,8 +54,12 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
TextMeshProUGUI text = challengeModeTransform.Find("text").GetComponent<TextMeshProUGUI>(); TextMeshProUGUI text = challengeModeTransform.Find("text").GetComponent<TextMeshProUGUI>();
TextMeshProUGUI textShadow = challengeModeTransform.Find("text (1)").GetComponent<TextMeshProUGUI>(); TextMeshProUGUI textShadow = challengeModeTransform.Find("text (1)").GetComponent<TextMeshProUGUI>();
text.text = Utils.RemoveColorTags(StringStore.TranslateText(text.text)); text.text = StringStore.translationString.ContainsKey("诅咒模式_IV") ? StringStore.TranslateText("诅咒模式_IV") : Utils.RemoveColorTags(StringStore.TranslateText(text.text));
textShadow.text = Utils.RemoveColorTags(textShadow.text); text.alignment = TextAlignmentOptions.Center;
text.autoSizeTextContainer = true;
textShadow.text = Utils.RemoveColorTags(text.text);
textShadow.alignment = TextAlignmentOptions.Center;
textShadow.autoSizeTextContainer = true;
} }
if (__instance.tutor != null) if (__instance.tutor != null)

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_3.4.1</GamePath> <GamePath>C:\Users\rainb\Desktop\PC_PVZ-Fusion_3.4.2</GamePath>
<Platforms>AnyCPU;ARM64;x64</Platforms> <Platforms>AnyCPU;ARM64;x64</Platforms>
</PropertyGroup> </PropertyGroup>
@ -400,6 +400,7 @@
<Compile Include="Log.cs" /> <Compile Include="Log.cs" />
<Compile Include="ModFeatures.cs" /> <Compile Include="ModFeatures.cs" />
<Compile Include="AssetStore\AudioStore.cs" /> <Compile Include="AssetStore\AudioStore.cs" />
<Compile Include="Patches\GameObjects\PlantDataMenu_Patch.cs" />
<Compile Include="Patches\GameObjects\WarningMenu_Patch.cs" /> <Compile Include="Patches\GameObjects\WarningMenu_Patch.cs" />
<Compile Include="Patches\Modes\Abyss\AbyssBuffMenu_Patch.cs" /> <Compile Include="Patches\Modes\Abyss\AbyssBuffMenu_Patch.cs" />
<Compile Include="Patches\Modes\Odyssey\TravelInvestMenu_Patch.cs" /> <Compile Include="Patches\Modes\Odyssey\TravelInvestMenu_Patch.cs" />

View file

@ -373,7 +373,7 @@ namespace PvZ_Fusion_Translator
Log.LogError($"Invalid language string: {language}"); Log.LogError($"Invalid language string: {language}");
} }
WarningStore.isWarningMessageLoaded = false; //WarningStore.isWarningMessageLoaded = false;
FontStore.Reload(); FontStore.Reload();
StringStore.Reload(); StringStore.Reload();
TextureStore.Reload(); TextureStore.Reload();