Files
AquaDX/AquaMai/AquaMai.Mods/GameSettings/TouchSensitivity.cs
Menci 37044dae01 [RF] AquaMai configuration refactor (#82)
更新了配置文件格式,原有的配置文件将被自动无缝迁移,详情请见新的配置文件中的注释(例外:`SlideJudgeTweak` 不再默认启用)
旧配置文件将被重命名备份,如果更新到此版本遇到 Bug 请联系我们

Updated configuration file schema. The old config file will be migrated automatically and seamlessly. See the comments in the new configuration file for details. (Except for `SlideJudgeTweak` is no longer enabled by default)
Your old configuration file will be renamed as a backup. If you encounter any bug with this version, please contact us.
2024-11-25 01:25:19 +08:00

155 lines
4.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Collections.Generic;
using System.Reflection;
using AquaMai.Config.Attributes;
using HarmonyLib;
using IO;
using Manager;
using MelonLoader;
namespace AquaMai.Mods.GameSettings;
[ConfigSection(
en: """
Use custom touch sensitivity.
When enabled, the settings in Test mode will not take effect.
When disabled, the settings in Test mode is used.
Sensitivity adjustments in Test mode are not linear.
Default sensitivity in area A: 90, 80, 70, 60, 50, 40, 30, 26, 23, 20, 10.
Default sensitivity in other areas: 70, 60, 50, 40, 30, 20, 15, 10, 5, 1, 1.
A setting of 0 in Test mode corresponds to 40, 20 here, -5 corresponds to 90, 70, +5 corresponds to 10, 1.
The higher the number in Test mode, the lower the number here, resulting in higher sensitivity for official machines.
For ADX, the sensitivity is reversed, so the higher the number here, the higher the sensitivity.
""",
zh: """
使用自定义触摸灵敏度
这里启用之后 Test 里的就不再起作用了
这里禁用之后就还是用 Test 里的调
在 Test 模式下调整的灵敏度不是线性的
A 区默认灵敏度 90, 80, 70, 60, 50, 40, 30, 26, 23, 20, 10
其他区域默认灵敏度 70, 60, 50, 40, 30, 20, 15, 10, 5, 1, 1
Test 里设置的 0 对应的是 40, 20 这一档,-5 是 90, 70+5 是 10, 1
Test 里的数字越大,这里的数字越小,对于官机来说,灵敏度更大
而 ADX 的灵敏度是反的,所以对于 ADX这里的数字越大灵敏度越大
""")]
public class TouchSensitivity
{
[ConfigEntry]
private static readonly byte A1 = 40;
[ConfigEntry]
private static readonly byte A2 = 40;
[ConfigEntry]
private static readonly byte A3 = 40;
[ConfigEntry]
private static readonly byte A4 = 40;
[ConfigEntry]
private static readonly byte A5 = 40;
[ConfigEntry]
private static readonly byte A6 = 40;
[ConfigEntry]
private static readonly byte A7 = 40;
[ConfigEntry]
private static readonly byte A8 = 40;
[ConfigEntry]
private static readonly byte B1 = 20;
[ConfigEntry]
private static readonly byte B2 = 20;
[ConfigEntry]
private static readonly byte B3 = 20;
[ConfigEntry]
private static readonly byte B4 = 20;
[ConfigEntry]
private static readonly byte B5 = 20;
[ConfigEntry]
private static readonly byte B6 = 20;
[ConfigEntry]
private static readonly byte B7 = 20;
[ConfigEntry]
private static readonly byte B8 = 20;
[ConfigEntry]
private static readonly byte C1 = 20;
[ConfigEntry]
private static readonly byte C2 = 20;
[ConfigEntry]
private static readonly byte D1 = 20;
[ConfigEntry]
private static readonly byte D2 = 20;
[ConfigEntry]
private static readonly byte D3 = 20;
[ConfigEntry]
private static readonly byte D4 = 20;
[ConfigEntry]
private static readonly byte D5 = 20;
[ConfigEntry]
private static readonly byte D6 = 20;
[ConfigEntry]
private static readonly byte D7 = 20;
[ConfigEntry]
private static readonly byte D8 = 20;
[ConfigEntry]
private static readonly byte E1 = 20;
[ConfigEntry]
private static readonly byte E2 = 20;
[ConfigEntry]
private static readonly byte E3 = 20;
[ConfigEntry]
private static readonly byte E4 = 20;
[ConfigEntry]
private static readonly byte E5 = 20;
[ConfigEntry]
private static readonly byte E6 = 20;
[ConfigEntry]
private static readonly byte E7 = 20;
[ConfigEntry]
private static readonly byte E8 = 20;
[HarmonyPrefix]
[HarmonyPatch(typeof(NewTouchPanel), "SetTouchPanelSensitivity")]
public static void SetTouchPanelSensitivityPrefix(List<byte> sensitivity)
{
var configType = typeof(TouchSensitivity);
for (var i = 0; i < 34; i++)
{
var area = (InputManager.TouchPanelArea)i;
var field = configType.GetField(area.ToString(), BindingFlags.NonPublic | BindingFlags.Static);
var value = (byte)field.GetValue(null);
sensitivity[i] = value;
}
MelonLogger.Msg("[TouchSensitivity] Applied");
}
}