Skip to content

Commit

Permalink
[O] better _isPlaying detection
Browse files Browse the repository at this point in the history
  • Loading branch information
clansty committed Oct 13, 2024
1 parent 4006438 commit bf9855a
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions AquaMai/UX/TouchToButtonInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,21 @@ namespace AquaMai.UX;
public class TouchToButtonInput
{
private static bool _isPlaying = false;


[HarmonyPostfix]
[HarmonyPatch(typeof(GameProcess), "OnStart")]
public static void OnGameProcessStart(GameProcess __instance)
{
_isPlaying = true;
}

[HarmonyPostfix]
[HarmonyPatch(typeof(GameProcess),"OnUpdate")]
public static void OnUpdate(GameProcess __instance)
[HarmonyPatch(typeof(GameProcess), "OnRelease")]
public static void OnGameProcessRelease(GameProcess __instance)
{
var notesManager = new NotesManager();
_isPlaying = notesManager.IsPlaying();
_isPlaying = false;
}

[HarmonyPostfix]
[HarmonyPatch(typeof(Manager.InputManager), "GetButtonDown")]
public static void GetButtonDown(ref bool __result, int monitorId, ButtonSetting button)
Expand Down Expand Up @@ -47,4 +53,4 @@ public static void GetButtonLongPush(ref bool __result, int monitorId, ButtonSet
if (_isPlaying || __result) return;
if (button.ToString().StartsWith("Button")) __result = GetTouchPanelAreaLongPush(monitorId, (TouchPanelArea)button, msec);
}
}
}

0 comments on commit bf9855a

Please sign in to comment.