diff --git a/BepInEx/Core.cs b/BepInEx/Core.cs index 7583580..5c9c98d 100644 --- a/BepInEx/Core.cs +++ b/BepInEx/Core.cs @@ -40,8 +40,9 @@ public class Core : BasePlugin MonoInstance = AddComponent(); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly()); LoadConfig(); + dtStart = DateTime.Now; - FileLoader.LoadLanguage(); + FileLoader.LoadLanguage(); AudioStore.Init(); TextureStore.Init(); @@ -76,34 +77,42 @@ public class Core : BasePlugin dtStartToast = DateTime.Now; } - public void Update() + public void OnUpdate() { - #if DEBUG ModFeatures.OnLateUpdate(); - #endif if (Input.GetKeyDown(KeyCode.Insert)) { + Log.LogInfo("Insert press"); Utils.OpenSaveDirectory(); } if (Input.GetKeyDown(KeyCode.Delete)) { + Log.LogInfo("del del"); Utils.OpenTrello(); - } + } if (TowerManager.Instance != null) { TowerManager_Patch.UpdateText(); } } - public void OnGUI() + public void OnGUI() { #if DEBUG if (dtStartToast != null) { - GUI.Button(new Rect(10f, 10f, 200f, 20f), "\n" + toast_txt + "\n"); - TimeSpan? timeSpan = DateTime.Now - dtStartToast; + try + { + GUI.Button(new Rect(10f, 10f, 200f, 20f), "\n" + toast_txt + "\n"); + } + catch(Exception e) + { + Log.LogError(e); + } + + TimeSpan? timeSpan = DateTime.Now - dtStartToast; TimeSpan t = new TimeSpan(0, 0, 2); if (timeSpan > t) { diff --git a/BepInEx/ModFeatures.cs b/BepInEx/ModFeatures.cs index 12d47fc..913ac20 100644 --- a/BepInEx/ModFeatures.cs +++ b/BepInEx/ModFeatures.cs @@ -69,6 +69,7 @@ namespace PvZ_Fusion_Translator__BepInEx_ { if (Input.GetKeyDown(feature.KeyCode)) { + Log.LogDebug(feature.KeyCode); feature.ToggleFeature(); } } diff --git a/BepInEx/Patches/Managers/GameAPP_Patch.cs b/BepInEx/Patches/Managers/GameAPP_Patch.cs new file mode 100644 index 0000000..7355d28 --- /dev/null +++ b/BepInEx/Patches/Managers/GameAPP_Patch.cs @@ -0,0 +1,18 @@ +using HarmonyLib; +using System; +using PvZ_Fusion_Translator__BepInEx_.AssetStore; +using UnityEngine; + +namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers +{ + [HarmonyPatch(typeof(GameAPP))] + public class GameAPP_Patch + { + [HarmonyPatch(nameof(GameAPP.Update))] + [HarmonyPostfix] + private static void Update(GameAPP __instance) + { + Core.Instance.OnUpdate(); + } + } +} \ No newline at end of file diff --git a/BepInEx/PvZ Fusion Translator [BepInEx].csproj b/BepInEx/PvZ Fusion Translator [BepInEx].csproj index 2510057..30886ec 100644 --- a/BepInEx/PvZ Fusion Translator [BepInEx].csproj +++ b/BepInEx/PvZ Fusion Translator [BepInEx].csproj @@ -13,7 +13,7 @@ https://nuget.samboy.dev/v3/index.json PvZ_Fusion_Translator__BepInEx_ - D:\PvZ Fusion\BepInEx Game Files + C:\Users\rainb\Desktop\PC_PVZ-Fusion_2.8.2-BepInEx Debug;DebugEnglish;ReleaseMulti;ReleaseEnglish;DebugTesting;ReleaseOther;DebugObfuscate;ReleaseObfuscate;DebugMulti AnyCPU;x64 @@ -165,6 +165,7 @@ + diff --git a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj index fb4bfab..86bba9f 100644 --- a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj +++ b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj @@ -13,7 +13,7 @@ latest enable Debug;DebugEnglish;ReleaseMulti;ReleaseEnglish;DebugTesting;ReleaseOther;DebugObfuscate;ReleaseObfuscate - C:\Users\rainb\Desktop\PC_PVZ-Fusion-2.8.1 + C:\Users\rainb\Desktop\PC_PVZ-Fusion_2.8.2 AnyCPU;ARM64;x64