Skip to content

Commit

Permalink
[+] TouchToButtonInput On Aquamai (#58)
Browse files Browse the repository at this point in the history
Co-authored-by: Clansty <[email protected]>
  • Loading branch information
WYH2004-MC and clansty authored Oct 13, 2024
1 parent cdfb86e commit 4006438
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
2 changes: 2 additions & 0 deletions AquaMai/AquaMai.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ HideSelfMadeCharts=true
CustomFont=false
# Provide the ability to use custom note skins (advanced feature)
CustomNoteSkin=false
# Map touch actions to buttons
TouchToButtonInput=false
# Delayed the animation of the song start screen
# Hide "TRACK X" text and DX/Standard chart display box
# For recording chart confirmation
Expand Down
2 changes: 2 additions & 0 deletions AquaMai/AquaMai.zh.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ HideSelfMadeCharts=true
CustomFont=false
# 提供自定义音符皮肤的能力(高级功能)
CustomNoteSkin=false
# 映射触摸操作至实体按键
TouchToButtonInput=false
# 推迟了歌曲开始界面的动画
# 隐藏“TRACK X”字样和 DX/标准谱面的显示框
# 录制谱面确认用
Expand Down
1 change: 1 addition & 0 deletions AquaMai/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class UXConfig
public bool HideSelfMadeCharts { get; set; }
public bool CustomFont { get; set; }
public bool CustomNoteSkin { get; set; }
public bool TouchToButtonInput { get; set; }
public bool TrackStartProcessTweak { get; set; }
public bool HideHanabi { get; set; }
public string CustomVersionString { get; set; } = "";
Expand Down
50 changes: 50 additions & 0 deletions AquaMai/UX/TouchToButtonInput.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using HarmonyLib;
using Manager;
using Process;
using static Manager.InputManager;

namespace AquaMai.UX;

public class TouchToButtonInput
{
private static bool _isPlaying = false;

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

[HarmonyPostfix]
[HarmonyPatch(typeof(Manager.InputManager), "GetButtonDown")]
public static void GetButtonDown(ref bool __result, int monitorId, ButtonSetting button)
{
if (_isPlaying || __result) return;
if (button.ToString().StartsWith("Button"))
{
__result = GetTouchPanelAreaDown(monitorId, (TouchPanelArea)button);
}
else if (button.ToString().Equals("Select"))
{
__result = GetTouchPanelAreaLongPush(monitorId, TouchPanelArea.C1, 500L) || GetTouchPanelAreaLongPush(monitorId, TouchPanelArea.C2, 500L);
}
}

[HarmonyPostfix]
[HarmonyPatch(typeof(Manager.InputManager), "GetButtonPush")]
public static void GetButtonPush(ref bool __result, int monitorId, ButtonSetting button)
{
if (_isPlaying || __result) return;
if (button.ToString().StartsWith("Button")) __result = GetTouchPanelAreaPush(monitorId, (TouchPanelArea)button);
}

[HarmonyPostfix]
[HarmonyPatch(typeof(Manager.InputManager), "GetButtonLongPush")]
public static void GetButtonLongPush(ref bool __result, int monitorId, ButtonSetting button, long msec)
{
if (_isPlaying || __result) return;
if (button.ToString().StartsWith("Button")) __result = GetTouchPanelAreaLongPush(monitorId, (TouchPanelArea)button, msec);
}
}

0 comments on commit 4006438

Please sign in to comment.