diff --git a/AquaMai.Core/Resources/Locale.Designer.cs b/AquaMai.Core/Resources/Locale.Designer.cs
index 97795c2f..0ab3bf5d 100644
--- a/AquaMai.Core/Resources/Locale.Designer.cs
+++ b/AquaMai.Core/Resources/Locale.Designer.cs
@@ -69,7 +69,7 @@ public static string AutoplayOn {
}
///
- /// Looks up a localized string similar to Autoplay was used, score will not be saved..
+ /// Looks up a localized string similar to Autoplay/PracticeMode was used, score will not be saved..
///
public static string AutoplayWasUsed {
get {
@@ -227,7 +227,7 @@ public static string NextPlayShowTouchDisplay {
/// Looks up a localized string similar to Did you double-click Sinmai.exe directly? That's not how it works. There should be something called "start.bat" or "启动.bat", and you need to use it to start.
///Check if your AMDaemon is still alive (look for a command line window called AMDaemon.exe running in the background).
///If the window has disappeared, then there might be some issues with your configuration. Please check your segatools.ini carefully.
- ///Maybe the window is there, but it's constantly scrolling errors. If that's the case, then there might als [rest of string was truncated]";.
+ ///Maybe the window is there, but it's constantly scrolling errors. If that's the case, then there might [rest of string was truncated]";.
///
public static string NoAmDaemonAlertMessage {
get {
diff --git a/AquaMai.Core/Resources/Locale.resx b/AquaMai.Core/Resources/Locale.resx
index bbc60ebe..97c01eff 100644
--- a/AquaMai.Core/Resources/Locale.resx
+++ b/AquaMai.Core/Resources/Locale.resx
@@ -170,7 +170,7 @@ Press {2} to switch block or exit adjustment mode
AutoPlay On
- Autoplay was used, score will not be saved.
+ Autoplay/PracticeMode was used, score will not be saved.
==================================================================!!!
diff --git a/AquaMai.Core/Resources/Locale.zh.resx b/AquaMai.Core/Resources/Locale.zh.resx
index 93996943..0a2c4697 100644
--- a/AquaMai.Core/Resources/Locale.zh.resx
+++ b/AquaMai.Core/Resources/Locale.zh.resx
@@ -163,7 +163,7 @@
AutoPlay开启中
- Autoplay曾开启过,本曲成绩不会被上传。
+ Autoplay或练习模式曾开启过,本曲成绩不会被上传。
=============================================!!!
diff --git a/AquaMai.Mods/Fix/DebugFeature.cs b/AquaMai.Mods/Fix/DebugFeature.cs
index 11dadff8..ae58c26a 100644
--- a/AquaMai.Mods/Fix/DebugFeature.cs
+++ b/AquaMai.Mods/Fix/DebugFeature.cs
@@ -2,6 +2,7 @@
using System.Reflection;
using AquaMai.Config.Attributes;
using AquaMai.Mods.GameSystem;
+using AquaMai.Mods.UX;
using HarmonyLib;
using MAI2.Util;
using Manager;
@@ -118,6 +119,7 @@ public static bool Pause
SoundManager.PauseMusic(value);
GameMoviePause(value);
NotesManager.Pause(value);
+ if (value) DontRuinMyAccount.triggerForPracticeMode();
}
}
@@ -132,6 +134,7 @@ public static void Seek(int msec)
{
_debugFeatureType.GetMethod("DebugTimeSkip", BindingFlags.Instance | BindingFlags.Public).Invoke(_debugFeatureOriginal, new object[] { msec });
}
+ DontRuinMyAccount.triggerForPracticeMode();
}
public static double CurrentPlayMsec
@@ -242,6 +245,7 @@ public static void Postfix(byte ____sequence)
SoundManager.PauseMusic(isPause);
GameMoviePause(isPause);
NotesManager.Pause(isPause);
+ if (isPause) DontRuinMyAccount.triggerForPracticeMode();
}
else if (DebugInput.GetKeyDown(KeyCode.LeftArrow) || DebugInput.GetKeyDown(KeyCode.RightArrow))
{
@@ -261,6 +265,7 @@ public static void Postfix(byte ____sequence)
: (num23 * 5));
Singleton.Instance.Initialize();
DebugTimeSkip(addMsec);
+ DontRuinMyAccount.triggerForPracticeMode();
}
}
}
diff --git a/AquaMai.Mods/UX/DontRuinMyAccount.cs b/AquaMai.Mods/UX/DontRuinMyAccount.cs
index a8b3c986..0f172249 100644
--- a/AquaMai.Mods/UX/DontRuinMyAccount.cs
+++ b/AquaMai.Mods/UX/DontRuinMyAccount.cs
@@ -1,5 +1,4 @@
using System;
-using System.Reflection;
using AquaMai.Config.Attributes;
using AquaMai.Core.Attributes;
using AquaMai.Core.Helpers;
@@ -26,43 +25,40 @@ public class DontRuinMyAccount
{
[ConfigEntry(zh: "AutoPlay 激活后显示提示", en: "Show notice when AutoPlay is activated")]
public static readonly bool showNotice = true;
+ [ConfigEntry(zh: "使用练习模式/DebugFeature相关功能也不保存成绩", en: "Also not save scores when using PracticeMode/DebugFeature")]
+ public static readonly bool forPracticeMode = true;
+
+ private static bool Enabled = false; // 需要有一个flag来标记本模块是否被disable了,不然如果disable了本模块后,开练习模式时调用到triggerForPracticeMode还是触发了功能就不对了。
private static uint currentTrackNumber => GameManager.MusicTrackNumber;
public static bool ignoreScore;
private static UserScore oldScore;
+
+ // 当练习模式相关功能启动时,应当调用本函数
+ public static void triggerForPracticeMode()
+ {
+ if (forPracticeMode) trigger();
+ }
- [HarmonyPatch(typeof(GameProcess), "OnUpdate")]
- [HarmonyPostfix]
- public static void OnUpdate()
+ public static void trigger()
{
- if (GameManager.IsInGame && GameManager.IsAutoPlay() && !ignoreScore)
- {
- if (GameManager.IsKaleidxScopeMode)
- {
- if (Singleton.Instance.gateId == 8 ||
- Singleton.Instance.gateId == 10)
- {
- ignoreScore = false;
- }
- else
- {
- ignoreScore = true;
- MelonLogger.Msg("[DontRuinMyAccount] Autoplay triggered, will ignore this score.");
- }
- }
- else
- {
- ignoreScore = true;
- MelonLogger.Msg("[DontRuinMyAccount] Autoplay triggered, will ignore this score.");
- }
- }
+ if (!(Enabled && !ignoreScore && GameManager.IsInGame)) return;
+ // 对8号和10号门,永不启用防毁号(它们中用到了autoplay功能来模拟特殊谱面效果)
+ if (GameManager.IsKaleidxScopeMode && (Singleton.Instance.gateId == 8 ||
+ Singleton.Instance.gateId == 10)) return;
+ ignoreScore = true;
+ MelonLogger.Msg("[DontRuinMyAccount] Triggered. Will ignore this score.");
+ }
+
+ public static void OnBeforePatch()
+ {
+ Enabled = true;
}
- [HarmonyPatch(typeof(GameProcess), "OnStart")]
+ [HarmonyPatch(typeof(GameProcess), "OnUpdate")]
[HarmonyPostfix]
- [EnableIf(nameof(showNotice))]
- public static void OnStart(GameMonitor[] ____monitors)
+ public static void OnUpdate()
{
- ____monitors[0].gameObject.AddComponent();
+ if (GameManager.IsInGame && GameManager.IsAutoPlay()) trigger();
}
[HarmonyPrefix]
@@ -107,13 +103,25 @@ public static void AfterResultProcessStart()
ignoreScore = false;
var musicid = GameManager.SelectMusicID[0];
var difficulty = GameManager.SelectDifficultyID[0];
+
// current music playlog
var score = Singleton.Instance.GetGameScore(0, (int)currentTrackNumber - 1);
- // score.Achivement = 0; // Private setter, so reflection is essential
- typeof(GameScoreList).GetProperty("Achivement", BindingFlags.Public | BindingFlags.Instance)?.GetSetMethod(true)?.Invoke(score, [0m]);
- typeof(GameScoreList).GetProperty("ComboType", BindingFlags.Public | BindingFlags.Instance)?.GetSetMethod(true)?.Invoke(score, [PlayComboflagID.None]);
- typeof(GameScoreList).GetProperty("NowComboType", BindingFlags.Public | BindingFlags.Instance)?.GetSetMethod(true)?.Invoke(score, [PlayComboflagID.None]);
+ var t = Traverse.Create(score);
+ // 设置各个成绩相关的字段,清零
+ t.Property("Achivement").Value = 0m;
+ t.Property("ComboType").Value = PlayComboflagID.None;
+ t.Property("NowComboType").Value = PlayComboflagID.None;
score.SyncType = PlaySyncflagID.None;
+ score.IsClear = false;
+ t.Property("DxScore").Value = 0u;
+ t.Property("MaxCombo").Value = 0u;
+ t.Property("MaxChain").Value = 0u; // 最大同步数
+ // 把所有判定结果清零(直接把判定表清零,而不是转为miss)
+ t.Property("Fast").Value = 0u;
+ t.Property("Late").Value = 0u;
+ var judgeList = t.Field("_resultList").Value;
+ Array.Clear(judgeList, 0, judgeList.Length);
+
// user's all scores
var userData = Singleton.Instance.GetUserData(0);
var userScoreDict = userData.ScoreDic[difficulty];
@@ -131,10 +139,10 @@ public static void AfterResultProcessStart()
[HarmonyPostfix]
[HarmonyPatch(typeof(GameProcess), nameof(GameProcess.OnStart))]
- public static void OnGameStart()
+ public static void OnGameStart(GameMonitor[] ____monitors)
{
- // For compatibility with QuickRetry
- ignoreScore = false;
+ ignoreScore = false; // For compatibility with QuickRetry
+ if (showNotice) ____monitors[0].gameObject.AddComponent();
}
private class NoticeUI : MonoBehaviour
diff --git a/AquaMai.Mods/UX/PracticeMode/PracticeMode.cs b/AquaMai.Mods/UX/PracticeMode/PracticeMode.cs
index 762377b0..5ad2c821 100644
--- a/AquaMai.Mods/UX/PracticeMode/PracticeMode.cs
+++ b/AquaMai.Mods/UX/PracticeMode/PracticeMode.cs
@@ -69,6 +69,8 @@ public static void ClearRepeat()
public static void SetSpeed()
{
+ DontRuinMyAccount.triggerForPracticeMode();
+
player.SetPitch((float)(1200 * Math.Log(speed, 2)));
// player.SetDspTimeStretchRatio(1 / speed);
player.UpdateAll();