Skip to content

Commit 3acc4f1

Browse files
committed
feat: 可视化调节灵敏度
1 parent 9c2b754 commit 3acc4f1

File tree

9 files changed

+1012
-21
lines changed

9 files changed

+1012
-21
lines changed
19.5 KB
Binary file not shown.
19 KB
Binary file not shown.

MaiChartManager/Controllers/ModController.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,9 @@ public GameModInfo GetGameModInfo()
4444
public AquaMai.Config GetAquaMaiConfig()
4545
{
4646
var path = Path.Combine(StaticSettings.GamePath, "AquaMai.toml");
47-
var res = System.IO.File.Exists(path)
47+
return System.IO.File.Exists(path)
4848
? TomletMain.To<AquaMai.Config>(System.IO.File.ReadAllText(path))
4949
: new AquaMai.Config();
50-
51-
res.Cheat ??= new AquaMai.Config.CheatConfig();
52-
res.Fix ??= new AquaMai.Config.FixConfig();
53-
res.Performance ??= new AquaMai.Config.PerformanceConfig();
54-
res.UX ??= new AquaMai.Config.UXConfig();
55-
res.Utils ??= new AquaMai.Config.UtilsConfig();
56-
57-
return res;
5850
}
5951

6052
[HttpPut]

MaiChartManager/Front/src/client/apiGen.ts

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,15 @@ export interface Config {
6363
performance?: PerformanceConfig;
6464
fix?: FixConfig;
6565
utils?: UtilsConfig;
66+
touchSensitivity?: TouchSensitivityConfig;
6667
}
6768

6869
export interface FixConfig {
6970
skipVersionCheck?: boolean;
7071
removeEncryption?: boolean;
7172
forceAsServer?: boolean;
7273
forceFreePlay?: boolean;
74+
forcePaidPlay?: boolean;
7375
/** @format int32 */
7476
extendNotesPool?: number;
7577
}
@@ -242,6 +244,78 @@ export enum StorePurchaseStatus {
242244
ServerError = "ServerError",
243245
}
244246

247+
export interface TouchSensitivityConfig {
248+
enable?: boolean;
249+
/** @format int32 */
250+
a1?: number;
251+
/** @format int32 */
252+
a2?: number;
253+
/** @format int32 */
254+
a3?: number;
255+
/** @format int32 */
256+
a4?: number;
257+
/** @format int32 */
258+
a5?: number;
259+
/** @format int32 */
260+
a6?: number;
261+
/** @format int32 */
262+
a7?: number;
263+
/** @format int32 */
264+
a8?: number;
265+
/** @format int32 */
266+
b1?: number;
267+
/** @format int32 */
268+
b2?: number;
269+
/** @format int32 */
270+
b3?: number;
271+
/** @format int32 */
272+
b4?: number;
273+
/** @format int32 */
274+
b5?: number;
275+
/** @format int32 */
276+
b6?: number;
277+
/** @format int32 */
278+
b7?: number;
279+
/** @format int32 */
280+
b8?: number;
281+
/** @format int32 */
282+
c1?: number;
283+
/** @format int32 */
284+
c2?: number;
285+
/** @format int32 */
286+
d1?: number;
287+
/** @format int32 */
288+
d2?: number;
289+
/** @format int32 */
290+
d3?: number;
291+
/** @format int32 */
292+
d4?: number;
293+
/** @format int32 */
294+
d5?: number;
295+
/** @format int32 */
296+
d6?: number;
297+
/** @format int32 */
298+
d7?: number;
299+
/** @format int32 */
300+
d8?: number;
301+
/** @format int32 */
302+
e1?: number;
303+
/** @format int32 */
304+
e2?: number;
305+
/** @format int32 */
306+
e3?: number;
307+
/** @format int32 */
308+
e4?: number;
309+
/** @format int32 */
310+
e5?: number;
311+
/** @format int32 */
312+
e6?: number;
313+
/** @format int32 */
314+
e7?: number;
315+
/** @format int32 */
316+
e8?: number;
317+
}
318+
245319
export interface UXConfig {
246320
skipWarningScreen?: boolean;
247321
singlePlayer?: boolean;
@@ -271,6 +345,12 @@ export interface UploadAssetDirResult {
271345

272346
export interface UtilsConfig {
273347
logUserId?: boolean;
348+
/** @format float */
349+
judgeAdjustA?: number;
350+
/** @format float */
351+
judgeAdjustB?: number;
352+
/** @format int32 */
353+
touchDelay?: number;
274354
}
275355

276356
export interface VersionXml {
@@ -1225,7 +1305,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
12251305
SetMovie: (
12261306
id: number,
12271307
data: {
1228-
/** @format float */
1308+
/** @format double */
12291309
padding?: number;
12301310
/** @format binary */
12311311
file?: File;

MaiChartManager/Front/src/components/ModManager/ConfigEditor.tsx

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import api from "@/client/api";
66
import { capitalCase } from "change-case";
77
import ProblemsDisplay from "@/components/ProblemsDisplay";
88
import { globalCapture } from "@/store/refs";
9+
import TouchSensitivityConfigurator from "@/components/ModManager/TouchSensitivityConfigurator";
910

1011
export default defineComponent({
1112
props: {
@@ -77,7 +78,7 @@ export default defineComponent({
7778

7879
return () => <NModal
7980
preset="card"
80-
class="w-[min(65vw,70em)]"
81+
class="w-[min(90vw,70em)]"
8182
title="Mod 管理"
8283
v-model:show={show.value}
8384
>
@@ -104,17 +105,21 @@ export default defineComponent({
104105
{config.value && <NScrollbar class="max-h-60vh p-2">
105106
{Object.entries(config.value).map(([key, section]) => !!section && <>
106107
<NDivider titlePlacement="left" key={key}>{comments.sections[key]}</NDivider>
107-
{Object.keys(section).map((k) => <NFormItem key={k} label={capitalCase(k)} labelPlacement="left" labelWidth="10em">
108-
<NFlex vertical class="w-full ws-pre-line">
109-
<NFlex class="h-34px" align="center">
110-
{typeof section[k] === 'boolean' && <NSwitch v-model:value={section[k]}/>}
111-
{typeof section[k] === 'string' && <NInput v-model:value={section[k]} placeholder=""/>}
112-
{typeof section[k] === 'number' && <NInputNumber v-model:value={section[k]} placeholder=""/>}
113-
{comments.shouldEnableOptions[key]?.[k] && !section[k] && <ProblemsDisplay problems={['需要开启此选项']}/>}
108+
{key === 'touchSensitivity' ?
109+
<TouchSensitivityConfigurator config={section}/>
110+
:
111+
Object.keys(section).map((k) => <NFormItem key={k} label={capitalCase(k)} labelPlacement="left" labelWidth="10em">
112+
<NFlex vertical class="w-full ws-pre-line">
113+
<NFlex class="h-34px" align="center">
114+
{typeof section[k] === 'boolean' && <NSwitch v-model:value={section[k]}/>}
115+
{typeof section[k] === 'string' && <NInput v-model:value={section[k]} placeholder=""/>}
116+
{typeof section[k] === 'number' && <NInputNumber v-model:value={section[k]} placeholder=""/>}
117+
{comments.shouldEnableOptions[key]?.[k] && !section[k] && <ProblemsDisplay problems={['需要开启此选项']}/>}
118+
</NFlex>
119+
{comments[key]?.[k]}
114120
</NFlex>
115-
{comments[key]?.[k]}
116-
</NFlex>
117-
</NFormItem>)}
121+
</NFormItem>)
122+
}
118123
</>)}
119124
</NScrollbar>}
120125
</NFlex>
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import { defineComponent, h, PropType, ref } from "vue";
2+
import { TouchSensitivityConfig } from "@/client/apiGen";
3+
import TouchSensitivityDisplay from "@/components/ModManager/TouchSensitivityDisplay";
4+
import { NButton, NButtonGroup, NDivider, NFlex, NFormItem, NInputNumber, NSwitch } from "naive-ui";
5+
import comments from "@/components/ModManager/modComments.yaml";
6+
7+
export default defineComponent({
8+
props: {
9+
config: {type: Object as PropType<TouchSensitivityConfig>, required: true},
10+
},
11+
setup(props) {
12+
const selected = ref<keyof TouchSensitivityConfig>()
13+
14+
const applyPreset = (id: number) => {
15+
const PRESET_A = [90, 80, 70, 60, 50, 40, 30, 26, 23, 20, 10]
16+
const PRESET_OTHERS = [70, 60, 50, 40, 30, 20, 15, 10, 5, 1, 1]
17+
18+
for (const key of Object.keys(props.config)) {
19+
if (key === "enable") continue
20+
props.config[key as keyof TouchSensitivityConfig] = (key.startsWith('a') ? PRESET_A : PRESET_OTHERS)[id] as any
21+
}
22+
}
23+
24+
const applyToGlobal = (value: number) => {
25+
for (const key of Object.keys(props.config)) {
26+
if (key === "enable") continue
27+
props.config[key as keyof TouchSensitivityConfig] = value as any
28+
}
29+
}
30+
31+
const applyToArea = (area: 'a' | 'b' | 'c' | 'd' | 'e', value: number) => {
32+
for (const key of Object.keys(props.config)) {
33+
if (key === "enable") continue
34+
if (key.startsWith(area)) {
35+
props.config[key as keyof TouchSensitivityConfig] = value as any
36+
}
37+
}
38+
}
39+
40+
return () => <NFlex vertical class="mb">
41+
<NFormItem label="启用此功能" labelPlacement="left" labelWidth="10em">
42+
<NFlex vertical class="w-full ws-pre-line">
43+
<NFlex class="h-34px" align="center">
44+
<NSwitch v-model:value={props.config.enable}/>
45+
</NFlex>
46+
这里启用之后 Test 里的就不再起作用了,不过还是可以使用 Test 测试
47+
</NFlex>
48+
</NFormItem>
49+
<NFlex size="large">
50+
<TouchSensitivityDisplay config={props.config} v-model:currentSelected={selected.value}/>
51+
<NFlex vertical>
52+
应用预设到全局
53+
<NButtonGroup class="mb">
54+
{Array.from({length: 11}, (_, i) => <NButton secondary class={i > 0 ? 'b-l b-l-solid b-l-[rgba(255,255,255,0.5)]' : ''} onClick={() => applyPreset(i)}>{i - 5 > 0 && '+'}{i - 5}</NButton>)}
55+
</NButtonGroup>
56+
{selected.value ? <>
57+
{selected.value.toUpperCase()} 的灵敏度设置
58+
<NInputNumber v-model:value={props.config[selected.value]} min={0} max={100} step={1}/>
59+
<NFlex class="mb">
60+
<NButton secondary onClick={() => applyToGlobal(props.config[selected.value!] as any)}>应用到全局</NButton>
61+
<NButton secondary onClick={() => applyToArea(selected.value!.substring(0, 1) as any, props.config[selected.value!] as any)}>应用到 {selected.value.substring(0, 1).toUpperCase()} 区域</NButton>
62+
</NFlex>
63+
</> :
64+
<div class="mb">
65+
在左侧选择区域后,可以在这里进行灵敏度微调
66+
</div>
67+
}
68+
<div class="lh-relaxed">
69+
在 Test 模式下调整的灵敏度不是线性的<br/>
70+
A 区默认灵敏度 90, 80, 70, 60, 50, 40, 30, 26, 23, 20, 10<br/>
71+
其他区域默认灵敏度 70, 60, 50, 40, 30, 20, 15, 10, 5, 1, 1<br/>
72+
Test 里设置的 0 对应的是 40, 20 这一档,-5 是 90, 70,+5 是 10, 1<br/>
73+
Test 里的挡位更高,这里的数字越小,对于官机来说,灵敏度更大<br/>
74+
而 ADX 的灵敏度是反的,所以对于 ADX,这里的数字越大,灵敏度越大
75+
</div>
76+
</NFlex>
77+
</NFlex>
78+
</NFlex>;
79+
}
80+
})
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.region
2+
cursor: pointer
3+
4+
:nth-child(1)
5+
fill: #a3c4ff
6+
fill-opacity: .4
7+
transition: fill-opacity .2s
8+
9+
&:hover
10+
:nth-child(1)
11+
fill-opacity: .7
12+
13+
&.selected
14+
:nth-child(1)
15+
fill-opacity: 1
16+
cursor: default

0 commit comments

Comments
 (0)