Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions AquaMai.Mods/UX/PracticeMode/PracticeMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,13 @@ public class PracticeMode

private static void ClearPracticeEffects()
{
// 清除练习模式的所有效果。涉及的效果有五种:UI界面、循环、速度保持、速度、暂停。
// 清除练习模式的所有效果。涉及的效果有四种:UI界面、循环、速度、暂停。
if (ui != null)
{
UnityEngine.Object.Destroy(ui);
ui = null;
}
if (repeatStart >= 0 || repeatEnd >= 0) ClearRepeat();
keepNoteSpeed = false;
if (speed != 1f) SpeedReset();
if (DebugFeature.Pause) TogglePause();
}
Expand Down Expand Up @@ -223,7 +222,6 @@ public static void GameProcessPostStart()
repeatStart = -1;
repeatEnd = -1;
speed = 1;
keepNoteSpeed = false;
ui = null;
prevFreedomModeMSec = GameManager.IsFreedomMode ? GameManager.GetFreedomModeMSec() : -1;
}
Expand All @@ -235,7 +233,6 @@ public static void GameProcessPostRelease()
repeatStart = -1;
repeatEnd = -1;
speed = 1;
keepNoteSpeed = false;
ui = null;
prevFreedomModeMSec = -1;
Comment on lines 233 to 237

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

在当前修改中,为了实现跨歌曲(Track)保存“保持流速”的选项,移除了 GameProcessPostReleaseGameProcessPostStart 中的 keepNoteSpeed = false;。这确实达到了预期的效果。

然而,由于 keepNoteSpeed 是一个静态变量(public static bool keepNoteSpeed),如果完全不进行重置,该状态将会一直保留在内存中。在街机环境下,这会导致跨玩家(Credit)的状态泄露——前一个玩家开启了“保持流速”后离开,下一个玩家开始游玩时该选项默认仍会是开启状态,这可能会影响其他玩家的正常游玩体验。

为了避免这种跨会话的污染,建议在游戏返回到招揽/示教界面(即 AdvDemoProcess 启动,代表当前玩家会话已完全结束)时,将 keepNoteSpeed 重置为 false

你可以在文件后半部分的 AdvDemoProcessOnStart 方法中加上重置逻辑:

[HarmonyPrefix]
[HarmonyPatch(typeof(AdvDemoProcess), nameof(AdvDemoProcess.OnStart))]
public static void AdvDemoProcessOnStart()
{
    isInAdvDemo = true;
    keepNoteSpeed = false; // 重置流速保持,避免影响下一个玩家
}

@Starrah Starrah May 31, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我是觉得这个不重要,反正只是个练习功能;在不开启练习模式,speed=1的情况下,keepNoteSpeed没有任何作用。
而且这个原来也是这样的。我只是保证了我 #134 前后,在默认状态下行为不要有任何改变,而已

}
Expand Down
Loading