diff --git a/MelonLoader/AssetStore/FontStore.cs b/MelonLoader/AssetStore/FontStore.cs
index e497378..48c5af1 100644
--- a/MelonLoader/AssetStore/FontStore.cs
+++ b/MelonLoader/AssetStore/FontStore.cs
@@ -55,22 +55,7 @@ namespace PvZ_Fusion_Translator.AssetStore
string fileNameLanguage = fileName.Replace("_fallback", "").Replace("_almanac", "");
- if (fontAssetDictSecondary.ContainsKey(fileNameLanguage))
- {
- if (fileName.EndsWith("_Fallback"))
- {
- fontAssetDictSecondary.Add(fileNameLanguage + "_almanac", fontAssetDictSecondary[fileNameLanguage]);
- fontAssetDictSecondary.Remove(fileNameLanguage);
- }
- else
- {
- fontAssetDictSecondary.Add(fileNameLanguage + "_fallback", fontAssetDictSecondary[fileNameLanguage]);
- fontAssetDictSecondary.Remove(fileNameLanguage);
- }
- fontAssetDictSecondary.Add(fileName, fallbackFont);
- }
- else
- fontAssetDictSecondary.Add(fileNameLanguage, fallbackFont);
+ Utils.TryAdd(fontAssetDictSecondary, fileName, fallbackFont);
// Log.LogInfo($"Fallback font for language '{fileNameLanguage}' loaded");
}
@@ -132,16 +117,16 @@ namespace PvZ_Fusion_Translator.AssetStore
public static TMP_FontAsset LoadTMPFontAlmanac(string language)
{
- if (fontAssetDictSecondary.ContainsKey(language))
+ if (fontAssetDictSecondary.ContainsKey(language.ToLower()))
{
- if (fontAssetDictSecondary.TryGetValue(language, out TMP_FontAsset almanacAsset))
+ if (fontAssetDictSecondary.TryGetValue(language.ToLower(), out TMP_FontAsset almanacAsset))
{
return almanacAsset;
}
}
- if (fontAssetDictSecondary.ContainsKey(language + "_almanac"))
+ if (fontAssetDictSecondary.ContainsKey(language.ToLower() + "_almanac"))
{
- if (fontAssetDictSecondary.TryGetValue(language + "_almanac", out TMP_FontAsset almanacAsset))
+ if (fontAssetDictSecondary.TryGetValue(language.ToLower() + "_almanac", out TMP_FontAsset almanacAsset))
{
return almanacAsset;
}
diff --git a/MelonLoader/AssetStore/StringStore.cs b/MelonLoader/AssetStore/StringStore.cs
index b7c2995..f3df218 100644
--- a/MelonLoader/AssetStore/StringStore.cs
+++ b/MelonLoader/AssetStore/StringStore.cs
@@ -90,6 +90,7 @@ namespace PvZ_Fusion_Translator.AssetStore
fsLevelTipDictionary.Clear();
fsTipCollectionString.Clear();
InGameText_Patch.currentText = "";
+ Utils.RegisterPlantIndices();
FileLoader.LoadStrings();
}
diff --git a/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs b/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
index 077eade..4fc812f 100644
--- a/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
+++ b/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
@@ -375,6 +375,13 @@ namespace PvZ_Fusion_Translator.Patches.BaseTextObjects
res = StringStore.TranslateText(originalText, pair.Key);
}
}
+ foreach(var pair in StringStore.translationStringRegex)
+ {
+ if(StringStore.TestRegex(originalText, pair.Key))
+ {
+ res = "";
+ }
+ }
return res;
}
diff --git a/MelonLoader/Patches/GameObjects/AlmanacPlantWindow_Patch.cs b/MelonLoader/Patches/GameObjects/AlmanacPlantWindow_Patch.cs
index 239c747..b752d26 100644
--- a/MelonLoader/Patches/GameObjects/AlmanacPlantWindow_Patch.cs
+++ b/MelonLoader/Patches/GameObjects/AlmanacPlantWindow_Patch.cs
@@ -27,7 +27,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
bool hasAlmanacFont = false;
TMP_FontAsset almanacFontAsset = null;
- if (FontStore.fontAssetDictSecondary.ContainsKey(currentLanguage + "_Almanac") || FontStore.fontAssetDictSecondary.ContainsKey(currentLanguage))
+ if (FontStore.fontAssetDictSecondary.ContainsKey((currentLanguage + "_almanac").ToLower()) || FontStore.fontAssetDictSecondary.ContainsKey((currentLanguage).ToLower()))
{
almanacFontAsset = FontStore.LoadTMPFontAlmanac(currentLanguage);
hasAlmanacFont = true;
diff --git a/MelonLoader/Patches/GameObjects/AlmanacZombieWindow_Patch.cs b/MelonLoader/Patches/GameObjects/AlmanacZombieWindow_Patch.cs
index afcb7dc..49a4852 100644
--- a/MelonLoader/Patches/GameObjects/AlmanacZombieWindow_Patch.cs
+++ b/MelonLoader/Patches/GameObjects/AlmanacZombieWindow_Patch.cs
@@ -25,7 +25,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
bool hasAlmanacFont = false;
TMP_FontAsset almanacFontAsset = null;
- if (FontStore.fontAssetDictSecondary.ContainsKey(currentLanguage + "_Almanac") || FontStore.fontAssetDictSecondary.ContainsKey(currentLanguage))
+ if (FontStore.fontAssetDictSecondary.ContainsKey((currentLanguage + "_almanac").ToLower()) || FontStore.fontAssetDictSecondary.ContainsKey((currentLanguage).ToLower()))
{
almanacFontAsset = FontStore.LoadTMPFontAlmanac(currentLanguage);
hasAlmanacFont = true;
diff --git a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
index af66eba..0a32ac6 100644
--- a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
+++ b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
@@ -13,7 +13,7 @@
latest
enable
Debug;DebugEnglish;ReleaseMulti;ReleaseEnglish;DebugTesting;ReleaseOther;DebugObfuscate;ReleaseObfuscate
- C:\Users\rainb\Desktop\PC_PVZ-Fusion_3.8
+ C:\Users\rainb\Desktop\PC_PVZ-Fusion_3.8.1
AnyCPU;ARM64;x64