Merge branch 'cassidy'

This commit is contained in:
SillyStar-Github 2026-07-28 13:32:33 -04:00
commit 36dfab123f
5 changed files with 15 additions and 22 deletions

View file

@ -55,22 +55,7 @@ namespace PvZ_Fusion_Translator.AssetStore
string fileNameLanguage = fileName.Replace("_fallback", "").Replace("_almanac", ""); string fileNameLanguage = fileName.Replace("_fallback", "").Replace("_almanac", "");
if (fontAssetDictSecondary.ContainsKey(fileNameLanguage)) Utils.TryAdd(fontAssetDictSecondary, fileName, fallbackFont);
{
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);
// Log.LogInfo($"Fallback font for language '{fileNameLanguage}' loaded"); // Log.LogInfo($"Fallback font for language '{fileNameLanguage}' loaded");
} }
@ -132,16 +117,16 @@ namespace PvZ_Fusion_Translator.AssetStore
public static TMP_FontAsset LoadTMPFontAlmanac(string language) 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; 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; return almanacAsset;
} }

View file

@ -90,6 +90,7 @@ namespace PvZ_Fusion_Translator.AssetStore
fsLevelTipDictionary.Clear(); fsLevelTipDictionary.Clear();
fsTipCollectionString.Clear(); fsTipCollectionString.Clear();
InGameText_Patch.currentText = ""; InGameText_Patch.currentText = "";
Utils.RegisterPlantIndices();
FileLoader.LoadStrings(); FileLoader.LoadStrings();
} }

View file

@ -375,6 +375,13 @@ namespace PvZ_Fusion_Translator.Patches.BaseTextObjects
res = StringStore.TranslateText(originalText, pair.Key); res = StringStore.TranslateText(originalText, pair.Key);
} }
} }
foreach(var pair in StringStore.translationStringRegex)
{
if(StringStore.TestRegex(originalText, pair.Key))
{
res = "";
}
}
return res; return res;
} }

View file

@ -27,7 +27,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
bool hasAlmanacFont = false; bool hasAlmanacFont = false;
TMP_FontAsset almanacFontAsset = null; 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); almanacFontAsset = FontStore.LoadTMPFontAlmanac(currentLanguage);
hasAlmanacFont = true; hasAlmanacFont = true;

View file

@ -25,7 +25,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
bool hasAlmanacFont = false; bool hasAlmanacFont = false;
TMP_FontAsset almanacFontAsset = null; 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); almanacFontAsset = FontStore.LoadTMPFontAlmanac(currentLanguage);
hasAlmanacFont = true; hasAlmanacFont = true;