plantinfo biggarden. bepinex things...
This commit is contained in:
parent
a2ac63b479
commit
ba0ea4853f
5 changed files with 32 additions and 39 deletions
|
|
@ -33,7 +33,12 @@ public class Core : BasePlugin
|
||||||
public ConfigEntry<bool> configDefaultAudio;
|
public ConfigEntry<bool> configDefaultAudio;
|
||||||
public ConfigEntry<string> configLanguage;
|
public ConfigEntry<string> configLanguage;
|
||||||
|
|
||||||
public override void Load()
|
private static float lastCheck = 0f;
|
||||||
|
private static float checkTime = 0f;
|
||||||
|
private static float checkInterval = 2f;
|
||||||
|
private static bool stringreloaded = false;
|
||||||
|
|
||||||
|
public override void Load()
|
||||||
{
|
{
|
||||||
Log = base.Log;
|
Log = base.Log;
|
||||||
Instance = this;
|
Instance = this;
|
||||||
|
|
@ -98,6 +103,25 @@ public class Core : BasePlugin
|
||||||
{
|
{
|
||||||
TowerManager_Patch.UpdateText();
|
TowerManager_Patch.UpdateText();
|
||||||
}
|
}
|
||||||
|
if (Input.GetKeyDown(KeyCode.RightShift))
|
||||||
|
{
|
||||||
|
stringreloaded = !stringreloaded;
|
||||||
|
}
|
||||||
|
Core.DebugStringReload();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DebugStringReload()
|
||||||
|
{
|
||||||
|
if (stringreloaded == true)
|
||||||
|
{
|
||||||
|
checkTime += Time.deltaTime;
|
||||||
|
if (checkTime >= checkInterval)
|
||||||
|
{
|
||||||
|
StringStore.Reload();
|
||||||
|
ShowToast("Strings Reloaded!");
|
||||||
|
checkTime = 0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnGUI()
|
public void OnGUI()
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
@ -17,12 +17,13 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||||
{
|
{
|
||||||
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||||
|
|
||||||
PlantType thePlantType = __instance.plant.thePlantType;
|
BigGardenPlant thePlant = __instance.plant;
|
||||||
|
|
||||||
foreach (TextMeshProUGUI txt in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
foreach (TextMeshProUGUI txt in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||||
{
|
{
|
||||||
if(txt.name.Contains("Introduce"))
|
if(txt.name.Contains("Introduce") && thePlant != null)
|
||||||
{
|
{
|
||||||
|
PlantType thePlantType = thePlant.thePlantType;
|
||||||
txt.text = StringStore.TranslateText(txt.text);
|
txt.text = StringStore.TranslateText(txt.text);
|
||||||
|
|
||||||
string text = txt.text;
|
string text = txt.text;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
||||||
{
|
{
|
||||||
[HarmonyPatch(nameof(AlmanacPlantBank.InitNameAndInfoFromJson))]
|
[HarmonyPatch(nameof(AlmanacPlantBank.InitNameAndInfoFromJson))]
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
private static void InitNameAndInfoFromJson(AlmanacPlantBank __instance)
|
public static void InitNameAndInfoFromJson(AlmanacPlantBank __instance)
|
||||||
{
|
{
|
||||||
#if MULTI_LANGUAGE
|
#if MULTI_LANGUAGE
|
||||||
string currentLanguage = Utils.Language.ToString();
|
string currentLanguage = Utils.Language.ToString();
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||||
TextMeshProUGUI cost = buff.transform.GetChild(1).GetComponent<TextMeshProUGUI>();
|
TextMeshProUGUI cost = buff.transform.GetChild(1).GetComponent<TextMeshProUGUI>();
|
||||||
cost.text = StringStore.TranslateText(cost.text);
|
cost.text = StringStore.TranslateText(cost.text);
|
||||||
cost.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
cost.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||||
FileLoader.DumpUntranslatedStrings(cost.text);
|
//FileLoader.DumpUntranslatedStrings(cost.text);
|
||||||
}
|
}
|
||||||
foreach (TextMeshProUGUI intr in __instance.introduces)
|
foreach (TextMeshProUGUI intr in __instance.introduces)
|
||||||
intr.text = StringStore.TranslateText(intr.text);
|
intr.text = StringStore.TranslateText(intr.text);
|
||||||
|
|
|
||||||
|
|
@ -235,39 +235,7 @@ namespace PvZ_Fusion_Translator
|
||||||
return theZombieName;
|
return theZombieName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetZombieNameFromAlmanac(ZombieType theZombieType)
|
public static Dictionary<int, KeyValuePair<int, string>> plantIndices = new Dictionary<int, KeyValuePair<int, string>>();
|
||||||
{
|
|
||||||
string json;
|
|
||||||
string theZombieName = "";
|
|
||||||
|
|
||||||
string currentLanguage = Utils.Language.ToString();
|
|
||||||
string almanacDir = GetAssetDir(AssetType.Almanac, Utils.Language);
|
|
||||||
string path = Path.Combine(almanacDir, "ZombieStringsTranslate.json");
|
|
||||||
|
|
||||||
if (!File.Exists(path))
|
|
||||||
{
|
|
||||||
Log.LogError($"ZombieStringsTranslate.json file not found at path: {path}");
|
|
||||||
Log.LogError("Zombie name could not be found!");
|
|
||||||
theZombieName = "";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
json = File.ReadAllText(path);
|
|
||||||
AlmanacMgrZombie.ZombieAlmanacData zombieData = JsonUtility.FromJson<AlmanacMgrZombie.ZombieAlmanacData>(json);
|
|
||||||
|
|
||||||
foreach (AlmanacMgrZombie.ZombieInfo zombieInfo in zombieData.zombies)
|
|
||||||
{
|
|
||||||
if ((int)zombieInfo.theZombieType == (int)theZombieType)
|
|
||||||
{
|
|
||||||
theZombieName = zombieInfo.name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return theZombieName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Dictionary<int, KeyValuePair<int, string>> plantIndices = new Dictionary<int, KeyValuePair<int, string>>(); Dictionary<int, KeyValuePair<int, string>>();
|
|
||||||
|
|
||||||
public static void RegisterPlantIndices()
|
public static void RegisterPlantIndices()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue