Merge pull request #10 from Teyliu/cassidy

Cassidy
This commit is contained in:
JustNull 2025-08-26 15:54:45 +07:00 • committed by GitHub
commit 5a66306760
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 39 additions and 10 deletions

View file

@ -40,6 +40,7 @@ public class Core : BasePlugin
MonoInstance = AddComponent<UnityCoroutineHelper>(); MonoInstance = AddComponent<UnityCoroutineHelper>();
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly()); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly());
LoadConfig(); LoadConfig();
dtStart = DateTime.Now;
FileLoader.LoadLanguage(); FileLoader.LoadLanguage();
@ -76,19 +77,19 @@ public class Core : BasePlugin
dtStartToast = DateTime.Now; dtStartToast = DateTime.Now;
} }
public void Update() public void OnUpdate()
{ {
#if DEBUG
ModFeatures.OnLateUpdate(); ModFeatures.OnLateUpdate();
#endif
if (Input.GetKeyDown(KeyCode.Insert)) if (Input.GetKeyDown(KeyCode.Insert))
{ {
Log.LogInfo("Insert press");
Utils.OpenSaveDirectory(); Utils.OpenSaveDirectory();
} }
if (Input.GetKeyDown(KeyCode.Delete)) if (Input.GetKeyDown(KeyCode.Delete))
{ {
Log.LogInfo("del del");
Utils.OpenTrello(); Utils.OpenTrello();
} }
if (TowerManager.Instance != null) if (TowerManager.Instance != null)
@ -101,8 +102,16 @@ public class Core : BasePlugin
{ {
#if DEBUG #if DEBUG
if (dtStartToast != null) if (dtStartToast != null)
{
try
{ {
GUI.Button(new Rect(10f, 10f, 200f, 20f), "\n" + toast_txt + "\n"); GUI.Button(new Rect(10f, 10f, 200f, 20f), "\n" + toast_txt + "\n");
}
catch(Exception e)
{
Log.LogError(e);
}
TimeSpan? timeSpan = DateTime.Now - dtStartToast; TimeSpan? timeSpan = DateTime.Now - dtStartToast;
TimeSpan t = new TimeSpan(0, 0, 2); TimeSpan t = new TimeSpan(0, 0, 2);
if (timeSpan > t) if (timeSpan > t)

View file

@ -69,6 +69,7 @@ namespace PvZ_Fusion_Translator__BepInEx_
{ {
if (Input.GetKeyDown(feature.KeyCode)) if (Input.GetKeyDown(feature.KeyCode))
{ {
Log.LogDebug(feature.KeyCode);
feature.ToggleFeature(); feature.ToggleFeature();
} }
} }

View file

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

View file

@ -13,7 +13,7 @@
https://nuget.samboy.dev/v3/index.json https://nuget.samboy.dev/v3/index.json
</RestoreAdditionalProjectSources> </RestoreAdditionalProjectSources>
<RootNamespace>PvZ_Fusion_Translator__BepInEx_</RootNamespace> <RootNamespace>PvZ_Fusion_Translator__BepInEx_</RootNamespace>
<GamePath>D:\PvZ Fusion\BepInEx Game Files</GamePath> <GamePath>C:\Users\rainb\Desktop\PC_PVZ-Fusion_2.8.2-BepInEx</GamePath>
<Configurations>Debug;DebugEnglish;ReleaseMulti;ReleaseEnglish;DebugTesting;ReleaseOther;DebugObfuscate;ReleaseObfuscate;DebugMulti</Configurations> <Configurations>Debug;DebugEnglish;ReleaseMulti;ReleaseEnglish;DebugTesting;ReleaseOther;DebugObfuscate;ReleaseObfuscate;DebugMulti</Configurations>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
</PropertyGroup> </PropertyGroup>
@ -165,6 +165,7 @@
<Compile Include="Patches\Managers\SaveMenu_Patch.cs" /> <Compile Include="Patches\Managers\SaveMenu_Patch.cs" />
<Compile Include="Patches\GameObjects\TravelBuffOptionButton_Patch.cs" /> <Compile Include="Patches\GameObjects\TravelBuffOptionButton_Patch.cs" />
<Compile Include="Patches\Managers\TowerManager_Patch.cs" /> <Compile Include="Patches\Managers\TowerManager_Patch.cs" />
<Compile Include="Patches\Managers\GameAPP_Patch.cs" />
<Compile Include="Patches\OtherManagers\AchievementClip_Patch.cs" /> <Compile Include="Patches\OtherManagers\AchievementClip_Patch.cs" />
<Compile Include="Patches\GameObjects\ButtonObjects\Advanture_Btn_Patch.cs" /> <Compile Include="Patches\GameObjects\ButtonObjects\Advanture_Btn_Patch.cs" />
<Compile Include="Patches\Managers\AlmanacMgrZombie_Patch.cs" /> <Compile Include="Patches\Managers\AlmanacMgrZombie_Patch.cs" />

View file

@ -13,7 +13,7 @@
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Configurations>Debug;DebugEnglish;ReleaseMulti;ReleaseEnglish;DebugTesting;ReleaseOther;DebugObfuscate;ReleaseObfuscate</Configurations> <Configurations>Debug;DebugEnglish;ReleaseMulti;ReleaseEnglish;DebugTesting;ReleaseOther;DebugObfuscate;ReleaseObfuscate</Configurations>
<GamePath>C:\Users\rainb\Desktop\PC_PVZ-Fusion-2.8.1</GamePath> <GamePath>C:\Users\rainb\Desktop\PC_PVZ-Fusion_2.8.2</GamePath>
<Platforms>AnyCPU;ARM64;x64</Platforms> <Platforms>AnyCPU;ARM64;x64</Platforms>
</PropertyGroup> </PropertyGroup>