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", "");
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;
}

View file

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

View file

@ -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;
}

View file

@ -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;

View file

@ -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;