Skip to content

Commit 49ff345

Browse files
committed
feat: 分 1 2P 自定义侧键
我发现了更好的写法系列
1 parent f245f12 commit 49ff345

4 files changed

Lines changed: 44 additions & 67 deletions

File tree

.vscode/tasks.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
{
2323
"label": "Dev Server",
2424
"type": "shell",
25-
"command": "pnpm dev",
26-
"options": { "cwd": "${workspaceFolder}/MaiChartManager/Front" },
25+
"command": "pnpm --filter mcm-frontend run dev",
2726
"isBackground": true,
2827
"problemMatcher": [],
2928
"presentation": { "reveal": "always", "panel": "dedicated" },
@@ -32,8 +31,7 @@
3231
{
3332
"label": "Gen Client",
3433
"type": "shell",
35-
"command": "pnpm genClient",
36-
"options": { "cwd": "${workspaceFolder}/MaiChartManager/Front" },
34+
"command": "pnpm --filter mcm-frontend run genClient",
3735
"problemMatcher": [],
3836
"presentation": { "reveal": "always", "panel": "shared" },
3937
"icon": { "id": "refresh" }

Directory.Build.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@
33
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
44
<SelfContained>true</SelfContained>
55
</PropertyGroup>
6+
<PropertyGroup>
7+
<EnableWindowsTargeting>true</EnableWindowsTargeting>
8+
</PropertyGroup>
69
</Project>

MaiChartManager/Front/src/views/ModManager/sectionPanelOverride/GameSystem.AdxHidInput/index.tsx

Lines changed: 22 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Button, Select } from '@munet/ui';
44
import api from "@/client/api";
55
import { modInfo, updateModInfo } from "@/store/refs";
66
import { useI18n } from 'vue-i18n';
7-
import ConfigEntry, {optionsIoKeyMap} from '../../ConfigEntry';
7+
import ConfigEntry, { optionsIoKeyMap } from '../../ConfigEntry';
88
import { ENTRY_GROUP_PADDING, ENTRY_LABEL_CLASS } from '../../constants';
99

1010
export default defineComponent({
@@ -17,13 +17,21 @@ export default defineComponent({
1717
const load = ref(false)
1818
const { t } = useI18n();
1919

20+
21+
const PREFIX = 'GameSystem.AdxHidInput.';
22+
const pathsLeft = [
23+
'Button1', 'Button2',
24+
'P1Button1', 'P1Button2', 'P1Button3', 'P1Button4', 'P1DisableButtons',
25+
].map(it => PREFIX + it);
26+
27+
const pathsRight = [
28+
'Button3', 'Button4',
29+
'P2Button1', 'P2Button2', 'P2Button3', 'P2Button4', 'P2DisableButtons',
30+
].map(it => PREFIX + it);
31+
2032
const knownPaths = [
21-
'GameSystem.AdxHidInput.Button1',
22-
'GameSystem.AdxHidInput.Button2',
23-
'GameSystem.AdxHidInput.Button3',
24-
'GameSystem.AdxHidInput.Button4',
33+
...pathsLeft, ...pathsRight,
2534
];
26-
const options = optionsIoKeyMap(t);
2735

2836
const del = async () => {
2937
load.value = true
@@ -34,48 +42,24 @@ export default defineComponent({
3442

3543
return () => <div class={["flex flex-col gap-2", ENTRY_GROUP_PADDING]}>
3644
{modInfo.value?.isHidConflictExist ? <div class="flex gap-2 items-center m-l-35">
37-
<span class="c-orange">{t('mod.adxHid.conflictDetected')}</span>
38-
<Button variant="secondary" onClick={del} ing={load.value}>{t('mod.adxHid.oneClickDelete')}</Button>
39-
</div>
45+
<span class="c-orange">{t('mod.adxHid.conflictDetected')}</span>
46+
<Button variant="secondary" onClick={del} ing={load.value}>{t('mod.adxHid.oneClickDelete')}</Button>
47+
</div>
4048
: <div class="flex gap-2 items-center m-l-35">
4149
<span class="c-green-6">{t('mod.adxHid.noConflict')}</span>
4250
</div>}
4351
<div class="grid grid-cols-1 min-[500px]:grid-cols-2 gap-y-12px">
4452
<div class="flex flex-col gap-2">
45-
<div class="flex gap-2 items-start">
46-
<div class={ENTRY_LABEL_CLASS}>{t('mod.adxHid.button1')}</div>
47-
<div class="flex flex-col gap-2 w-full ws-pre-line">
48-
<Select v-model:value={props.entryStates['GameSystem.AdxHidInput.Button1'].value} options={options}/>
49-
<div class="text-sm op-80">{t('mod.adxHid.button1Desc')}</div>
50-
</div>
51-
</div>
52-
<div class="flex gap-2 items-start">
53-
<div class={ENTRY_LABEL_CLASS}>{t('mod.adxHid.button2')}</div>
54-
<div class="flex flex-col gap-2 w-full ws-pre-line">
55-
<Select v-model:value={props.entryStates['GameSystem.AdxHidInput.Button2'].value} options={options}/>
56-
<div class="text-sm op-80">{t('mod.adxHid.button2Desc')}</div>
57-
</div>
58-
</div>
53+
{props.section.entries?.filter(it => pathsLeft.includes(it.path!))
54+
.map((entry) => <ConfigEntry key={entry.path!} entry={entry} entryState={props.entryStates[entry.path!]} />)}
5955
</div>
6056
<div class="flex flex-col gap-2">
61-
<div class="flex gap-2 items-start">
62-
<div class={ENTRY_LABEL_CLASS}>{t('mod.adxHid.button3')}</div>
63-
<div class="flex flex-col gap-2 w-full ws-pre-line">
64-
<Select v-model:value={props.entryStates['GameSystem.AdxHidInput.Button3'].value} options={options}/>
65-
<div class="text-sm op-80">{t('mod.adxHid.button3Desc')}</div>
66-
</div>
67-
</div>
68-
<div class="flex gap-2 items-start">
69-
<div class={ENTRY_LABEL_CLASS}>{t('mod.adxHid.button4')}</div>
70-
<div class="flex flex-col gap-2 w-full ws-pre-line">
71-
<Select v-model:value={props.entryStates['GameSystem.AdxHidInput.Button4'].value} options={options}/>
72-
<div class="text-sm op-80">{t('mod.adxHid.button4Desc')}</div>
73-
</div>
74-
</div>
57+
{props.section.entries?.filter(it => pathsRight.includes(it.path!))
58+
.map((entry) => <ConfigEntry key={entry.path!} entry={entry} entryState={props.entryStates[entry.path!]} />)}
7559
</div>
7660
</div>
7761
{props.section.entries?.filter(it => !knownPaths.includes(it.path!))
78-
.map((entry) => <ConfigEntry key={entry.path!} entry={entry} entryState={props.entryStates[entry.path!]}/>)}
62+
.map((entry) => <ConfigEntry key={entry.path!} entry={entry} entryState={props.entryStates[entry.path!]} />)}
7963
</div>
8064
},
8165
});

MaiChartManager/Front/src/views/ModManager/sectionPanelOverride/GameSystem.MaimollerIO/index.tsx

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,20 @@ export default defineComponent({
2929

3030
const PREFIX = 'GameSystem.MaimollerIO.';
3131
const useLegacyEntryPath = PREFIX + 'UseLegacy';
32+
33+
const pathsLeft = [
34+
'Button1', 'Button2',
35+
'P1Button1', 'P1Button2', 'P1Button3', 'P1Button4',
36+
].map(it => PREFIX + it);
37+
38+
const pathsRight = [
39+
'Button3', 'Button4',
40+
'P2Button1', 'P2Button2', 'P2Button3', 'P2Button4',
41+
].map(it => PREFIX + it);
42+
3243
const knownPaths = [
33-
...['P1', 'Touch1p', 'Button1p', 'Led1p', 'P2', 'Touch2p', 'Button2p', 'Led2p', 'Button1', 'Button2', 'Button3', 'Button4'].map(it => PREFIX + it),
44+
...['P1', 'Touch1p', 'Button1p', 'Led1p', 'P2', 'Touch2p', 'Button2p', 'Led2p'].map(it => PREFIX + it),
45+
...pathsLeft, ...pathsRight,
3446
];
3547

3648
const isLegacyModeEnabled = computed(() => {
@@ -83,18 +95,8 @@ export default defineComponent({
8395
</div>
8496
</div>
8597
}
86-
<div class="flex gap-2 items-start">
87-
<div class={ENTRY_LABEL_CLASS}>{t('mod.mmlIo.button1')}</div>
88-
<div class="flex flex-col gap-2 w-full ws-pre-line">
89-
<Select v-model:value={props.entryStates[PREFIX + 'Button1'].value} options={options}/>
90-
</div>
91-
</div>
92-
<div class="flex gap-2 items-start">
93-
<div class={ENTRY_LABEL_CLASS}>{t('mod.mmlIo.button2')}</div>
94-
<div class="flex flex-col gap-2 w-full ws-pre-line">
95-
<Select v-model:value={props.entryStates[PREFIX + 'Button2'].value} options={options}/>
96-
</div>
97-
</div>
98+
{props.section.entries?.filter(it => pathsLeft.includes(it.path!))
99+
.map((entry) => <ConfigEntry key={entry.path!} entry={entry} entryState={props.entryStates[entry.path!]} />)}
98100
</div>
99101
<div class="flex flex-col gap-2">
100102
{props.section.entries?.some(it => it.path === PREFIX + 'P2') &&
@@ -115,18 +117,8 @@ export default defineComponent({
115117
</div>
116118
</div>
117119
}
118-
<div class="flex gap-2 items-start">
119-
<div class={ENTRY_LABEL_CLASS}>{t('mod.mmlIo.button3')}</div>
120-
<div class="flex flex-col gap-2 w-full ws-pre-line">
121-
<Select v-model:value={props.entryStates[PREFIX + 'Button3'].value} options={options}/>
122-
</div>
123-
</div>
124-
<div class="flex gap-2 items-start">
125-
<div class={ENTRY_LABEL_CLASS}>{t('mod.mmlIo.button4')}</div>
126-
<div class="flex flex-col gap-2 w-full ws-pre-line">
127-
<Select v-model:value={props.entryStates[PREFIX + 'Button4'].value} options={options}/>
128-
</div>
129-
</div>
120+
{props.section.entries?.filter(it => pathsRight.includes(it.path!))
121+
.map((entry) => <ConfigEntry key={entry.path!} entry={entry} entryState={props.entryStates[entry.path!]} />)}
130122
</div>
131123
</div>
132124
{props.section.entries?.filter(it => !knownPaths.includes(it.path!))

0 commit comments

Comments
 (0)