3.8.1 + some fixes
almanac fallback fonts now work and custom level regexes wont interfere with normal regexes
This commit is contained in:
parent
f2e4e78750
commit
dc2ba53835
6 changed files with 16 additions and 23 deletions
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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.8</GamePath>
|
<GamePath>C:\Users\rainb\Desktop\PC_PVZ-Fusion_3.8.1</GamePath>
|
||||||
<Platforms>AnyCPU;ARM64;x64</Platforms>
|
<Platforms>AnyCPU;ARM64;x64</Platforms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue