[+] keep note speed when changed speed
Build AquaMai / build (push) Has been cancelled Details

pull/69/head
Clansty 2024-10-16 19:23:32 +08:00
parent 6857ae5182
commit 903da8732d
No known key found for this signature in database
GPG Key ID: 3A6BE8BAF2EDE134
2 changed files with 26 additions and 3 deletions

View File

@ -2,6 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using AquaMai.Fix;
using AquaMai.Helpers;
using HarmonyLib;
@ -20,7 +21,8 @@ public class PractiseMode
public static float speed = 1;
private static CriAtomExPlayer player;
private static MovieMaterialMai2 movie;
private static GameCtrl gameCtrl;
public static GameCtrl gameCtrl;
public static bool keepNoteSpeed = false;
public static void SetRepeatEnd(double time)
{
@ -116,6 +118,22 @@ public class PractiseMode
public static PractiseModeUI ui;
[HarmonyPatch]
public class PatchNoteSpeed
{
public static IEnumerable<MethodBase> TargetMethods()
{
yield return AccessTools.Method(typeof(GameManager), "GetNoteSpeed");
yield return AccessTools.Method(typeof(GameManager), "GetTouchSpeed");
}
public static void Postfix(ref float __result)
{
if (!keepNoteSpeed) return;
__result /= speed;
}
}
[HarmonyPatch(typeof(GameProcess), "OnStart")]
[HarmonyPostfix]
public static void GameProcessPostStart()

View File

@ -82,8 +82,8 @@ public class PractiseModeUI : MonoBehaviour
GUI.Button(GetButtonRect(2, 2), Locale.SpeedUp);
GUI.Button(GetButtonRect(1, 3), Locale.SpeedReset);
GUI.Label(GetButtonRect(0, 3), TimeSpan.FromMilliseconds(PractiseMode.CurrentPlayMsec).ToString(@"mm\:ss\.fff"));
GUI.Label(GetButtonRect(2, 3), TimeSpan.FromMilliseconds(NotesManager.Instance().getPlayFinalMsec()).ToString(@"mm\:ss\.fff"));
GUI.Label(GetButtonRect(0, 3), $"{TimeSpan.FromMilliseconds(PractiseMode.CurrentPlayMsec):mm\\:ss\\.fff}\n{TimeSpan.FromMilliseconds(NotesManager.Instance().getPlayFinalMsec()):mm\\:ss\\.fff}");
GUI.Button(GetButtonRect(2, 3), $"保持流速\n{(PractiseMode.keepNoteSpeed ? "ON" : "OFF")}");
}
public void Update()
@ -131,6 +131,11 @@ public class PractiseModeUI : MonoBehaviour
{
PractiseMode.SpeedReset();
}
else if (InputManager.GetTouchPanelAreaDown(InputManager.TouchPanelArea.E4))
{
PractiseMode.keepNoteSpeed = !PractiseMode.keepNoteSpeed;
PractiseMode.gameCtrl?.ResetOptionSpeed();
}
else if (
InputManager.GetTouchPanelAreaDown(InputManager.TouchPanelArea.A1) ||
InputManager.GetTouchPanelAreaDown(InputManager.TouchPanelArea.A2) ||