-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[O] ResetTouchAfterTrack -> ResetTouch, add press key to reset
- Loading branch information
Showing
9 changed files
with
95 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
AquaMai/AquaMai.Config/Migration/ConfigMigration_V2_0_V2_1.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using AquaMai.Config.Interfaces; | ||
using AquaMai.Config.Types; | ||
using Tomlet.Models; | ||
|
||
namespace AquaMai.Config.Migration; | ||
|
||
public class ConfigMigration_V2_0_V2_1 : IConfigMigration | ||
{ | ||
public string FromVersion => "2.0"; | ||
public string ToVersion => "2.1"; | ||
|
||
public IConfigView Migrate(IConfigView src) | ||
{ | ||
var dst = src; | ||
|
||
dst.SetValue("Version", ToVersion); | ||
|
||
if (src.GetValueOrDefault<bool>("Tweaks.ResetTouchAfterTrack")) | ||
{ | ||
dst.SetValue("Tweaks.ResetTouch.AfterTrack", true); | ||
dst.SetValue("Tweaks.ResetTouchAfterTrack", null); | ||
} | ||
|
||
return dst; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.