MESSY bepinex stuff + some melonloader
This commit is contained in:
parent
0df5c96f4c
commit
7216014ac2
33 changed files with 958 additions and 572 deletions
|
|
@ -148,16 +148,19 @@ namespace PvZ_Fusion_Translator__BepInEx_
|
||||||
{
|
{
|
||||||
public static void Prefix(UnityEngine.AudioSource __instance)
|
public static void Prefix(UnityEngine.AudioSource __instance)
|
||||||
{
|
{
|
||||||
if (__instance.clip == null)
|
if(Utils.customAudio)
|
||||||
|
{
|
||||||
|
if (__instance.clip == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string audioClipName = __instance.clip.name;
|
string audioClipName = __instance.clip.name;
|
||||||
|
|
||||||
if (AudioStore.AudioClips.TryGetValue(audioClipName, out AudioClip replaceClip))
|
if (AudioStore.AudioClips.TryGetValue(audioClipName, out AudioClip replaceClip))
|
||||||
{
|
{
|
||||||
__instance.pitch = 1;
|
__instance.pitch = 1;
|
||||||
__instance.clip = replaceClip;
|
__instance.clip = replaceClip;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ namespace PvZ_Fusion_Translator__BepInEx_.AssetStore
|
||||||
#if MULTI_LANGUAGE
|
#if MULTI_LANGUAGE
|
||||||
RestoreTextures();
|
RestoreTextures();
|
||||||
#endif
|
#endif
|
||||||
FileLoader.LoadDefaultTextures();
|
|
||||||
FileLoader.LoadTextures();
|
FileLoader.LoadTextures();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ public class Core : BasePlugin
|
||||||
StringStore.Init();
|
StringStore.Init();
|
||||||
FontStore.Init();
|
FontStore.Init();
|
||||||
|
|
||||||
InitCoroutine();
|
InitCoroutine();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Unload()
|
public override bool Unload()
|
||||||
|
|
@ -67,7 +67,6 @@ public class Core : BasePlugin
|
||||||
public void InitCoroutine()
|
public void InitCoroutine()
|
||||||
{
|
{
|
||||||
replaceTextureRoutine = MonoInstance.StartCoroutine(TextureStore.ReplaceTexturesCoroutine());
|
replaceTextureRoutine = MonoInstance.StartCoroutine(TextureStore.ReplaceTexturesCoroutine());
|
||||||
Log.LogDebug("Coroutine Started");
|
|
||||||
}
|
}
|
||||||
public static void ShowToast(string message)
|
public static void ShowToast(string message)
|
||||||
{
|
{
|
||||||
|
|
@ -111,10 +110,25 @@ public class Core : BasePlugin
|
||||||
private void LoadConfig()
|
private void LoadConfig()
|
||||||
{
|
{
|
||||||
string mainCategory = "PvZ_Fusion_Translator";
|
string mainCategory = "PvZ_Fusion_Translator";
|
||||||
configDefaultTextures = Config.Bind(new ConfigDefinition(mainCategory, "DefaultTextures"), false, new ConfigDescription("Use Default Textures + Translation Textures", new AcceptableValueList<bool>(true, false)));
|
|
||||||
configDefaultAudio = Config.Bind(new ConfigDefinition(mainCategory, "DefaultAudio"), false, new ConfigDescription("Use Default Audio", new AcceptableValueList<bool>(true, false)));
|
if(Config.TryGetEntry<bool>(new ConfigDefinition(mainCategory, "DefaultTextures"), out configDefaultTextures) == false)
|
||||||
configLanguage = Config.Bind(new ConfigDefinition(mainCategory, "Language"), "English", new ConfigDescription("Load the Game in this Language", new AcceptableValueList<string>("English", "French", "Italian", "German", "Spanish", "Portuguese", "Indonesian", "Vietnamese", "Javanese", "Russian", "Japanese", "Korean")));
|
{
|
||||||
}
|
configDefaultTextures = Config.Bind(new ConfigDefinition(mainCategory, "DefaultTextures"), false, new ConfigDescription("Use Default Textures + Translation Textures", new AcceptableValueList<bool>(true, false)));
|
||||||
|
}
|
||||||
|
bool defaultTextures = Config.TryGetEntry<bool>(new ConfigDefinition("PvZ_Fusion_Translator", "DefaultTextures"), out configDefaultTextures);
|
||||||
|
|
||||||
|
if (Config.TryGetEntry<bool>(new ConfigDefinition(mainCategory, "DefaultAudio"), out configDefaultAudio) == false)
|
||||||
|
{
|
||||||
|
configDefaultAudio = Config.Bind(new ConfigDefinition(mainCategory, "DefaultAudio"), false, new ConfigDescription("Use Default Audio", new AcceptableValueList<bool>(true, false)));
|
||||||
|
}
|
||||||
|
bool defaultAudio = Config.TryGetEntry<bool>(new ConfigDefinition("PvZ_Fusion_Translator", "DefaultAudio"), out configDefaultAudio);
|
||||||
|
|
||||||
|
if (Config.TryGetEntry<string>(new ConfigDefinition(mainCategory, "Language"), out configLanguage) == false)
|
||||||
|
{
|
||||||
|
configLanguage = Config.Bind(new ConfigDefinition(mainCategory, "Language"), "English", new ConfigDescription("Load the Game in this Language", new AcceptableValueList<string>("English", "French", "Italian", "German", "Spanish", "Portuguese", "Indonesian", "Vietnamese", "Javanese", "Russian", "Japanese", "Korean")));
|
||||||
|
}
|
||||||
|
bool language = Config.TryGetEntry<string>(new ConfigDefinition("PvZ_Fusion_Translator", "Language"), out configLanguage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UnityCoroutineHelper : MonoBehaviour
|
public class UnityCoroutineHelper : MonoBehaviour
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
using BepInEx.Configuration;
|
||||||
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
using PvZ_Fusion_Translator__BepInEx_.Patches.OtherManagers;
|
using PvZ_Fusion_Translator__BepInEx_.Patches.OtherManagers;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
@ -9,336 +10,365 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace PvZ_Fusion_Translator__BepInEx_
|
namespace PvZ_Fusion_Translator__BepInEx_
|
||||||
{
|
{
|
||||||
internal static class FileLoader
|
internal static class FileLoader
|
||||||
{
|
{
|
||||||
internal enum AssetType
|
internal enum AssetType
|
||||||
{
|
{
|
||||||
Textures,
|
Textures,
|
||||||
Strings,
|
Strings,
|
||||||
Dumps,
|
Dumps,
|
||||||
Almanac,
|
Almanac,
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetAssetDir(AssetType assetType, Utils.LanguageEnum? language = null)
|
public static string GetAssetDir(AssetType assetType, Utils.LanguageEnum? language = null)
|
||||||
{
|
{
|
||||||
string languagePath = language.HasValue ? ("Localization" + Path.DirectorySeparatorChar + language.ToString()) : string.Empty;
|
string languagePath = language.HasValue ? ("Localization" + Path.DirectorySeparatorChar + language.ToString()) : string.Empty;
|
||||||
return Path.Combine(Core.Instance.modsDirectory, languagePath, assetType.ToString());
|
return Path.Combine(Core.Instance.modsDirectory, languagePath, assetType.ToString());
|
||||||
}
|
}
|
||||||
|
// private static string GetAssetDir(AssetType assetType) => Path.Combine(Core.Instance.modsDirectory, assetType.ToString());
|
||||||
|
|
||||||
internal static void LoadStrings() => LoadStrings(Utils.Language);
|
#if MULTI_LANGUAGE
|
||||||
internal static void LoadStrings(Utils.LanguageEnum language)
|
internal static void LoadStrings() => LoadStrings(Utils.Language);
|
||||||
{
|
|
||||||
string stringDir = GetAssetDir(AssetType.Strings, Utils.Language);
|
|
||||||
if (!Directory.Exists(stringDir))
|
|
||||||
{
|
|
||||||
Directory.CreateDirectory(stringDir);
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
foreach (string filepath in Directory.EnumerateFiles(stringDir, "*.json", SearchOption.AllDirectories))
|
|
||||||
{
|
|
||||||
|
|
||||||
#if OBFUSCATE
|
internal static void LoadStrings(Utils.LanguageEnum language)
|
||||||
|
#else
|
||||||
|
internal static void LoadStrings(bool isLog = false)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
#if MULTI_LANGUAGE
|
||||||
|
string stringDir = GetAssetDir(AssetType.Strings, Utils.Language);
|
||||||
|
#else
|
||||||
|
string stringDir = GetAssetDir(AssetType.Strings);
|
||||||
|
#endif
|
||||||
|
if (!Directory.Exists(stringDir))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(stringDir);
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (string filepath in Directory.EnumerateFiles(stringDir, "*.json", SearchOption.AllDirectories))
|
||||||
|
{
|
||||||
|
|
||||||
|
#if OBFUSCATE
|
||||||
if (CheckSumStore.IsModified(filepath))
|
if (CheckSumStore.IsModified(filepath))
|
||||||
{
|
{
|
||||||
Log.LogError("File {0} was modified!" , filepath);
|
Log.LogError("File {0} was modified!" , filepath);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
string fileName = Path.GetFileNameWithoutExtension(filepath);
|
string fileName = Path.GetFileNameWithoutExtension(filepath);
|
||||||
StringStore.stringsDict[fileName] = filepath;
|
StringStore.stringsDict[fileName] = filepath;
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Log.LogInfo("Loading File : " + filepath);
|
Log.LogInfo("Loading File : " + filepath);
|
||||||
#endif
|
#endif
|
||||||
string jsonString = File.ReadAllText(filepath);
|
string jsonString = File.ReadAllText(filepath);
|
||||||
if (fileName.EndsWith("_strings"))
|
if (fileName.EndsWith("_strings"))
|
||||||
|
{
|
||||||
|
Dictionary<string, string> dictionary = System.Text.Json.JsonSerializer.Deserialize<Dictionary<string, string>>(jsonString);
|
||||||
|
foreach (var (key, value) in dictionary)
|
||||||
|
{
|
||||||
|
StringStore.translationString[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (fileName.EndsWith("_regexs"))
|
||||||
|
{
|
||||||
|
Dictionary<string, string> dictionary = System.Text.Json.JsonSerializer.Deserialize<Dictionary<string, string>>(jsonString);
|
||||||
|
foreach (var (key, value) in dictionary)
|
||||||
|
{
|
||||||
|
StringStore.translationStringRegex[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SaveStrings();
|
||||||
|
DumpJson();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Log.LogError("Error loading string.");
|
||||||
|
Log.LogError(e.GetType() + " " + e.Message);
|
||||||
|
}
|
||||||
|
Log.LogInfo("Strings loaded successfully.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
internal static void LoadTextures()
|
||||||
|
{
|
||||||
|
ConfigEntry<bool> defaultTextureEntry;
|
||||||
|
Core.Instance.Config.TryGetEntry<bool>(new ConfigDefinition("PvZ_Fusion_Translator", "DefaultTextures"), out defaultTextureEntry);
|
||||||
|
|
||||||
|
// Default or Custom Texturse -> English Textures -> Localized Textures
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!defaultTextureEntry.Value)
|
||||||
|
{
|
||||||
|
LoadCustomTextures();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Log.LogError("Error loading texture setting.");
|
||||||
|
Log.LogError($"{e.GetType()} {e.Message}");
|
||||||
|
}
|
||||||
|
|
||||||
|
#if MULTI_LANGUAGE
|
||||||
|
if (Utils.Language != Utils.LanguageEnum.English)
|
||||||
|
{
|
||||||
|
LoadLocalizedTextures(Utils.LanguageEnum.English);
|
||||||
|
}
|
||||||
|
LoadLocalizedTextures(Utils.Language);
|
||||||
|
#else
|
||||||
|
LoadLocalizedTextures();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Log.LogInfo("Textures loaded successfully.");
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void LoadLocalizedTextures(Utils.LanguageEnum? language = null)
|
||||||
|
{
|
||||||
|
ConfigEntry<bool> defaultTextureEntry;
|
||||||
|
Core.Instance.Config.TryGetEntry<bool>(new ConfigDefinition("PvZ_Fusion_Translator", "DefaultTextures"), out defaultTextureEntry);
|
||||||
|
|
||||||
|
string textureDir = GetAssetDir(AssetType.Textures, language);
|
||||||
|
|
||||||
|
if (!Directory.Exists(textureDir))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(textureDir);
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (string filepath in Directory.EnumerateFiles(textureDir, "*.png", SearchOption.AllDirectories))
|
||||||
|
{
|
||||||
|
if (filepath.Contains("[Custom Textures]", StringComparison.OrdinalIgnoreCase) && defaultTextureEntry.Value)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if OBFUSCATE
|
||||||
|
if (CheckSumStore.IsModified(filepath))
|
||||||
{
|
{
|
||||||
Dictionary<string, string> dictionary = JsonSerializer.Deserialize<Dictionary<string, string>>(jsonString);
|
Log.LogError("File {0} was modified!" , filepath);
|
||||||
foreach (var (key, value) in dictionary)
|
continue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
Log.LogDebug("Loading File : " + filepath);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Texture2D texture2D = Utils.LoadImage(filepath);
|
||||||
|
TextureStore.textureDict[Path.GetFileNameWithoutExtension(filepath)] = filepath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Log.LogError("Error loading Texture.");
|
||||||
|
Log.LogError(e.GetType() + " " + e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void LoadDefaultTextures()
|
||||||
|
{
|
||||||
|
if (Core.Instance.configDefaultTextures.Value)
|
||||||
|
{
|
||||||
|
string textureDefaultDir = Path.Combine(Core.Instance.modsDirectory, AssetType.Dumps.ToString(), "Default Textures [Do Not Remove]");
|
||||||
|
if (!Directory.Exists(textureDefaultDir))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(textureDefaultDir);
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (string filepath in Directory.EnumerateFiles(textureDefaultDir, "*.png", SearchOption.AllDirectories))
|
||||||
|
{
|
||||||
|
|
||||||
|
#if OBFUSCATE
|
||||||
|
if (CheckSumStore.IsModified(filepath))
|
||||||
{
|
{
|
||||||
StringStore.translationString[key] = value;
|
Log.LogError("File {0} was modified!" , filepath);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
else if (fileName.EndsWith("_regexs"))
|
|
||||||
{
|
|
||||||
Dictionary<string, string> dictionary = JsonSerializer.Deserialize<Dictionary<string, string>>(jsonString);
|
|
||||||
foreach (var (key, value) in dictionary)
|
|
||||||
{
|
|
||||||
StringStore.translationStringRegex[key] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SaveStrings();
|
|
||||||
#if DEBUG
|
|
||||||
DumpJson();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Log.LogError("Error loading string.");
|
|
||||||
Log.LogError(e.GetType() + " " + e.Message);
|
|
||||||
}
|
|
||||||
Log.LogInfo("Strings loaded successfully.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool loadDefaultTextures = Core.Instance.configDefaultTextures.Value;
|
Texture2D texture2D = Utils.LoadImage(filepath);
|
||||||
internal static void LoadTextures()
|
TextureStore.textureDict[Path.GetFileNameWithoutExtension(filepath)] = filepath;
|
||||||
{
|
}
|
||||||
// Default or Custom Texturse -> English Textures -> Localized Textures
|
}
|
||||||
try
|
|
||||||
{
|
|
||||||
if (loadDefaultTextures == true)
|
|
||||||
{
|
|
||||||
LoadDefaultTextures();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LoadCustomTextures();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Log.LogError("Error loading texture setting.");
|
|
||||||
Log.LogError($"{e.GetType()} {e.Message}");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Utils.Language != Utils.LanguageEnum.English)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
LoadLocalizedTextures(Utils.LanguageEnum.English);
|
Log.LogError("Error loading Texture.");
|
||||||
}
|
Log.LogError(e.GetType() + " " + e.Message);
|
||||||
LoadLocalizedTextures(Utils.Language);
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Log.LogInfo("Textures loaded successfully.");
|
internal static void LoadCustomTextures()
|
||||||
}
|
{
|
||||||
|
string texturePackDir = Path.Combine(Core.Instance.modsDirectory, "[Custom Textures]");
|
||||||
|
|
||||||
internal static void LoadLocalizedTextures(Utils.LanguageEnum? language = null)
|
if (!Directory.Exists(texturePackDir))
|
||||||
{
|
{
|
||||||
string textureDir = GetAssetDir(AssetType.Textures, language);
|
Directory.CreateDirectory(texturePackDir);
|
||||||
|
}
|
||||||
if (!Directory.Exists(textureDir))
|
try
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(textureDir);
|
foreach (string filepath in Directory.EnumerateFiles(texturePackDir, "*.png", SearchOption.AllDirectories))
|
||||||
}
|
{
|
||||||
try
|
#if OBFUSCATE
|
||||||
{
|
|
||||||
foreach (string filepath in Directory.EnumerateFiles(textureDir, "*.png", SearchOption.AllDirectories))
|
|
||||||
{
|
|
||||||
if (filepath.Contains("[Custom Textures]", StringComparison.OrdinalIgnoreCase) && loadDefaultTextures)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if OBFUSCATE
|
|
||||||
if (CheckSumStore.IsModified(filepath))
|
if (CheckSumStore.IsModified(filepath))
|
||||||
{
|
{
|
||||||
Log.LogError("File {0} was modified!" , filepath);
|
Log.LogError("File {0} was modified!" , filepath);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if DEBUG
|
Texture2D texture2D = Utils.LoadImage(filepath);
|
||||||
Log.LogDebug("Loading File : " + filepath);
|
TextureStore.textureDict[Path.GetFileNameWithoutExtension(filepath)] = filepath;
|
||||||
#endif
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Texture2D texture2D = Utils.LoadImage(filepath);
|
catch (Exception e)
|
||||||
TextureStore.textureDict[Path.GetFileNameWithoutExtension(filepath)] = filepath;
|
{
|
||||||
}
|
Log.LogError("Error loading Texture.");
|
||||||
}
|
Log.LogError(e.GetType() + " " + e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
catch (Exception e)
|
internal static void SaveStrings()
|
||||||
{
|
{
|
||||||
Log.LogError("Error loading Texture.");
|
#if MULTI_LANGUAGE
|
||||||
Log.LogError(e.GetType() + " " + e.Message);
|
string stringDir = GetAssetDir(AssetType.Strings, Utils.Language);
|
||||||
}
|
#else
|
||||||
}
|
string stringDir = GetAssetDir(AssetType.Strings);
|
||||||
|
#endif
|
||||||
|
if (!Directory.Exists(stringDir))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(stringDir);
|
||||||
|
}
|
||||||
|
|
||||||
internal static void LoadDefaultTextures()
|
string translationStringRegex = System.Text.Json.JsonSerializer.Serialize(StringStore.translationStringRegex, new JsonSerializerOptions
|
||||||
{
|
{
|
||||||
string textureDefaultDir = Path.Combine(Core.Instance.modsDirectory, AssetType.Dumps.ToString(), "Default Textures [Do Not Remove]");
|
WriteIndented = true,
|
||||||
if (!Directory.Exists(textureDefaultDir))
|
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
|
||||||
{
|
});
|
||||||
Directory.CreateDirectory(textureDefaultDir);
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
foreach (string filepath in Directory.EnumerateFiles(textureDefaultDir, "*.png", SearchOption.AllDirectories))
|
|
||||||
{
|
|
||||||
#if OBFUSCATE
|
|
||||||
if (CheckSumStore.IsModified(filepath))
|
|
||||||
{
|
|
||||||
Log.LogError("File {0} was modified!" , filepath);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Texture2D texture2D = Utils.LoadImage(filepath);
|
File.WriteAllText(Path.Combine(stringDir, "translation_regexs.json"), translationStringRegex);
|
||||||
TextureStore.textureDict[Path.GetFileNameWithoutExtension(filepath)] = filepath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
catch (Exception e)
|
string translationString = System.Text.Json.JsonSerializer.Serialize(StringStore.translationString, new JsonSerializerOptions
|
||||||
{
|
{
|
||||||
Log.LogError("Error loading Texture.");
|
WriteIndented = true,
|
||||||
Log.LogError(e.GetType() + " " + e.Message);
|
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
|
||||||
}
|
});
|
||||||
}
|
|
||||||
|
|
||||||
internal static void LoadCustomTextures()
|
File.WriteAllText(Path.Combine(stringDir, "translation_strings.json"), translationString);
|
||||||
{
|
}
|
||||||
string texturePackDir = Path.Combine(Core.Instance.modsDirectory, "[Custom Textures]");
|
|
||||||
|
|
||||||
if (!Directory.Exists(texturePackDir))
|
public static void DumpJson()
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(texturePackDir);
|
string dumpDir = GetAssetDir(AssetType.Dumps);
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
foreach (string filepath in Directory.EnumerateFiles(texturePackDir, "*.png", SearchOption.AllDirectories))
|
|
||||||
{
|
|
||||||
#if OBFUSCATE
|
|
||||||
if (CheckSumStore.IsModified(filepath))
|
|
||||||
{
|
|
||||||
Log.LogError("File {0} was modified!" , filepath);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Texture2D texture2D = Utils.LoadImage(filepath);
|
if (!Directory.Exists(dumpDir))
|
||||||
TextureStore.textureDict[Path.GetFileNameWithoutExtension(filepath)] = filepath;
|
{
|
||||||
}
|
Directory.CreateDirectory(dumpDir);
|
||||||
}
|
}
|
||||||
|
string LawnStrings = Resources.Load<TextAsset>("LawnStrings").text;
|
||||||
|
string ZombieStrings = Resources.Load<TextAsset>("ZombieStrings").text;
|
||||||
|
File.WriteAllText(Path.Combine(dumpDir, "LawnStrings.json"), LawnStrings);
|
||||||
|
File.WriteAllText(Path.Combine(dumpDir, "ZombieStrings.json"), ZombieStrings);
|
||||||
|
|
||||||
catch (Exception e)
|
Dictionary<Achievement, AchievementObject> achievementsList = new Dictionary<Achievement, AchievementObject>();
|
||||||
{
|
foreach (Il2CppSystem.Collections.Generic.KeyValuePair<Achievement, Il2CppSystem.Tuple<string, string>> entry in AchievementClip.achievementsText)
|
||||||
Log.LogError("Error loading Texture.");
|
{
|
||||||
Log.LogError(e.GetType() + " " + e.Message);
|
achievementsList.Add(entry.Key, new AchievementObject(entry.Key, entry.Value.Item1, entry.Value.Item2));
|
||||||
}
|
}
|
||||||
}
|
File.WriteAllText(Path.Combine(dumpDir, "AchievementsText.json"), JsonSerializer.Serialize(achievementsList, new JsonSerializerOptions
|
||||||
|
{
|
||||||
|
WriteIndented = true,
|
||||||
|
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
internal static void SaveStrings()
|
#if DEBUG
|
||||||
{
|
public static void DumpUntranslatedStrings(string text)
|
||||||
string stringDir = GetAssetDir(AssetType.Strings, Utils.Language);
|
{
|
||||||
if (!Directory.Exists(stringDir))
|
string dumpDir = GetAssetDir(AssetType.Dumps);
|
||||||
{
|
string jsonFile = Path.Combine(dumpDir, "UntranslatedStrings.json");
|
||||||
Directory.CreateDirectory(stringDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
string translationStringRegex = JsonSerializer.Serialize(StringStore.translationStringRegex, new JsonSerializerOptions
|
if (!Directory.Exists(dumpDir))
|
||||||
{
|
{
|
||||||
WriteIndented = true,
|
Directory.CreateDirectory(dumpDir);
|
||||||
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
|
}
|
||||||
});
|
|
||||||
|
|
||||||
File.WriteAllText(Path.Combine(stringDir, "translation_regexs.json"), translationStringRegex);
|
if (!File.Exists(jsonFile))
|
||||||
|
{
|
||||||
|
File.WriteAllText(jsonFile, "{}"); // Initialize empty JSON object
|
||||||
|
}
|
||||||
|
|
||||||
string translationString = JsonSerializer.Serialize(StringStore.translationString, new JsonSerializerOptions
|
string json = File.ReadAllText(jsonFile);
|
||||||
{
|
var untranslatedStrings = JsonSerializer.Deserialize<Dictionary<string, string>>(json);
|
||||||
WriteIndented = true,
|
|
||||||
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
|
|
||||||
});
|
|
||||||
|
|
||||||
File.WriteAllText(Path.Combine(stringDir, "translation_strings.json"), translationString);
|
if (!untranslatedStrings.ContainsKey(text))
|
||||||
}
|
{
|
||||||
|
untranslatedStrings[text] = text;
|
||||||
|
var options = new JsonSerializerOptions
|
||||||
|
{
|
||||||
|
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
|
||||||
|
WriteIndented = true
|
||||||
|
};
|
||||||
|
File.WriteAllText(jsonFile, JsonSerializer.Serialize(untranslatedStrings, options));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if DEBUG
|
#if MULTI_LANGUAGE
|
||||||
public static void DumpJson()
|
internal static void LoadLanguage()
|
||||||
{
|
{
|
||||||
string dumpDir = GetAssetDir(AssetType.Dumps);
|
try
|
||||||
|
{
|
||||||
|
// Load the language preference as a string and parse it into the enum
|
||||||
|
ConfigEntry<string> languageEntry;
|
||||||
|
Core.Instance.Config.TryGetEntry<string>(new ConfigDefinition("PvZ_Fusion_Translator", "Language"), out languageEntry);
|
||||||
|
string languageName = languageEntry.Value;
|
||||||
|
if (Enum.TryParse(languageName, out Utils.LanguageEnum loadedLanguage))
|
||||||
|
{
|
||||||
|
Utils.Language = loadedLanguage;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Log.LogWarning($"Invalid language '{languageName}' found in preferences. Falling back to English.");
|
||||||
|
Utils.Language = Utils.LanguageEnum.English; // Default fallback
|
||||||
|
}
|
||||||
|
Log.LogWarning($"Loaded language {languageName}");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Log.LogError("Error loading language setting.");
|
||||||
|
Log.LogError($"{e.GetType()} {e.Message}");
|
||||||
|
}
|
||||||
|
Log.LogInfo($"Language has been loaded: {Utils.Language}");
|
||||||
|
}
|
||||||
|
|
||||||
if (!Directory.Exists(dumpDir))
|
internal static void SaveLanguage()
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(dumpDir);
|
try
|
||||||
}
|
{
|
||||||
string LawnStrings = Resources.Load<TextAsset>("LawnStrings").text;
|
// Save the current language as a string
|
||||||
string ZombieStrings = Resources.Load<TextAsset>("ZombieStrings").text;
|
ConfigEntry<string> languageEntry;
|
||||||
File.WriteAllText(Path.Combine(dumpDir, "LawnStrings.json"), LawnStrings);
|
Core.Instance.Config.TryGetEntry<string>(new ConfigDefinition("PvZ_Fusion_Translator", "Language"), out languageEntry);
|
||||||
File.WriteAllText(Path.Combine(dumpDir, "ZombieStrings.json"), ZombieStrings);
|
languageEntry.Value = Utils.Language.ToString();
|
||||||
|
Core.Instance.Config.Save();
|
||||||
|
|
||||||
Dictionary<Achievement, AchievementObject> achievementsList = new Dictionary<Achievement, AchievementObject>();
|
// Ensure changes are written to the config file
|
||||||
foreach (Il2CppSystem.Collections.Generic.KeyValuePair<Achievement, Il2CppSystem.Tuple<string, string>> entry in AchievementClip.achievementsText)
|
// MelonPreferences.Save();
|
||||||
{
|
}
|
||||||
achievementsList.Add(entry.Key, new AchievementObject(entry.Key, entry.Value.Item1, entry.Value.Item2));
|
catch (Exception e)
|
||||||
}
|
{
|
||||||
File.WriteAllText(Path.Combine(dumpDir, "AchievementsText.json"), JsonSerializer.Serialize(achievementsList, new JsonSerializerOptions
|
Log.LogError("Error saving language setting.");
|
||||||
{
|
Log.LogError($"{e.GetType()} {e.Message}");
|
||||||
WriteIndented = true,
|
}
|
||||||
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
|
// Log.LogInfo($"Language has been saved: {Utils.Language}");
|
||||||
}));
|
}
|
||||||
}
|
#endif
|
||||||
#endif
|
}
|
||||||
|
|
||||||
#if DEBUG && MELON
|
|
||||||
public static void DumpUntranslatedStrings(string text)
|
|
||||||
{
|
|
||||||
string dumpDir = GetAssetDir(AssetType.Dumps);
|
|
||||||
string jsonFile = Path.Combine(dumpDir, "UntranslatedStrings.json");
|
|
||||||
|
|
||||||
if (!Directory.Exists(dumpDir))
|
|
||||||
{
|
|
||||||
Directory.CreateDirectory(dumpDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!File.Exists(jsonFile))
|
|
||||||
{
|
|
||||||
File.WriteAllText(jsonFile, "{}"); // Initialize empty JSON object
|
|
||||||
}
|
|
||||||
|
|
||||||
string json = File.ReadAllText(jsonFile);
|
|
||||||
JObject untranslatedStrings = JObject.Parse(json);
|
|
||||||
|
|
||||||
if (!untranslatedStrings.ContainsKey(text))
|
|
||||||
{
|
|
||||||
untranslatedStrings[text] = text;
|
|
||||||
File.WriteAllText(jsonFile, untranslatedStrings.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
internal static void LoadLanguage()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Load the language preference as a string and parse it into the enum
|
|
||||||
string languageName = Core.Instance.configLanguage.Value;
|
|
||||||
if (Enum.TryParse(languageName, out Utils.LanguageEnum loadedLanguage))
|
|
||||||
{
|
|
||||||
Utils.Language = loadedLanguage;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Log.LogWarning($"Invalid language '{languageName}' found in preferences. Falling back to English.");
|
|
||||||
Utils.Language = Utils.LanguageEnum.English; // Default fallback
|
|
||||||
}
|
|
||||||
Log.LogWarning($"Loaded language {languageName}");
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Log.LogError("Error loading language setting.");
|
|
||||||
Log.LogError($"{e.GetType()} {e.Message}");
|
|
||||||
}
|
|
||||||
Log.LogInfo($"Language has been loaded: {Utils.Language}");
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static void SaveLanguage()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Save the current language as a string
|
|
||||||
if (Core.Instance.Config.TryGetEntry<string>("PvZ_Fusion_Translator", "Language", out var languageEntry))
|
|
||||||
{
|
|
||||||
languageEntry.Value = Utils.Language.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure changes are written to the config file
|
|
||||||
// MelonPreferences.Save();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Log.LogError("Error saving language setting.");
|
|
||||||
Log.LogError($"{e.GetType()} {e.Message}");
|
|
||||||
}
|
|
||||||
// Log.LogInfo($"Language has been saved: {Utils.Language}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
using System;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace PvZ_Fusion_Translator__BepInEx_.Patches.BaseTextObjects
|
namespace PvZ_Fusion_Translator__BepInEx_.Patches.BaseTextObjects
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
|
||||||
using TMPro;
|
using TMPro;
|
||||||
|
|
||||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.TextCore.Text;
|
using UnityEngine.TextCore.Text;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
|
||||||
using TMPro;
|
using TMPro;
|
||||||
|
|
||||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.TextCore.Text;
|
using UnityEngine.TextCore.Text;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Collections.Generic;
|
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
using System.Collections.Generic;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
using UnityEngine.TextCore.Text;
|
using UnityEngine.TextCore.Text;
|
||||||
|
|
@ -22,7 +21,7 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||||
TextMeshProUGUI upgradeCostText = __instance.transform.FindChild("UpgradeCost").GetComponent<TextMeshProUGUI>();
|
TextMeshProUGUI upgradeCostText = __instance.transform.FindChild("UpgradeCost").GetComponent<TextMeshProUGUI>();
|
||||||
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||||
|
|
||||||
string regexStr = "【([^\\s]+)】\n当前等级:([^\\s]+)\n\n升级条件:\n([^\\s]+)\n\n升级消耗:([^\\s]+)";
|
string regexStr = "([^\\s]+)\n当前等级:([^\\s]+)\n\n升级条件:\n([^\\s]+)\n\n升级消耗:([^\\s]+)";
|
||||||
|
|
||||||
Regex regex = new Regex(regexStr);
|
Regex regex = new Regex(regexStr);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
|
||||||
using TMPro;
|
using TMPro;
|
||||||
|
|
||||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.TextCore.Text;
|
using UnityEngine.TextCore.Text;
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,15 @@
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
|
||||||
using TMPro;
|
using TMPro;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
using Unity.VisualScripting;
|
using Unity.VisualScripting;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
|
||||||
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||||
{
|
{
|
||||||
[HarmonyPatch(typeof(AbyssMenu))]
|
[HarmonyPatch(typeof(AbyssMenu))]
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
|
||||||
using TMPro;
|
using TMPro;
|
||||||
|
using System.Collections.Generic;
|
||||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
using Unity.VisualScripting;
|
using Unity.VisualScripting;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||||
{
|
{
|
||||||
|
|
@ -19,45 +18,36 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||||
{
|
{
|
||||||
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||||
|
|
||||||
string regexStr1 = "第(\\d+)关\n通关用时:(\\d+)分(\\d+)秒\n杀敌数量:(\\d+)\n关卡叶绿素产出:(\\d+)\n极限模式产出:(\\d+)\n非首胜无额外产出\n产出叶绿素总计:(\\d+)\n";
|
string[] regexStrList = [
|
||||||
string regexStr2 = "第(\\d+)关\n通关用时:(\\d+)分(\\d+)秒\n杀敌数量:(\\d+)\n关卡叶绿素产出:(\\d+)\n极限模式产出:(\\d+)\n首胜产出:(\\d+)\n剩余小推车数量:(\\d+),获得叶绿素:(\\d+)\n产出叶绿素总计:(\\d+)";
|
"第(\\d+)关\n通关用时:(\\d+)分(\\d+)秒\n杀敌数量:(\\d+)\n关卡叶绿素产出:(\\d+)\n极限模式产出:(\\d+)\n非首胜无额外产出\n产出叶绿素总计:(\\d+)",
|
||||||
|
"第(\\d+)关\n通关用时:(\\d+)分(\\d+)秒\n杀敌数量:(\\d+)\n关卡叶绿素产出:(\\d+)\n极限模式产出:(\\d+)\n首胜产出:(\\d+)\n剩余小推车数量:(\\d+),获得叶绿素:(\\d+)\n产出叶绿素总计:(\\d+)",
|
||||||
|
"第(\\d+)关\n通关用时:(\\d+)分(\\d+)秒\n杀敌数量:(\\d+)\n关卡叶绿素产出:(\\d+)\n首胜产出:(\\d+)\n剩余小推车数量:(\\d+),获得叶绿素:(\\d+)\n产出叶绿素总计:(\\d+)",
|
||||||
|
"第(\\d+)关\n通关用时:(\\d+)分(\\d+)秒\n杀敌数量:(\\d+)\n关卡叶绿素产出:(\\d+)\n困难模式产出:(\\d+)\n首胜产出:(\\d+)\n剩余小推车数量:(\\d+),获得叶绿素:(\\d+)\n产出叶绿素总计:(\\d+)",
|
||||||
|
"第(\\d+)关\n通关用时:(\\d+)分(\\d+)秒\n杀敌数量:(\\d+)\n关卡叶绿素产出:(\\d+)\n非首胜无额外产出\n产出叶绿素总计:(\\d+)",
|
||||||
|
"第(\\d+)关\n通关用时:(\\d+)分(\\d+)秒\n杀敌数量:(\\d+)\n关卡叶绿素产出:(\\d+)\n困难模式产出:(\\d+)\n非首胜无额外产出\n产出叶绿素总计:(\\d+)"
|
||||||
|
];
|
||||||
|
|
||||||
Regex regex1 = new Regex(regexStr1);
|
foreach(string regexStr in regexStrList)
|
||||||
Regex regex2 = new Regex(regexStr2);
|
|
||||||
|
|
||||||
if (regex1.IsMatch(__instance.settleInfo.text))
|
|
||||||
{
|
{
|
||||||
Match match = regex1.Match(__instance.settleInfo.text);
|
Regex regex = new Regex(regexStr);
|
||||||
int groupCount = match.Groups.Count;
|
|
||||||
|
|
||||||
List<string> dynamicParts = [];
|
if (regex.IsMatch(__instance.settleInfo.text))
|
||||||
|
|
||||||
for (int i = 1; i < groupCount; i++)
|
|
||||||
{
|
{
|
||||||
string groupValue = match.Groups[i].Value;
|
Match match = regex.Match(__instance.settleInfo.text);
|
||||||
string translatedValue = StringStore.translationString.ContainsKey(groupValue) ? StringStore.translationString[groupValue] : groupValue;
|
int groupCount = match.Groups.Count;
|
||||||
dynamicParts.Add(translatedValue);
|
|
||||||
|
List<string> dynamicParts = [];
|
||||||
|
|
||||||
|
for (int i = 1; i < groupCount; i++)
|
||||||
|
{
|
||||||
|
string groupValue = match.Groups[i].Value;
|
||||||
|
string translatedValue = StringStore.translationString.ContainsKey(groupValue) ? StringStore.translationString[groupValue] : groupValue;
|
||||||
|
dynamicParts.Add(translatedValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
__instance.settleInfo.text = string.Format(StringStore.translationStringRegex[regexStr], [.. dynamicParts]);
|
||||||
|
__instance.settleInfo.font = fontAsset;
|
||||||
}
|
}
|
||||||
|
|
||||||
__instance.settleInfo.text = string.Format(StringStore.translationStringRegex[regexStr1], [.. dynamicParts]);
|
|
||||||
__instance.settleInfo.font = fontAsset;
|
|
||||||
}
|
|
||||||
else if (regex2.IsMatch(__instance.settleInfo.text))
|
|
||||||
{
|
|
||||||
Match match = regex2.Match(__instance.settleInfo.text);
|
|
||||||
int groupCount = match.Groups.Count;
|
|
||||||
|
|
||||||
List<string> dynamicParts = [];
|
|
||||||
|
|
||||||
for (int i = 1; i < groupCount; i++)
|
|
||||||
{
|
|
||||||
string groupValue = match.Groups[i].Value;
|
|
||||||
string translatedValue = StringStore.translationString.ContainsKey(groupValue) ? StringStore.translationString[groupValue] : groupValue;
|
|
||||||
dynamicParts.Add(translatedValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
__instance.settleInfo.text = string.Format(StringStore.translationStringRegex[regexStr2], [.. dynamicParts]);
|
|
||||||
__instance.settleInfo.font = fontAsset;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ using HarmonyLib;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using MelonLoader;
|
|
||||||
|
|
||||||
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.ButtonObjects
|
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.ButtonObjects
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
|
||||||
using TMPro;
|
using TMPro;
|
||||||
|
|
||||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
|
||||||
using TMPro;
|
using TMPro;
|
||||||
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.ButtonObjects
|
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.ButtonObjects
|
||||||
|
|
@ -30,6 +31,11 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.ButtonObjects
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
foreach(TextMeshProUGUI text in __instance.transform.GetComponentsInChildren<TextMeshProUGUI>())
|
||||||
|
{
|
||||||
|
text.text = StringStore.TranslateText(text.text);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,30 @@
|
||||||
#if MULTI_LANGUAGE
|
#if MULTI_LANGUAGE
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using PvZ_Fusion_Translator__BepInEx_;
|
using PvZ_Fusion_Translator__BepInEx_;
|
||||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.UIElements;
|
||||||
using Object = UnityEngine.Object;
|
using Object = UnityEngine.Object;
|
||||||
|
using BepInEx.Configuration;
|
||||||
|
using BepInEx;
|
||||||
|
using UnityEngine.Experimental.Rendering.RenderGraphModule;
|
||||||
|
using BepInEx.Unity.IL2CPP.Utils;
|
||||||
|
using Unity.VisualScripting.FullSerializer;
|
||||||
|
|
||||||
public class OptionButtonData
|
public class OptionButtonData
|
||||||
{
|
{
|
||||||
public OptionBtn Button { get; set; }
|
public OptionBtn Button { get; set; }
|
||||||
public Vector3 Position { get; set; }
|
public Vector3 Position { get; set; }
|
||||||
public Utils.LanguageEnum? Language { get; set; } // Null if it's the "Next" button
|
public Utils.LanguageEnum? Language { get; set; } // Null if it's the "Next" button
|
||||||
|
public Utils.ToggleEnum? Toggle { get; set; } // Null if it's the "Next" button
|
||||||
public bool IsNextButton { get; set; }
|
public bool IsNextButton { get; set; }
|
||||||
|
public bool shifted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.ButtonObjects
|
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.ButtonObjects
|
||||||
|
|
@ -24,19 +32,27 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.ButtonObjects
|
||||||
internal class OptLanguageBtn_Patch
|
internal class OptLanguageBtn_Patch
|
||||||
{
|
{
|
||||||
public static Dictionary<int, OptionButtonData> LanguageBtnDict = new();
|
public static Dictionary<int, OptionButtonData> LanguageBtnDict = new();
|
||||||
private static bool buttonsCreated = false;
|
public static Dictionary<int, OptionButtonData> ToggleBtnDict = new();
|
||||||
private static OptionBtn cachedTemplateButton;
|
private static bool buttonsCreated = false;
|
||||||
|
private static bool togglesCreated = false;
|
||||||
|
private static OptionBtn cachedTemplateButton;
|
||||||
|
private static OptionBtn cachedTemplateToggleButton;
|
||||||
|
|
||||||
private const float startX = 4.3241f + 2.56f;
|
private const float startX = 4.3241f + 2.56f;
|
||||||
private const float startY = 2.7769f;
|
private const float startY = 2.7769f;
|
||||||
private const float ySpacing = 1.2505f;
|
private const float ySpacing = 1.2505f;
|
||||||
|
|
||||||
private static List<Utils.LanguageEnum> AvailableLanguages;
|
private const float toggleStartX = 4.3241f;
|
||||||
private const int LanguagesPerPage = 5;
|
private const float toggleStartY = -2.2251f;
|
||||||
|
|
||||||
|
private static List<Utils.LanguageEnum> AvailableLanguages;
|
||||||
|
private static List<Utils.ToggleEnum> AvailableToggles;
|
||||||
|
private const int LanguagesPerPage = 5;
|
||||||
private static int currentPage = 0;
|
private static int currentPage = 0;
|
||||||
private static OptionBtn[] buttonSlots = new OptionBtn[6]; // 5 language buttons + 1 next button
|
private static OptionBtn[] buttonSlots = new OptionBtn[6]; // 5 language buttons + 1 next button
|
||||||
|
private static OptionBtn[] toggleSlots = new OptionBtn[2];
|
||||||
|
|
||||||
public static void CreateLanguageButtons(OptionBtn templateButton)
|
public static void CreateLanguageButtons(OptionBtn templateButton)
|
||||||
{
|
{
|
||||||
if (buttonsCreated) return;
|
if (buttonsCreated) return;
|
||||||
buttonsCreated = true;
|
buttonsCreated = true;
|
||||||
|
|
@ -68,12 +84,45 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.ButtonObjects
|
||||||
UpdatePage();
|
UpdatePage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void CreateToggleButtons(OptionBtn templateButton)
|
||||||
|
{
|
||||||
|
if (togglesCreated) return;
|
||||||
|
togglesCreated = true;
|
||||||
|
cachedTemplateToggleButton = templateButton;
|
||||||
|
|
||||||
|
AvailableToggles = Enum.GetValues(typeof(Utils.ToggleEnum))
|
||||||
|
.Cast<Utils.ToggleEnum>()
|
||||||
|
.Where(lang => lang != Utils.ToggleEnum.TOGGLE_END)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
var newButton = Object.Instantiate(templateButton, templateButton.transform.parent);
|
||||||
|
newButton.optionType = 100 + i;
|
||||||
|
|
||||||
|
float yPos = toggleStartY - i * ySpacing;
|
||||||
|
Vector3 pos = new(toggleStartX, yPos);
|
||||||
|
newButton.transform.position = pos;
|
||||||
|
|
||||||
|
toggleSlots[i] = newButton;
|
||||||
|
|
||||||
|
ToggleBtnDict[newButton.GetInstanceID()] = new OptionButtonData
|
||||||
|
{
|
||||||
|
Button = newButton,
|
||||||
|
Position = pos
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdatePage();
|
||||||
|
}
|
||||||
|
|
||||||
private static void UpdatePage()
|
private static void UpdatePage()
|
||||||
{
|
{
|
||||||
int startIndex = currentPage * LanguagesPerPage;
|
int startIndex = currentPage * LanguagesPerPage;
|
||||||
int langCount = AvailableLanguages.Count;
|
int langCount = AvailableLanguages.Count;
|
||||||
|
int toggleCount = (togglesCreated) ? AvailableToggles.Count : 0;
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++)
|
for (int i = 0; i < 5; i++)
|
||||||
{
|
{
|
||||||
var btn = buttonSlots[i];
|
var btn = buttonSlots[i];
|
||||||
var data = LanguageBtnDict[btn.GetInstanceID()];
|
var data = LanguageBtnDict[btn.GetInstanceID()];
|
||||||
|
|
@ -94,6 +143,30 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.ButtonObjects
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (togglesCreated)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
var btn = toggleSlots[i];
|
||||||
|
var data = ToggleBtnDict[btn.GetInstanceID()];
|
||||||
|
|
||||||
|
if (i < toggleCount)
|
||||||
|
{
|
||||||
|
var toggle = AvailableToggles[i];
|
||||||
|
data.Toggle = toggle;
|
||||||
|
data.IsNextButton = false;
|
||||||
|
btn.gameObject.SetActive(true);
|
||||||
|
UpdateButtonText(btn, toggle.ToString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data.Language = null;
|
||||||
|
data.IsNextButton = false;
|
||||||
|
btn.gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// "Next" button always visible at index 5
|
// "Next" button always visible at index 5
|
||||||
var nextBtn = buttonSlots[5];
|
var nextBtn = buttonSlots[5];
|
||||||
var nextData = LanguageBtnDict[nextBtn.GetInstanceID()];
|
var nextData = LanguageBtnDict[nextBtn.GetInstanceID()];
|
||||||
|
|
@ -134,15 +207,28 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.ButtonObjects
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void FlashMessage(OptionBtn button, string message)
|
private static void FlashMessage(OptionBtn button, string message, float yShift = 0.0f)
|
||||||
{
|
{
|
||||||
var child = button.transform.GetChild(0);
|
var child = button.transform.GetChild(0);
|
||||||
if (child != null)
|
if (child != null)
|
||||||
{
|
{
|
||||||
var text = child.GetComponent<TextMeshProUGUI>();
|
var text = child.GetComponent<TextMeshProUGUI>();
|
||||||
if (text != null)
|
if (text != null)
|
||||||
{
|
{
|
||||||
text.text = message;
|
text.text = message;
|
||||||
|
OptionButtonData data;
|
||||||
|
bool isToggle = ToggleBtnDict.TryGetValue(button.GetInstanceID(), out data);
|
||||||
|
|
||||||
|
if(isToggle)
|
||||||
|
{
|
||||||
|
text.transform.position = new Vector3(text.transform.position.x, text.transform.position.y + (ToggleBtnDict[button.GetInstanceID()].shifted ? 0.0f : yShift), text.transform.position.z);
|
||||||
|
ToggleBtnDict[button.GetInstanceID()].shifted = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
text.transform.position = new Vector3(text.transform.position.x, text.transform.position.y + (LanguageBtnDict[button.GetInstanceID()].shifted ? 0.0f : yShift), text.transform.position.z);
|
||||||
|
LanguageBtnDict[button.GetInstanceID()].shifted = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
child.gameObject.SetActive(true);
|
child.gameObject.SetActive(true);
|
||||||
|
|
||||||
|
|
@ -156,6 +242,30 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.ButtonObjects
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void ToggleCustomAssets(string type)
|
||||||
|
{
|
||||||
|
if (type != "Textures" && type != "Audio") return;
|
||||||
|
|
||||||
|
if(type == "Textures")
|
||||||
|
{
|
||||||
|
Utils.customTextures = !Utils.customTextures;
|
||||||
|
ConfigEntry<bool> customTexturesEntry;
|
||||||
|
Core.Instance.Config.TryGetEntry<bool>(new ConfigDefinition("PvZ_Fusion_Translator", "DefaultTextures"), out customTexturesEntry);
|
||||||
|
customTexturesEntry.BoxedValue = !Utils.customTextures;
|
||||||
|
TextureStore.Reload();
|
||||||
|
Coroutine replaceTextureRoutine = Core.MonoInstance.StartCoroutine(TextureStore.ReplaceTexturesCoroutine());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == "Audio")
|
||||||
|
{
|
||||||
|
Utils.customAudio = !Utils.customAudio;
|
||||||
|
ConfigEntry<bool> customAudioEntry;
|
||||||
|
Core.Instance.Config.TryGetEntry<bool>(new ConfigDefinition("PvZ_Fusion_Translator", "DefaultAudio"), out customAudioEntry);
|
||||||
|
customAudioEntry.BoxedValue = !Utils.customAudio;
|
||||||
|
}
|
||||||
|
Core.Instance.Config.Save();
|
||||||
|
}
|
||||||
|
|
||||||
[HarmonyPatch(typeof(OptionBtn))]
|
[HarmonyPatch(typeof(OptionBtn))]
|
||||||
public static class OptLangBtn_Patch
|
public static class OptLangBtn_Patch
|
||||||
{
|
{
|
||||||
|
|
@ -166,8 +276,10 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.ButtonObjects
|
||||||
if (!buttonsCreated || cachedTemplateButton == null)
|
if (!buttonsCreated || cachedTemplateButton == null)
|
||||||
{
|
{
|
||||||
buttonsCreated = false;
|
buttonsCreated = false;
|
||||||
CreateLanguageButtons(__instance);
|
togglesCreated = false;
|
||||||
}
|
CreateLanguageButtons(__instance);
|
||||||
|
CreateToggleButtons(__instance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPatch("OnMouseUpAsButton")]
|
[HarmonyPatch("OnMouseUpAsButton")]
|
||||||
|
|
@ -199,7 +311,21 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.ButtonObjects
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (ToggleBtnDict.TryGetValue(__instance.GetInstanceID(), out var toggleData))
|
||||||
|
{
|
||||||
|
string toggleType = toggleData.Toggle.ToString();
|
||||||
|
ToggleCustomAssets(toggleType);
|
||||||
|
if (toggleType == "Textures")
|
||||||
|
{
|
||||||
|
FlashMessage(toggleData.Button, "<size=10>Toggled custom textures!", 0.1f);
|
||||||
|
}
|
||||||
|
else if (toggleType == "Audio")
|
||||||
|
{
|
||||||
|
FlashMessage(toggleData.Button, "<size=10>Toggled custom audio!", 0.1f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[HarmonyPatch(nameof(OptionBtn.Update))]
|
[HarmonyPatch(nameof(OptionBtn.Update))]
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
|
|
@ -209,7 +335,12 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.ButtonObjects
|
||||||
{
|
{
|
||||||
btnData.Button.transform.position = btnData.Position;
|
btnData.Button.transform.position = btnData.Position;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (ToggleBtnDict.TryGetValue(__instance.GetInstanceID(), out var toggleData))
|
||||||
|
{
|
||||||
|
toggleData.Button.transform.position = toggleData.Position;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
|
||||||
using TMPro;
|
|
||||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
|
@ -9,12 +8,17 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||||
[HarmonyPatch(typeof(MainMenu))]
|
[HarmonyPatch(typeof(MainMenu))]
|
||||||
public class MainMenu_Patch
|
public class MainMenu_Patch
|
||||||
{
|
{
|
||||||
|
private static bool _warningShown = false;
|
||||||
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(nameof(MainMenu.FixedUpdate))]
|
[HarmonyPatch(nameof(MainMenu.FixedUpdate))]
|
||||||
private static void FixedUpdate(MainMenu __instance)
|
private static void FixedUpdate(MainMenu __instance)
|
||||||
{
|
{
|
||||||
NoticeMenu noticeMenu = NoticeMenu.Instance;
|
if (_warningShown || NoticeMenu.Instance == null)
|
||||||
WarningStore.WarningReload(Utils.Language, noticeMenu);
|
return;
|
||||||
|
|
||||||
|
WarningStore.WarningReload(Utils.Language, NoticeMenu.Instance);
|
||||||
|
_warningShown = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
|
||||||
using TMPro;
|
|
||||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
|
|
||||||
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.MinorObjects
|
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.MinorObjects
|
||||||
|
|
|
||||||
20
BepInEx/Patches/GameObjects/OtherMenu_Patch.cs
Normal file
20
BepInEx/Patches/GameObjects/OtherMenu_Patch.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
using HarmonyLib;
|
||||||
|
|
||||||
|
using TMPro;
|
||||||
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||||
|
{
|
||||||
|
[HarmonyPatch(typeof(OtherMenu))]
|
||||||
|
public static class OtherMenu_Patch
|
||||||
|
{
|
||||||
|
[HarmonyPatch(nameof(OtherMenu.UpdateText))]
|
||||||
|
[HarmonyPostfix]
|
||||||
|
private static void UpdateText(OtherMenu __instance)
|
||||||
|
{
|
||||||
|
__instance.text1 = StringStore.TranslateText(__instance.text1);
|
||||||
|
__instance.text2 = StringStore.TranslateText(__instance.text2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -14,6 +14,27 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||||
{
|
{
|
||||||
__instance.introduce.text = StringStore.TranslateText(__instance.introduce.text);
|
__instance.introduce.text = StringStore.TranslateText(__instance.introduce.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(nameof(TravelBuffOptionButton.Awake))]
|
||||||
|
[HarmonyPostfix]
|
||||||
|
private static void Awake(TravelBuffOptionButton __instance)
|
||||||
|
{
|
||||||
|
__instance.introduce.text = StringStore.TranslateText(__instance.introduce.text);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(nameof(TravelBuffOptionButton.OnAnimOver))]
|
||||||
|
[HarmonyPostfix]
|
||||||
|
private static void OnAnimOver(TravelBuffOptionButton __instance)
|
||||||
|
{
|
||||||
|
__instance.introduce.text = StringStore.TranslateText(__instance.introduce.text);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(nameof(TravelBuffOptionButton.SetBackground))]
|
||||||
|
[HarmonyPostfix]
|
||||||
|
private static void SetBackground(TravelBuffOptionButton __instance)
|
||||||
|
{
|
||||||
|
__instance.introduce.text = StringStore.TranslateText(__instance.introduce.text);
|
||||||
|
}
|
||||||
//[HarmonyPatch(nameof(TravelMenuMgr.SetText))]
|
//[HarmonyPatch(nameof(TravelMenuMgr.SetText))]
|
||||||
//[HarmonyPostfix]
|
//[HarmonyPostfix]
|
||||||
//private static void SetText(TravelMenuMgr __instance)
|
//private static void SetText(TravelMenuMgr __instance)
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
using System;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||||
{
|
{
|
||||||
|
|
@ -24,7 +23,12 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||||
{
|
{
|
||||||
StringStore.TranslateTextTransform(moneyTransform);
|
StringStore.TranslateTextTransform(moneyTransform);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
foreach (TextMeshProUGUI text in __instance.points)
|
||||||
|
{
|
||||||
|
text.text = StringStore.TranslateText(text.text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[HarmonyPatch(nameof(TravelStore.SetText), new Type[] { typeof(string)})]
|
[HarmonyPatch(nameof(TravelStore.SetText), new Type[] { typeof(string)})]
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
|
|
@ -34,6 +38,11 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||||
{
|
{
|
||||||
text.text = StringStore.TranslateText(text.text);
|
text.text = StringStore.TranslateText(text.text);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
foreach (TextMeshProUGUI text in __instance.points)
|
||||||
|
{
|
||||||
|
text.text = StringStore.TranslateText(text.text);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,7 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||||
|
|
||||||
#if MULTI_LANGUAGE
|
#if MULTI_LANGUAGE
|
||||||
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||||
string difficultyText = StringStore.patchesStore["Difficulty"][Utils.Language.ToString()];
|
__instance.t.text = StringStore.TranslateText(__instance.t.text);
|
||||||
__instance.t.text = string.Format(difficultyText + " {0}", GameAPP.difficulty);
|
|
||||||
#else
|
#else
|
||||||
TMP_FontAsset fontAsset = FontStore.LoadTMPFont();
|
TMP_FontAsset fontAsset = FontStore.LoadTMPFont();
|
||||||
string difficultyText = StringStore.patchesStore["Difficulty"]["Spanish"];
|
string difficultyText = StringStore.patchesStore["Difficulty"]["Spanish"];
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||||
|
|
||||||
#if MULTI_LANGUAGE
|
#if MULTI_LANGUAGE
|
||||||
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||||
string zombieText = StringStore.patchesStore["Zombies"][Utils.Language.ToString()];
|
string zombieText = StringStore.TranslateText(__instance.t.text);
|
||||||
__instance.t.text = string.Format(zombieText + " {0}", Board.Instance.enermyCount);
|
__instance.t.text = zombieText;
|
||||||
#else
|
#else
|
||||||
TMP_FontAsset fontAsset = FontStore.LoadTMPFont();
|
TMP_FontAsset fontAsset = FontStore.LoadTMPFont();
|
||||||
string zombieText = StringStore.patchesStore["Zombies"]["Spanish"];
|
string zombieText = StringStore.patchesStore["Zombies"]["Spanish"];
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
using System.IO;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
using static PvZ_Fusion_Translator__BepInEx_.FileLoader;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.IO;
|
using static PvZ_Fusion_Translator__BepInEx_.FileLoader;
|
||||||
|
|
||||||
namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
||||||
{
|
{
|
||||||
|
|
@ -12,8 +11,8 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
||||||
public static partial class AlmanacMgrZombie_Patch
|
public static partial class AlmanacMgrZombie_Patch
|
||||||
{
|
{
|
||||||
[HarmonyPatch(nameof(AlmanacMgrZombie.InitNameAndInfoFromJson))]
|
[HarmonyPatch(nameof(AlmanacMgrZombie.InitNameAndInfoFromJson))]
|
||||||
[HarmonyPrefix]
|
[HarmonyPostfix]
|
||||||
private static bool InitNameAndInfoFromJson(AlmanacMgrZombie __instance)
|
private static void InitNameAndInfoFromJson(AlmanacMgrZombie __instance)
|
||||||
{
|
{
|
||||||
#if MULTI_LANGUAGE
|
#if MULTI_LANGUAGE
|
||||||
string currentLanguage = Utils.Language.ToString();
|
string currentLanguage = Utils.Language.ToString();
|
||||||
|
|
@ -23,18 +22,19 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
||||||
string currentLanguage = "English";
|
string currentLanguage = "English";
|
||||||
#endif
|
#endif
|
||||||
string path = Path.Combine(almanacDir, "ZombieStringsTranslate.json");
|
string path = Path.Combine(almanacDir, "ZombieStringsTranslate.json");
|
||||||
|
string moddedPath = Path.Combine(almanacDir, "ModdedZombiesTranslate.json");
|
||||||
|
|
||||||
if (!File.Exists(path))
|
if (!File.Exists(path))
|
||||||
{
|
{
|
||||||
Log.LogError($"ZombieStringsTranslate.json file not found at path: {path}");
|
Log.LogError($"ZombieStringsTranslate.json file not found at path: {path}");
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OBFUSCATE
|
#if OBFUSCATE
|
||||||
if (CheckSumStore.IsModified(path))
|
if (CheckSumStore.IsModified(path))
|
||||||
{
|
{
|
||||||
Log.LogError("File {0} was modified!", path);
|
Log.LogError("File {0} was modified!", path);
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -78,12 +78,38 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
||||||
component.font = fontAsset;
|
component.font = fontAsset;
|
||||||
component2.font = fontAsset;
|
component2.font = fontAsset;
|
||||||
component3.font = fontAsset;
|
component3.font = fontAsset;
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
if (File.Exists(moddedPath))
|
||||||
|
{
|
||||||
|
string moddedJson;
|
||||||
|
moddedJson = File.ReadAllText(moddedPath);
|
||||||
|
|
||||||
|
AlmanacMgrZombie.ZombieAlmanacData moddedZombieData = JsonUtility.FromJson<AlmanacMgrZombie.ZombieAlmanacData>(moddedJson);
|
||||||
|
|
||||||
|
foreach (AlmanacMgrZombie.ZombieInfo zombieInfo in moddedZombieData.zombies)
|
||||||
|
{
|
||||||
|
if (zombieInfo.theZombieType == __instance.theZombieType)
|
||||||
|
{
|
||||||
|
component.text = zombieInfo.info + "\n\n" + zombieInfo.introduce;
|
||||||
|
component.overflowMode = TextOverflowModes.Page;
|
||||||
|
component2.text = zombieInfo.name;
|
||||||
|
component2.autoSizeTextContainer = true;
|
||||||
|
component3.text = Utils.RemoveColorTags(zombieInfo.name);
|
||||||
|
component3.autoSizeTextContainer = true;
|
||||||
|
|
||||||
|
if (hasAlmanacFont)
|
||||||
|
component.font = almanacFontAsset;
|
||||||
|
else
|
||||||
|
component.font = fontAsset;
|
||||||
|
component2.font = fontAsset;
|
||||||
|
component3.font = fontAsset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPatch(nameof(AlmanacMgrZombie.OnMouseDown))]
|
[HarmonyPatch(nameof(AlmanacMgrZombie.OnMouseDown))]
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
|
||||||
using TMPro;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using TMPro;
|
||||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using static PvZ_Fusion_Translator__BepInEx_.FileLoader;
|
using static PvZ_Fusion_Translator__BepInEx_.FileLoader;
|
||||||
|
|
@ -23,6 +22,7 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
||||||
string currentLanguage = "English";
|
string currentLanguage = "English";
|
||||||
#endif
|
#endif
|
||||||
string path = Path.Combine(almanacDir, "LawnStringsTranslate.json");
|
string path = Path.Combine(almanacDir, "LawnStringsTranslate.json");
|
||||||
|
string moddedPath = Path.Combine(almanacDir, "ModdedPlantsTranslate.json");
|
||||||
|
|
||||||
if (!File.Exists(path))
|
if (!File.Exists(path))
|
||||||
{
|
{
|
||||||
|
|
@ -60,23 +60,24 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
||||||
TextMeshPro component3 = __instance.plantName.transform.GetChild(0).GetComponent<TextMeshPro>();
|
TextMeshPro component3 = __instance.plantName.transform.GetChild(0).GetComponent<TextMeshPro>();
|
||||||
TextMeshPro component4 = __instance.cost.GetComponent<TextMeshPro>();
|
TextMeshPro component4 = __instance.cost.GetComponent<TextMeshPro>();
|
||||||
|
|
||||||
AlmanacPlantBank.PlantData plantData = JsonUtility.FromJson<AlmanacPlantBank.PlantData>(json);
|
AlmanacPlantBank.PlantData plantData = JsonUtility.FromJson<AlmanacPlantBank.PlantData>(json);
|
||||||
|
|
||||||
foreach (AlmanacPlantBank.PlantInfo plantInfo in plantData.plants)
|
foreach (AlmanacPlantBank.PlantInfo plantInfo in plantData.plants)
|
||||||
{
|
{
|
||||||
if (plantInfo.seedType == __instance.theSeedType)
|
if (plantInfo.seedType == __instance.theSeedType)
|
||||||
{
|
{
|
||||||
component.autoSizeTextContainer = false;
|
component.autoSizeTextContainer = false;
|
||||||
component.text = plantInfo.info + "\n\n" + plantInfo.introduce;
|
component.text = plantInfo.info + "\n\n" + plantInfo.introduce;
|
||||||
component.overflowMode = TextOverflowModes.Page;
|
component.overflowMode = TextOverflowModes.Page;
|
||||||
|
|
||||||
//fix dimensions for cost text
|
// fix dimensions for cost text
|
||||||
component.rectTransform.offsetMax = new Vector2(component.rectTransform.offsetMax.x, 27.3839f);
|
component.rectTransform.offsetMax = new Vector2(component.rectTransform.offsetMax.x, 27.3839f);
|
||||||
component.rectTransform.offsetMin = new Vector2(component.rectTransform.offsetMin.x, -29.3079f);
|
component.rectTransform.offsetMin = new Vector2(component.rectTransform.offsetMin.x, -29.3079f);
|
||||||
component.rectTransform.sizeDelta = new Vector2(component.rectTransform.sizeDelta.x, 50.917f);
|
component.rectTransform.sizeDelta = new Vector2(component.rectTransform.sizeDelta.x, 50.917f);
|
||||||
component.transform.localPosition = new Vector3(component.transform.localPosition.x, component.transform.localPosition.y + 0.15f, component.transform.localPosition.z);
|
component.transform.localPosition = new Vector3(component.transform.localPosition.x, component.transform.localPosition.y + 0.15f, component.transform.localPosition.z);
|
||||||
|
|
||||||
|
|
||||||
component2.text = plantInfo.name;
|
component2.text = plantInfo.name;
|
||||||
component2.autoSizeTextContainer = true;
|
component2.autoSizeTextContainer = true;
|
||||||
|
|
||||||
component3.text = Utils.RemoveColorTags(plantInfo.name);
|
component3.text = Utils.RemoveColorTags(plantInfo.name);
|
||||||
|
|
@ -84,7 +85,7 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
||||||
|
|
||||||
component4.text = plantInfo.cost;
|
component4.text = plantInfo.cost;
|
||||||
|
|
||||||
if (hasAlmanacFont)
|
if (hasAlmanacFont)
|
||||||
{
|
{
|
||||||
component.font = almanacFontAsset;
|
component.font = almanacFontAsset;
|
||||||
component4.font = almanacFontAsset;
|
component4.font = almanacFontAsset;
|
||||||
|
|
@ -99,10 +100,56 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (File.Exists(moddedPath))
|
||||||
|
{
|
||||||
|
string moddedJson;
|
||||||
|
moddedJson = File.ReadAllText(moddedPath);
|
||||||
|
|
||||||
|
AlmanacPlantBank.PlantData moddedPlantData = JsonUtility.FromJson<AlmanacPlantBank.PlantData>(moddedJson);
|
||||||
|
|
||||||
|
foreach (AlmanacPlantBank.PlantInfo plantInfo in moddedPlantData.plants)
|
||||||
|
{
|
||||||
|
if (plantInfo.seedType == __instance.theSeedType)
|
||||||
|
{
|
||||||
|
component.autoSizeTextContainer = false;
|
||||||
|
component.text = plantInfo.info + "\n\n" + plantInfo.introduce;
|
||||||
|
component.overflowMode = TextOverflowModes.Page;
|
||||||
|
|
||||||
|
// fix dimensions for cost text
|
||||||
|
component.rectTransform.offsetMax = new Vector2(component.rectTransform.offsetMax.x, 27.3839f);
|
||||||
|
component.rectTransform.offsetMin = new Vector2(component.rectTransform.offsetMin.x, -29.3079f);
|
||||||
|
component.rectTransform.sizeDelta = new Vector2(component.rectTransform.sizeDelta.x, 50.917f);
|
||||||
|
component.transform.localPosition = new Vector3(component.transform.localPosition.x, component.transform.localPosition.y + 0.15f, component.transform.localPosition.z);
|
||||||
|
|
||||||
|
|
||||||
|
component2.text = plantInfo.name;
|
||||||
|
component2.autoSizeTextContainer = true;
|
||||||
|
|
||||||
|
component3.text = Utils.RemoveColorTags(plantInfo.name);
|
||||||
|
component3.autoSizeTextContainer = true;
|
||||||
|
|
||||||
|
component4.text = plantInfo.cost;
|
||||||
|
|
||||||
|
if (hasAlmanacFont)
|
||||||
|
{
|
||||||
|
component.font = almanacFontAsset;
|
||||||
|
component4.font = almanacFontAsset;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
component.font = fontAsset;
|
||||||
|
component4.font = fontAsset;
|
||||||
|
}
|
||||||
|
component2.font = fontAsset;
|
||||||
|
component3.font = fontAsset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPatch(nameof(AlmanacPlantBank.OnMouseDown))]
|
[HarmonyPatch(nameof(AlmanacPlantBank.OnMouseDown))]
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
private static bool OnMouseDown(AlmanacPlantBank __instance)
|
private static bool OnMouseDown(AlmanacPlantBank __instance)
|
||||||
{
|
{
|
||||||
|
|
@ -115,15 +162,15 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPatch(nameof(AlmanacPlantBank.PVPInit))]
|
[HarmonyPatch(nameof(AlmanacPlantBank.PVPInit))]
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
private static void PVPInit(AlmanacPlantBank __instance)
|
private static void PVPInit(AlmanacPlantBank __instance)
|
||||||
{
|
{
|
||||||
TextMeshPro component = __instance.introduce.GetComponent<TextMeshPro>();
|
TextMeshPro component = __instance.introduce.GetComponent<TextMeshPro>();
|
||||||
if (component != null)
|
if (component != null)
|
||||||
{
|
{
|
||||||
component.autoSizeTextContainer = false;
|
component.autoSizeTextContainer = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
using System;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
using System.IO;
|
using HarmonyLib;
|
||||||
|
using System.IO;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using HarmonyLib;
|
|
||||||
|
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,12 @@
|
||||||
<PackageReference Include="BepInEx.PluginInfoProps" Version="2.*" />
|
<PackageReference Include="BepInEx.PluginInfoProps" Version="2.*" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
|
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
<DefineConstants>$(DefineConstants);MULTI_LANGUAGE;CHEAT;DEBUG</DefineConstants>
|
<DefineConstants>$(DefineConstants);MULTI_LANGUAGE;CHEAT;DEBUG</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
@ -75,26 +81,14 @@
|
||||||
<DefineConstants>$(DefineConstants);MULTI_LANGUAGE;OBFUSCATE</DefineConstants>
|
<DefineConstants>$(DefineConstants);MULTI_LANGUAGE;OBFUSCATE</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugMulti|AnyCPU'">
|
|
||||||
<DefineConstants>$(DefineConstants);MULTI_LANGUAGE;OBFUSCATE</DefineConstants>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMulti|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMulti|x64'">
|
||||||
<DefineConstants>$(DefineConstants);MULTI_LANGUAGE;OBFUSCATE</DefineConstants>
|
<DefineConstants>$(DefineConstants);MULTI_LANGUAGE;OBFUSCATE</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugMulti|x64'">
|
|
||||||
<DefineConstants>$(DefineConstants);MULTI_LANGUAGE;OBFUSCATE</DefineConstants>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMulti|ARM64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMulti|ARM64'">
|
||||||
<DefineConstants>$(DefineConstants);MULTI_LANGUAGE;OBFUSCATE</DefineConstants>
|
<DefineConstants>$(DefineConstants);MULTI_LANGUAGE;OBFUSCATE</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugMulti|ARM64'">
|
|
||||||
<DefineConstants>$(DefineConstants);MULTI_LANGUAGE;OBFUSCATE</DefineConstants>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseOther|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseOther|AnyCPU'">
|
||||||
<DefineConstants>$(DefineConstants);OTHER;OBFUSCATE</DefineConstants>
|
<DefineConstants>$(DefineConstants);OTHER;OBFUSCATE</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
@ -110,6 +104,83 @@
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseObfuscate|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseObfuscate|x64'">
|
||||||
<DefineConstants>$(DefineConstants);MULTI_LANGUAGE;OBFUSCATE;RELEASE</DefineConstants>
|
<DefineConstants>$(DefineConstants);MULTI_LANGUAGE;OBFUSCATE;RELEASE</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="AssetStore\CheckSumStore.cs" />
|
||||||
|
<Compile Include="AssetStore\FontStore.cs" />
|
||||||
|
<Compile Include="AssetStore\StringStore.cs" />
|
||||||
|
<Compile Include="AssetStore\TextureStore.cs" />
|
||||||
|
<Compile Include="AssetStore\WarningStore.cs" />
|
||||||
|
<Compile Include="Core.cs" />
|
||||||
|
<Compile Include="FileLoader.cs" />
|
||||||
|
<Compile Include="FontHandler.cs" />
|
||||||
|
<Compile Include="Log.cs" />
|
||||||
|
<Compile Include="ModFeatures.cs" />
|
||||||
|
<Compile Include="AssetStore\AudioStore.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\AbyssBagMenu_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\AbyssCheckInBag_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\AbyssStoreMenu_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\AbyssSettlementMenu_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\OtherMenu_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\ButtonObjects\AbyssCheckSellMenu_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\ButtonObjects\AbyssBuffButton_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\ButtonObjects\AbyssLevelEnter_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\BaseMenu_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\ButtonObjects\CustomLevelEnter_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\ButtonObjects\SaveMenuBtn_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\MainMenu_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\MinorObjects\AbyssGoods_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\MinorObjects\DY_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\MinorObjects\LanternUmbrella_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\MinorObjects\MagnetBox_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\MinorObjects\MagnetInterface_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\MinorObjects\Money_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\AbyssDevelopMenu_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\AbyssMenu2_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\AbyssMenu_Patch.cs" />
|
||||||
|
<Compile Include="Patches\Managers\CustomLevelShower_Patch.cs" />
|
||||||
|
<Compile Include="Patches\Managers\SaveMenu_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\TravelBuffOptionButton_Patch.cs" />
|
||||||
|
<Compile Include="Patches\OtherManagers\AchievementClip_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\ButtonObjects\Advanture_Btn_Patch.cs" />
|
||||||
|
<Compile Include="Patches\Managers\AlmanacMgrZombie_Patch.cs" />
|
||||||
|
<Compile Include="Patches\Managers\AlmanacPlantBank_Patch.cs" />
|
||||||
|
<Compile Include="Patches\Managers\DifficultyMgr_Patch.cs" />
|
||||||
|
<Compile Include="Patches\Managers\EndlessMgr_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\ButtonObjects\EveBtn_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\GardenPlant_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\Close_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\CustomSettings_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\CustomSun_Patch.cs" />
|
||||||
|
<Compile Include="Patches\OtherManagers\GardenUI_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\NoticePauseMenu_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\ButtonObjects\InGameBtn_Patch.cs" />
|
||||||
|
<Compile Include="Patches\BaseTextObjects\InGameText_Patch.cs" />
|
||||||
|
<Compile Include="Patches\Managers\InGameUIMgr_Patch.cs" />
|
||||||
|
<Compile Include="Patches\Managers\IZEMgr_Patch.cs" />
|
||||||
|
<Compile Include="Patches\OtherManagers\MenuText_Patch.cs" />
|
||||||
|
<Compile Include="Patches\Managers\OppositeBuffManager_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\ButtonObjects\OptionBtn_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\ButtonObjects\OptLanguageBtn_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\ButtonObjects\PauseMenu_Btn_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\ButtonObjects\PVPPotBtn_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\MinorObjects\SelectYourPlants_Patch.cs" />
|
||||||
|
<Compile Include="Patches\BaseTextObjects\TextMeshPro_Patch.cs" />
|
||||||
|
<Compile Include="Patches\BaseTextObjects\TextMeshProUGUI_Patch.cs" />
|
||||||
|
<Compile Include="Patches\BaseTextObjects\TMP_InputField_Patch.cs" />
|
||||||
|
<Compile Include="Patches\Managers\TravelBuffMgr_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\TravelBuff_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\TravelRefresh_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\TravelStore_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\UIDifficulty_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\UIZombieNum_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\MinorObjects\Plant_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\MinorObjects\PlayerName_Patch.cs" />
|
||||||
|
<Compile Include="Patches\OtherManagers\ThanksMenu_Patch.cs" />
|
||||||
|
<Compile Include="Patches\Managers\UIMgr_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\MinorObjects\Zombie_Patch.cs" />
|
||||||
|
<Compile Include="Utils.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="0Harmony">
|
<Reference Include="0Harmony">
|
||||||
|
|
|
||||||
226
BepInEx/Utils.cs
226
BepInEx/Utils.cs
|
|
@ -1,128 +1,152 @@
|
||||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
using BepInEx;
|
||||||
|
using BepInEx.Configuration;
|
||||||
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using Unity.VisualScripting.FullSerializer;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Experimental.Rendering;
|
using UnityEngine.Experimental.Rendering;
|
||||||
|
|
||||||
namespace PvZ_Fusion_Translator__BepInEx_
|
namespace PvZ_Fusion_Translator__BepInEx_
|
||||||
{
|
{
|
||||||
public class Utils
|
public class Utils
|
||||||
{
|
{
|
||||||
internal static bool TryReplaceTexture2D(Texture2D ogTexture)
|
internal static bool TryReplaceTexture2D(Texture2D ogTexture)
|
||||||
{
|
{
|
||||||
if (ogTexture != null)
|
if (ogTexture != null)
|
||||||
{
|
{
|
||||||
if (TextureStore.textureDict.TryGetValue(ogTexture.name, out string texturePath))
|
if (TextureStore.textureDict.TryGetValue(ogTexture.name, out string texturePath))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ImageConversion.LoadImage(ogTexture, File.ReadAllBytes(texturePath));
|
ImageConversion.LoadImage(ogTexture, File.ReadAllBytes(texturePath));
|
||||||
|
|
||||||
Log.LogDebug("OK! Replaced Texture " + ogTexture.name);
|
Core.Log.LogDebug("OK! Replaced Texture " + ogTexture.name);
|
||||||
|
|
||||||
ogTexture.name = "replaced_" + ogTexture.name;
|
ogTexture.name = "replaced_" + ogTexture.name;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log.LogError("Failed to replace texture: " + ogTexture.name + " at path: " + texturePath);
|
Log.LogError("Failed to replace texture: " + ogTexture.name + " at path: " + texturePath);
|
||||||
Log.LogError(ex.ToString());
|
Log.LogError(ex.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static Texture2D LoadImage(string path)
|
internal static Texture2D LoadImage(string path)
|
||||||
{
|
{
|
||||||
if (!File.Exists(path))
|
if (!File.Exists(path))
|
||||||
{
|
{
|
||||||
throw new FileNotFoundException($"The image file at path '{path}' does not exist.");
|
throw new FileNotFoundException($"The image file at path '{path}' does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] array = File.ReadAllBytes(path);
|
byte[] array = File.ReadAllBytes(path);
|
||||||
Texture2D texture2D = new(2, 2, GraphicsFormat.R8G8B8A8_UNorm, TextureCreationFlags.None, 1, IntPtr.Zero, null);
|
Texture2D texture2D = new(2, 2, GraphicsFormat.R8G8B8A8_UNorm, TextureCreationFlags.None, 1, IntPtr.Zero, null);
|
||||||
ImageConversion.LoadImage(texture2D, array);
|
ImageConversion.LoadImage(texture2D, array);
|
||||||
return texture2D;
|
return texture2D;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Color HexToColor(string hex)
|
public static Color HexToColor(string hex)
|
||||||
{
|
{
|
||||||
|
|
||||||
hex = hex.Replace("#", "");
|
hex = hex.Replace("#", "");
|
||||||
|
|
||||||
float r = int.Parse(hex.Substring(0, 2), System.Globalization.NumberStyles.HexNumber) / 255f;
|
float r = int.Parse(hex.Substring(0, 2), System.Globalization.NumberStyles.HexNumber) / 255f;
|
||||||
float g = int.Parse(hex.Substring(2, 2), System.Globalization.NumberStyles.HexNumber) / 255f;
|
float g = int.Parse(hex.Substring(2, 2), System.Globalization.NumberStyles.HexNumber) / 255f;
|
||||||
float b = int.Parse(hex.Substring(4, 2), System.Globalization.NumberStyles.HexNumber) / 255f;
|
float b = int.Parse(hex.Substring(4, 2), System.Globalization.NumberStyles.HexNumber) / 255f;
|
||||||
|
|
||||||
return new Color(r, g, b);
|
return new Color(r, g, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void OpenSaveDirectory()
|
public static void OpenSaveDirectory()
|
||||||
{
|
{
|
||||||
string saveDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "AppData", "LocalLow", "LanPiaoPiao", "PlantsVsZombiesRH");
|
string saveDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "AppData", "LocalLow", "LanPiaoPiao", "PlantsVsZombiesRH");
|
||||||
Process.Start("explorer.exe", saveDirectory);
|
Process.Start("explorer.exe", saveDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void OpenTrello()
|
public static void OpenTrello()
|
||||||
{
|
{
|
||||||
string website = "https://trello.com/b/DcdT1kUp";
|
string website = "https://trello.com/b/DcdT1kUp";
|
||||||
Process.Start(new ProcessStartInfo(website) { UseShellExecute = true });
|
Process.Start(new ProcessStartInfo(website) { UseShellExecute = true });
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string RemoveColorTags(string text)
|
public static string RemoveColorTags(string text)
|
||||||
{
|
{
|
||||||
return Regex.Replace(text, @"<color=[^>]+>", "");
|
return Regex.Replace(text, @"<color=[^>]+>", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void ChangeLanguage(string language)
|
#if MULTI_LANGUAGE
|
||||||
{
|
internal static void ChangeLanguage(string language)
|
||||||
OldLanguage = Language;
|
{
|
||||||
|
OldLanguage = Language;
|
||||||
|
|
||||||
if (Enum.TryParse(language, out Utils.LanguageEnum lang))
|
if (Enum.TryParse(language, out Utils.LanguageEnum lang))
|
||||||
{
|
{
|
||||||
Utils.Language = lang;
|
Utils.Language = lang;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Handle invalid language string
|
// Handle invalid language string
|
||||||
Log.LogError($"Invalid language string: {language}");
|
Log.LogError($"Invalid language string: {language}");
|
||||||
}
|
}
|
||||||
|
|
||||||
WarningStore.isWarningMessageLoaded = false;
|
|
||||||
FontStore.Reload();
|
|
||||||
StringStore.Reload();
|
|
||||||
TextureStore.Reload();
|
|
||||||
FileLoader.SaveLanguage();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Utils.LanguageEnum OldLanguage;
|
WarningStore.isWarningMessageLoaded = false;
|
||||||
public static Utils.LanguageEnum Language;
|
FontStore.Reload();
|
||||||
public enum LanguageEnum
|
StringStore.Reload();
|
||||||
{
|
TextureStore.Reload();
|
||||||
// first column
|
FileLoader.SaveLanguage();
|
||||||
English,
|
}
|
||||||
French,
|
#endif
|
||||||
Italian,
|
|
||||||
German,
|
|
||||||
Spanish,
|
|
||||||
Portuguese,
|
|
||||||
|
|
||||||
// second column
|
#if MULTI_LANGUAGE
|
||||||
Javanese, //Filipino,
|
public static Utils.LanguageEnum OldLanguage;
|
||||||
Vietnamese,
|
#endif
|
||||||
Indonesian,
|
|
||||||
Russian,
|
|
||||||
Japanese,
|
|
||||||
Korean,
|
|
||||||
|
|
||||||
// third column
|
public static Utils.LanguageEnum Language;
|
||||||
// Ukrainian,
|
|
||||||
// Slovak,
|
|
||||||
|
|
||||||
LANG_END
|
public static string mainCategory = "PvZ_Fusion_Translator";
|
||||||
}
|
|
||||||
}
|
public static bool customTextures = !Core.Instance.configDefaultTextures.Value;
|
||||||
|
public static bool customAudio = !Core.Instance.configDefaultAudio.Value;
|
||||||
|
|
||||||
|
public enum LanguageEnum
|
||||||
|
{
|
||||||
|
// first column
|
||||||
|
English,
|
||||||
|
French,
|
||||||
|
Italian,
|
||||||
|
German,
|
||||||
|
Spanish,
|
||||||
|
Portuguese,
|
||||||
|
|
||||||
|
// second column
|
||||||
|
Javanese, //Filipino,
|
||||||
|
Vietnamese,
|
||||||
|
Indonesian,
|
||||||
|
Russian,
|
||||||
|
Japanese,
|
||||||
|
Korean,
|
||||||
|
|
||||||
|
// third column
|
||||||
|
// Ukrainian,
|
||||||
|
// Slovak,
|
||||||
|
Polish,
|
||||||
|
Hungarian,
|
||||||
|
Arabic,
|
||||||
|
|
||||||
|
LANG_END
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum ToggleEnum
|
||||||
|
{
|
||||||
|
Textures,
|
||||||
|
Audio,
|
||||||
|
TOGGLE_END
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -24,15 +24,7 @@ namespace PvZ_Fusion_Translator.AssetStore
|
||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
bool loadCustomAudio = MelonPreferences.GetEntryValue<bool>("PvZ_Fusion_Translator", "DefaultAudio");
|
LoadAudios();
|
||||||
if (loadCustomAudio)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LoadAudios();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public static void LoadAudios()
|
public static void LoadAudios()
|
||||||
{
|
{
|
||||||
|
|
@ -158,24 +150,27 @@ namespace PvZ_Fusion_Translator.AssetStore
|
||||||
|
|
||||||
public static void AudioPlayPatch(AudioSource __instance)
|
public static void AudioPlayPatch(AudioSource __instance)
|
||||||
{
|
{
|
||||||
if (__instance.clip == null)
|
if(Utils.customAudio)
|
||||||
return;
|
|
||||||
|
|
||||||
if (LogSounds)
|
|
||||||
MelonLogger.Msg($"Playing \"{__instance.clip.name}\" from object \"{__instance.gameObject.name}\"");
|
|
||||||
|
|
||||||
string audioClipName = overrideEnabled ? "REPLACE_ALL" : __instance.clip.name;
|
|
||||||
if (AudioClips.TryGetValue(audioClipName, out AudioClip replaceClip))
|
|
||||||
{
|
{
|
||||||
__instance.pitch = 1;
|
if (__instance.clip == null)
|
||||||
__instance.clip = replaceClip;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
#if AUDIO_TESTING
|
if (LogSounds)
|
||||||
// Update the displayed audio source
|
MelonLogger.Msg($"Playing \"{__instance.clip.name}\" from object \"{__instance.gameObject.name}\"");
|
||||||
var (name, source) = GetAudioSource(__instance.clip.name);
|
|
||||||
UpdateAudioSourceText(name, source);
|
string audioClipName = overrideEnabled ? "REPLACE_ALL" : __instance.clip.name;
|
||||||
#endif
|
if (AudioClips.TryGetValue(audioClipName, out AudioClip replaceClip))
|
||||||
|
{
|
||||||
|
__instance.pitch = 1;
|
||||||
|
__instance.clip = replaceClip;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if AUDIO_TESTING
|
||||||
|
// Update the displayed audio source
|
||||||
|
var (name, source) = GetAudioSource(__instance.clip.name);
|
||||||
|
UpdateAudioSourceText(name, source);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ namespace PvZ_Fusion_Translator.AssetStore
|
||||||
#if MULTI_LANGUAGE
|
#if MULTI_LANGUAGE
|
||||||
RestoreTextures();
|
RestoreTextures();
|
||||||
#endif
|
#endif
|
||||||
FileLoader.LoadDefaultTextures();
|
|
||||||
FileLoader.LoadTextures();
|
FileLoader.LoadTextures();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,14 +96,10 @@ namespace PvZ_Fusion_Translator
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
if (loadDefaultTextures == true)
|
if (Utils.customTextures)
|
||||||
{
|
{
|
||||||
LoadDefaultTextures();
|
LoadCustomTextures();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
LoadCustomTextures();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
@ -167,7 +163,7 @@ namespace PvZ_Fusion_Translator
|
||||||
|
|
||||||
internal static void LoadDefaultTextures()
|
internal static void LoadDefaultTextures()
|
||||||
{
|
{
|
||||||
if(Utils.customTextures)
|
if(Utils.customTextures == false)
|
||||||
{
|
{
|
||||||
string textureDefaultDir = Path.Combine(Core.Instance.modsDirectory, AssetType.Dumps.ToString(), "Default Textures [Do Not Remove]");
|
string textureDefaultDir = Path.Combine(Core.Instance.modsDirectory, AssetType.Dumps.ToString(), "Default Textures [Do Not Remove]");
|
||||||
if (!Directory.Exists(textureDefaultDir))
|
if (!Directory.Exists(textureDefaultDir))
|
||||||
|
|
|
||||||
|
|
@ -240,9 +240,11 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects.ButtonObjects
|
||||||
|
|
||||||
if(type == "Textures")
|
if(type == "Textures")
|
||||||
{
|
{
|
||||||
Utils.customTextures = (Utils.customTextures) ? false : true;
|
Utils.customTextures = !Utils.customTextures;
|
||||||
MelonPreferences.SetEntryValue<bool>("PvZ_Fusion_Translator", "DefaultTextures", !Utils.customTextures);
|
MelonPreferences.SetEntryValue<bool>("PvZ_Fusion_Translator", "DefaultTextures", !Utils.customTextures);
|
||||||
}
|
TextureStore.Reload();
|
||||||
|
object replaceTextureRoutine = MelonCoroutines.Start(TextureStore.ReplaceTexturesCoroutine());
|
||||||
|
}
|
||||||
|
|
||||||
if (type == "Audio")
|
if (type == "Audio")
|
||||||
{
|
{
|
||||||
|
|
@ -304,11 +306,11 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects.ButtonObjects
|
||||||
ToggleCustomAssets(toggleType);
|
ToggleCustomAssets(toggleType);
|
||||||
if (toggleType == "Textures")
|
if (toggleType == "Textures")
|
||||||
{
|
{
|
||||||
FlashMessage(toggleData.Button, "<size=10>Toggled custom textures! (Restart game to apply changes.)", 0.1f);
|
FlashMessage(toggleData.Button, "<size=10>Toggled custom textures!", 0.1f);
|
||||||
}
|
}
|
||||||
else if (toggleType == "Audio")
|
else if (toggleType == "Audio")
|
||||||
{
|
{
|
||||||
FlashMessage(toggleData.Button, "<size=10>Toggled custom audio! (Restart game to apply changes.)", 0.1f);
|
FlashMessage(toggleData.Button, "<size=10>Toggled custom audio!", 0.1f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue