diff --git a/AquaMai/AquaMai.toml b/AquaMai/AquaMai.toml index da6678b8..2e3793dc 100644 --- a/AquaMai/AquaMai.toml +++ b/AquaMai/AquaMai.toml @@ -125,6 +125,8 @@ SkipGameOverScreen=true SkipTrackStart=true # Show reason when net icon is gray ShowNetErrorDetail=true +# Show a "skip" button like AstroDX after the notes end +ShowQuickEndPlay=true [WindowState] # If not enabled, no operations will be performed on the game window diff --git a/AquaMai/AquaMai.zh.toml b/AquaMai/AquaMai.zh.toml index bdcc2912..c5d93ee1 100644 --- a/AquaMai/AquaMai.zh.toml +++ b/AquaMai/AquaMai.zh.toml @@ -144,6 +144,8 @@ IWontTapOrSlideVigorously=true SkipGameOverScreen=true # 跳过乐曲开始界面 SkipTrackStart=true +# 音符结束之后显示像 AstroDX 一样的“跳过”按钮 +ShowQuickEndPlay=true [WindowState] # 不启用的话,不会对游戏窗口做任何操作 diff --git a/AquaMai/Config.cs b/AquaMai/Config.cs index f4484050..2f742a55 100644 --- a/AquaMai/Config.cs +++ b/AquaMai/Config.cs @@ -85,6 +85,7 @@ namespace AquaMai public bool IWontTapOrSlideVigorously { get; set; } public bool SkipGameOverScreen { get; set; } public bool SkipTrackStart { get; set; } + public bool ShowQuickEndPlay { get; set; } } public class WindowStateConfig diff --git a/AquaMai/Resources/Locale.Designer.cs b/AquaMai/Resources/Locale.Designer.cs index d97753fe..8d68ad90 100644 --- a/AquaMai/Resources/Locale.Designer.cs +++ b/AquaMai/Resources/Locale.Designer.cs @@ -215,6 +215,15 @@ namespace AquaMai.Resources { } } + /// + /// Looks up a localized string similar to Skip. + /// + internal static string Skip { + get { + return ResourceManager.GetString("Skip", resourceCulture); + } + } + /// /// Looks up a localized string similar to Speed. /// diff --git a/AquaMai/Resources/Locale.resx b/AquaMai/Resources/Locale.resx index a60455dd..1a3b2003 100644 --- a/AquaMai/Resources/Locale.resx +++ b/AquaMai/Resources/Locale.resx @@ -84,4 +84,7 @@ SSS+ => DXRating += {0} + + Skip + diff --git a/AquaMai/Resources/Locale.zh.resx b/AquaMai/Resources/Locale.zh.resx index 10c19982..3a631cb4 100644 --- a/AquaMai/Resources/Locale.zh.resx +++ b/AquaMai/Resources/Locale.zh.resx @@ -77,4 +77,7 @@ 推到鸟加可上 {0} 分 + + 跳过 + diff --git a/AquaMai/TimeSaving/ShowQuickEndPlay.cs b/AquaMai/TimeSaving/ShowQuickEndPlay.cs new file mode 100644 index 00000000..a5fd4c5b --- /dev/null +++ b/AquaMai/TimeSaving/ShowQuickEndPlay.cs @@ -0,0 +1,59 @@ +using System.Collections.Generic; +using AquaMai.Helpers; +using AquaMai.Resources; +using HarmonyLib; +using MAI2.Util; +using Manager; +using Monitor; +using Process; +using UnityEngine; + +namespace AquaMai.TimeSaving; + +public class ShowQuickEndPlay +{ + private static bool _showUi; + + [HarmonyPatch(typeof(GameProcess), "OnStart")] + [HarmonyPostfix] + public static void GameProcessPostStart(GameMonitor[] ____monitors) + { + _showUi = false; + ____monitors[0].gameObject.AddComponent(); + } + + [HarmonyPatch(typeof(GameProcess), "OnUpdate")] + [HarmonyPostfix] + public static void GameProcessPostUpdate(GameProcess __instance, Message[] ____message, ProcessDataContainer ___container, byte ____sequence) + { + if (____sequence > 4) + { + _showUi = true; + } + + if (_showUi && (InputManager.GetTouchPanelAreaDown(InputManager.TouchPanelArea.B4) || InputManager.GetTouchPanelAreaDown(InputManager.TouchPanelArea.E4))) + { + var traverse = Traverse.Create(__instance); + ___container.processManager.SendMessage(____message[0]); + Singleton.Instance.SetSyncResult(0); + traverse.Method("SetRelease").GetValue(); + } + } + + private class Ui : MonoBehaviour + { + public void OnGUI() + { + if (!_showUi) return; + var style = GUI.skin.GetStyle("button"); + style.fontSize = GuiSizes.FontSize; + + var x = GuiSizes.PlayerCenter; + var y = Screen.height - GuiSizes.PlayerWidth * .37f; + var width = GuiSizes.PlayerWidth * .25f; + var height = GuiSizes.PlayerWidth * .13f; + + GUI.Button(new Rect(x, y, width, height), Locale.Skip); + } + } +}