Skip to content

Commit

Permalink
[F] CurrentPlayMsec conflict with speed settings
Browse files Browse the repository at this point in the history
  • Loading branch information
clansty committed Oct 16, 2024
1 parent 5bcbffc commit 6857ae5
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 8 deletions.
1 change: 1 addition & 0 deletions AquaMai/Fix/DebugFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public static void Seek(int msec)

public static double CurrentPlayMsec
{
[Obsolete("不要用它,它有问题。用 PractiseMode.CurrentPlayMsec")]
get
{
if (IsPolyfill)
Expand Down
24 changes: 22 additions & 2 deletions AquaMai/Utils/PractiseMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,26 @@ public static void SpeedReset()
SetSpeed();
}

public static void Seek(int addMsec)
{
// Debug feature 里面那个 timer 不能感知变速
// 为了和魔改版本统一,polyfill 里面不修这个
// 这里重新实现一个能感知变速的 Seek
var msec = CurrentPlayMsec + addMsec;
if (msec < 0)
{
msec = 0;
}

DebugFeature.CurrentPlayMsec = msec;
}

public static double CurrentPlayMsec
{
get => NotesManager.GetCurrentMsec() - 91;
set => DebugFeature.CurrentPlayMsec = value;
}

public static PractiseModeUI ui;

[HarmonyPatch(typeof(GameProcess), "OnStart")]
Expand Down Expand Up @@ -136,9 +156,9 @@ public static void GameProcessPostUpdate(GameProcess __instance, GameMonitor[] _

if (repeatStart >= 0 && repeatEnd >= 0)
{
if (DebugFeature.CurrentPlayMsec >= repeatEnd)
if (CurrentPlayMsec >= repeatEnd)
{
DebugFeature.CurrentPlayMsec = repeatStart;
CurrentPlayMsec = repeatStart;
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions AquaMai/Utils/PractiseModeUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,38 +82,38 @@ public void OnGUI()
GUI.Button(GetButtonRect(2, 2), Locale.SpeedUp);
GUI.Button(GetButtonRect(1, 3), Locale.SpeedReset);

GUI.Label(GetButtonRect(0, 3), TimeSpan.FromMilliseconds(DebugFeature.CurrentPlayMsec).ToString(@"mm\:ss\.fff"));
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"));
}

public void Update()
{
if (InputManager.GetTouchPanelAreaDown(InputManager.TouchPanelArea.E8))
{
DebugFeature.Seek(-1000);
PractiseMode.Seek(-1000);
PractiseMode.SetSpeedCoroutine();
}
else if (InputManager.GetTouchPanelAreaDown(InputManager.TouchPanelArea.E2))
{
DebugFeature.Seek(1000);
PractiseMode.Seek(1000);
PractiseMode.SetSpeedCoroutine();
}
else if (InputManager.GetTouchPanelAreaDown(InputManager.TouchPanelArea.B8) || InputManager.GetTouchPanelAreaDown(InputManager.TouchPanelArea.B1))
{
DebugFeature.Pause = !DebugFeature.Pause;
if (!DebugFeature.Pause)
{
DebugFeature.Seek(0);
PractiseMode.Seek(0);
PractiseMode.SetSpeedCoroutine();
}
}
else if (InputManager.GetTouchPanelAreaDown(InputManager.TouchPanelArea.B7) && PractiseMode.repeatStart == -1)
{
PractiseMode.repeatStart = DebugFeature.CurrentPlayMsec;
PractiseMode.repeatStart = PractiseMode.CurrentPlayMsec;
}
else if (InputManager.GetTouchPanelAreaDown(InputManager.TouchPanelArea.B7) && PractiseMode.repeatEnd == -1)
{
PractiseMode.SetRepeatEnd(DebugFeature.CurrentPlayMsec);
PractiseMode.SetRepeatEnd(PractiseMode.CurrentPlayMsec);
}
else if (InputManager.GetTouchPanelAreaDown(InputManager.TouchPanelArea.B2))
{
Expand Down

0 comments on commit 6857ae5

Please sign in to comment.