Skip to content

Commit 23dad87

Browse files
committed
[O] 不要用反射获取 mod 的b判
1 parent ece9020 commit 23dad87

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed

AquaMai.Mods/GameSettings/JudgeAdjust.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ public class JudgeAdjust
1515
[ConfigEntry(
1616
name: "A判",
1717
en: "Adjust A judgment.")]
18-
private static readonly double a = 0;
18+
public static readonly double a = 0;
1919

2020
[ConfigEntry(
2121
name: "B判",
2222
en: "Adjust B judgment.")]
23-
private static readonly double b = 0;
23+
public static readonly double b = 0;
2424

2525
[ConfigEntry(
2626
name: "触摸延迟",
2727
en: "Increase touch delay.",
2828
zh: "增加触摸延迟(不建议使用)")]
29-
private static readonly uint touchDelay = 0;
29+
public static readonly uint touchDelay = 0;
3030

3131
[HarmonyPostfix]
3232
[HarmonyPatch(typeof(UserOption), "GetAdjustMSec")]

AquaMai.Mods/Utils/UnstableRate.cs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,6 @@ private struct Timing
5656

5757
private static GameObject[] baseObjects = new GameObject[2];
5858
private static LinePool[] linePools = new LinePool[2];
59-
private static readonly FieldInfo _judgeAdjustBField;
60-
61-
static UnstableRate()
62-
{
63-
// 尝试通过反射获取 AquaMai.Mods.GameSettings.JudgeAdjust 类中的私有字段 'b'
64-
_judgeAdjustBField = AccessTools.Field(typeof(JudgeAdjust), "b");
65-
}
66-
67-
private static double GetJudgeAdjustB()
68-
{
69-
if (_judgeAdjustBField != null)
70-
{
71-
return (double)_judgeAdjustBField.GetValue(null);
72-
}
73-
return 0;
74-
}
7559

7660
[HarmonyPostfix]
7761
[HarmonyPatch(typeof(GameProcess), "OnStart")]
@@ -106,7 +90,7 @@ public static void OnJudge(NoteBase __instance, float ___JudgeTimingDiffMsec)
10690
msec -= optionJudgeTiming * TimingBin;
10791

10892
// Account for the mod adjustment B judgement offset
109-
double modAdjustB = GetJudgeAdjustB();
93+
double modAdjustB = JudgeAdjust.b;
11094
msec += (float)(modAdjustB * TimingBin);
11195

11296
// Don't process misses

0 commit comments

Comments
 (0)