From 9b51c8cab4b9700a42af3c03638b5d9b62ebb322 Mon Sep 17 00:00:00 2001 From: Clansty Date: Sun, 26 May 2024 11:28:06 +0800 Subject: [PATCH] [+] Totally disable and hide timer + fix side effects when ExtendTimer is on --- AquaMai/UX/ExtendTimer.cs | 43 +++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/AquaMai/UX/ExtendTimer.cs b/AquaMai/UX/ExtendTimer.cs index d5840de4..57eb7a6a 100644 --- a/AquaMai/UX/ExtendTimer.cs +++ b/AquaMai/UX/ExtendTimer.cs @@ -2,6 +2,8 @@ using Manager; using Monitor; using Process; +using Process.Entry.State; +using Process.ModeSelect; namespace AquaMai.UX { @@ -11,19 +13,44 @@ namespace AquaMai.UX [HarmonyPatch(typeof(TimerController), "PrepareTimer")] public static void PrePrepareTimer(ref int second) { - second = 200; + second = 65535; + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(CommonTimer), "SetVisible")] + public static void CommonTimerSetVisible(ref bool isVisible) + { + isVisible = false; + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(EntryProcess), "DecrementTimerSecond")] + public static bool EntryProcessDecrementTimerSecond(ContextEntry ____context) + { + SoundManager.PlaySE(Mai2.Mai2Cue.Cue.SE_SYS_SKIP, 0); + ____context.SetState(StateType.DoneEntry); + return false; + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModeSelectProcess), "UpdateInput")] + public static bool ModeSelectProcessUpdateInput(ModeSelectProcess __instance) + { + if (!InputManager.GetButtonDown(0, InputManager.ButtonSetting.Button05)) return true; + __instance.TimeSkipButtonAnim(InputManager.ButtonSetting.Button05); + SoundManager.PlaySE(Mai2.Mai2Cue.Cue.SE_SYS_SKIP, 0); + Traverse.Create(__instance).Method("TimeUp").GetValue(); + return false; } [HarmonyPrefix] [HarmonyPatch(typeof(PhotoEditProcess), "MainMenuUpdate")] - public static void PhotoEditProcess(PhotoEditMonitor[] ____monitors, ProcessDataContainer ___container) + public static void PhotoEditProcess(PhotoEditMonitor[] ____monitors, PhotoEditProcess __instance) { - if (InputManager.GetButtonDown(0, InputManager.ButtonSetting.Button04)) - { - ___container.processManager.DecrementTime(0, 200); - SoundManager.PlaySE(Mai2.Mai2Cue.Cue.SE_SYS_SKIP, 0); - ____monitors[0].SetButtonPressed(InputManager.ButtonSetting.Button04); - } + if (!InputManager.GetButtonDown(0, InputManager.ButtonSetting.Button04)) return; + SoundManager.PlaySE(Mai2.Mai2Cue.Cue.SE_SYS_SKIP, 0); + ____monitors[0].SetButtonPressed(InputManager.ButtonSetting.Button04); + Traverse.Create(__instance).Method("OnTimeUp").GetValue(); } } } \ No newline at end of file