mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-14 14:37:28 +08:00
[O] ResetTouchAfterTrack -> ResetTouch, add press key to reset (#93)
* [O] ResetTouchAfterTrack -> ResetTouch, add press key to reset * fix * update * fix: Remove not work --------- Co-authored-by: Menci <mencici@msn.com>
This commit is contained in:
@@ -5,6 +5,7 @@ using AquaMai.Config.Types;
|
||||
using AquaMai.Core;
|
||||
using AquaMai.Core.Attributes;
|
||||
using AquaMai.Core.Helpers;
|
||||
using AquaMai.Mods.Tweaks;
|
||||
using AquaMai.Mods.UX;
|
||||
using AquaMai.Mods.UX.PracticeMode;
|
||||
using HarmonyLib;
|
||||
@@ -35,6 +36,7 @@ public class TestProof
|
||||
(typeof(OneKeyRetrySkip), OneKeyRetrySkip.skipKey),
|
||||
(typeof(HideSelfMadeCharts), HideSelfMadeCharts.key),
|
||||
(typeof(PracticeMode), PracticeMode.key),
|
||||
(typeof(ResetTouch), ResetTouch.key),
|
||||
];
|
||||
var keyMapEnabled = ConfigLoader.Config.GetSectionState(typeof(KeyMap)).Enabled;
|
||||
return featureKeys.Any(it =>
|
||||
|
||||
43
AquaMai/AquaMai.Mods/Tweaks/ResetTouch.cs
Normal file
43
AquaMai/AquaMai.Mods/Tweaks/ResetTouch.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using AquaMai.Config.Attributes;
|
||||
using AquaMai.Config.Types;
|
||||
using AquaMai.Core.Helpers;
|
||||
using AquaMai.Core.Resources;
|
||||
using HarmonyLib;
|
||||
using MAI2.Util;
|
||||
using Main;
|
||||
using Manager;
|
||||
using Process;
|
||||
|
||||
namespace AquaMai.Mods.Tweaks;
|
||||
|
||||
[ConfigSection(
|
||||
en: "Reset touch panel manually or after playing track.",
|
||||
zh: "重置触摸面板")]
|
||||
public class ResetTouch
|
||||
{
|
||||
[ConfigEntry(en: "Reset touch panel after playing track.", zh: "玩完一首歌自动重置")]
|
||||
private static bool afterTrack = false;
|
||||
|
||||
[ConfigEntry(en: "Reset manually.", zh: "按键重置")]
|
||||
public static readonly KeyCodeOrName key = KeyCodeOrName.None;
|
||||
|
||||
[ConfigEntry] private static readonly bool longPress = false;
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(ResultProcess), "OnStart")]
|
||||
public static void ResultProcessOnStart()
|
||||
{
|
||||
if (!afterTrack) return;
|
||||
SingletonStateMachine<AmManager, AmManager.EState>.Instance.StartTouchPanel();
|
||||
MelonLoader.MelonLogger.Msg("[TouchResetAfterTrack] Touch panel reset");
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(GameMainObject), "Update")]
|
||||
public static void OnGameMainObjectUpdate()
|
||||
{
|
||||
if (!KeyListener.GetKeyDownOrLongPress(key, longPress)) return;
|
||||
SingletonStateMachine<AmManager, AmManager.EState>.Instance.StartTouchPanel();
|
||||
MessageHelper.ShowMessage(Locale.TouchPanelReset);
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using AquaMai.Config.Attributes;
|
||||
using HarmonyLib;
|
||||
using MAI2.Util;
|
||||
using Manager;
|
||||
using Process;
|
||||
|
||||
namespace AquaMai.Mods.Tweaks;
|
||||
|
||||
[ConfigSection(
|
||||
en: "Reset touch panel after playing track.",
|
||||
zh: "在游玩一首曲目后重置触摸面板")]
|
||||
public class ResetTouchAfterTrack
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(ResultProcess), "OnStart")]
|
||||
public static void ResultProcessOnStart()
|
||||
{
|
||||
SingletonStateMachine<AmManager, AmManager.EState>.Instance.StartTouchPanel();
|
||||
MelonLoader.MelonLogger.Msg("[TouchResetAfterTrack] Touch panel reset");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user