Skip to content

Commit 9e8cc36

Browse files
committed
Merge branch 'main' of github.com:clansty/MaiChartManager
2 parents 16c7715 + 10f63d1 commit 9e8cc36

9 files changed

Lines changed: 105 additions & 31 deletions

File tree

MaiChartManager/Front/src/locales/en.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ mod:
320320
select2P: 2P Select
321321
service: Service
322322
test: Test
323+
customFn: 'Custom FnKey '
323324
adxHid:
324325
disabled: Disabled
325326
select1P: 1P Select

MaiChartManager/Front/src/locales/zh-TW.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ mod:
298298
select2P: 2P 選擇
299299
service: 服務
300300
test: 測試
301+
customFn: 自訂功能鍵
301302
adxHid:
302303
disabled: 停用
303304
select1P: 1P 選擇

MaiChartManager/Front/src/locales/zh.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ mod:
298298
select2P: 2P 选择
299299
service: 服务
300300
test: 测试
301+
customFn: 自定义功能键
301302
adxHid:
302303
conflictDetected: 检测到冲突的 Mod
303304
oneClickDelete: 一键删除

MaiChartManager/Front/src/views/ModManager/ConfigEntry.tsx

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,46 @@ import { KeyCodeName } from "./types/KeyCodeName";
66
import { getNameForPath } from "./utils";
77
import comments from "./modComments.yaml";
88
import { KeyCodeID } from "./types/KeyCodeID";
9+
import { VKCode } from "./types/VKCode";
910
import { useI18n } from 'vue-i18n';
1011
import { locale } from "@/locales";
1112
import { ENTRY_LABEL_CLASS } from "./constants";
1213

14+
/* t需要传入是Vue的i18n翻译函数 */
15+
export function optionsIoKeyMap(t: (key: string) => string): { label: string, value: string }[] {
16+
return [
17+
{ label: t('mod.ioKeyMap.disabled'), value: 'None' },
18+
{ label: t('mod.ioKeyMap.select'), value: 'Select' },
19+
{ label: t('mod.ioKeyMap.select1P'), value: 'Select1P' },
20+
{ label: t('mod.ioKeyMap.select2P'), value: 'Select2P' },
21+
{ label: t('mod.ioKeyMap.service'), value: 'Service' },
22+
{ label: t('mod.ioKeyMap.test'), value: 'Test' },
23+
{ label: t('mod.ioKeyMap.customFn') + "1", value: 'CustomFn1' },
24+
{ label: t('mod.ioKeyMap.customFn') + "2", value: 'CustomFn2' },
25+
{ label: t('mod.ioKeyMap.customFn') + "3", value: 'CustomFn3' },
26+
{ label: t('mod.ioKeyMap.customFn') + "4", value: 'CustomFn4' },
27+
];
28+
}
29+
30+
export function optionsKeyCodeOrName(t: (key: string) => string): { label: string, value: string }[] {
31+
return Object.entries(KeyCodeName).map(([label, value]) => {
32+
if (label.startsWith("CustomFn")) { // "自定义功能键"需要单独i18n
33+
const suffix = label.slice('CustomFn'.length);
34+
return { label: t('mod.ioKeyMap.customFn') + suffix, value };
35+
}
36+
return { label, value }; // 其他的则沿用枚举中的值
37+
});
38+
}
39+
40+
export function optionsVKCode(t: (key: string) => string): { label: string, value: string }[] {
41+
return Object.entries(VKCode).map(([label, value]) => {
42+
if (label == "None") { // 单独翻译为“禁用”
43+
return { label: t('mod.disable'), value };
44+
}
45+
return { label, value }; // 其他的则沿用枚举中的值
46+
});
47+
}
48+
1349
export default defineComponent({
1450
props: {
1551
entry: { type: Object as PropType<Entry>, required: true },
@@ -18,15 +54,6 @@ export default defineComponent({
1854
setup(props, { emit }) {
1955
const { t, te } = useI18n();
2056

21-
const optionsIoKeyMap = [
22-
{ label: t('mod.ioKeyMap.disabled'), value: 'None' },
23-
{ label: t('mod.ioKeyMap.select'), value: 'Select' },
24-
{ label: t('mod.ioKeyMap.select1P'), value: 'Select1P' },
25-
{ label: t('mod.ioKeyMap.select2P'), value: 'Select2P' },
26-
{ label: t('mod.ioKeyMap.service'), value: 'Service' },
27-
{ label: t('mod.ioKeyMap.test'), value: 'Test' },
28-
];
29-
3057
const optionsSoundChannel = ['None', 'P1SpeakerLeft', 'P1SpeakerRight', 'P1HeadphoneLeft', 'P1HeadphoneRight', 'P2SpeakerLeft', 'P2SpeakerRight', 'P2HeadphoneLeft', 'P2HeadphoneRight']
3158
.map(channel => ({ label: t('mod.soundChannel.' + channel), value: channel }));
3259

@@ -74,13 +101,14 @@ export default defineComponent({
74101
case 'System.Single':
75102
return <NumberInput innerClass="h-42px!" v-model:value={props.entryState.value} step={.1} decimal={4}/>;
76103
case 'AquaMai.Config.Types.KeyCodeOrName':
77-
return <Select v-model:value={props.entryState.value} options={Object.entries(KeyCodeName).map(([label, value]) => ({ label, value }))}/>;
104+
return <Select v-model:value={props.entryState.value} options={optionsKeyCodeOrName(t)}/>;
78105
case 'AquaMai.Config.Types.KeyCodeID':
79106
return <Select v-model:value={props.entryState.value} options={Object.entries(KeyCodeID).map(([label, value]) => ({label, value}))}/>;
80107
case 'AquaMai.Config.Types.IOKeyMap':
81-
return <Select v-model:value={props.entryState.value} options={optionsIoKeyMap}/>;
82108
case 'AquaMai.Config.Types.AdxKeyMap':
83-
return <Select v-model:value={props.entryState.value} options={optionsIoKeyMap}/>;
109+
return <Select v-model:value={props.entryState.value} options={optionsIoKeyMap(t)}/>;
110+
case 'AquaMai.Config.Types.VKCode':
111+
return <Select v-model:value={props.entryState.value} options={optionsVKCode(t)}/>;
84112
case 'AquaMai.Config.Types.SoundChannel':
85113
return <Select v-model:value={props.entryState.value} options={optionsSoundChannel}/>;
86114
}

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

Lines changed: 2 additions & 9 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 from '../../ConfigEntry';
7+
import ConfigEntry, {optionsIoKeyMap} from '../../ConfigEntry';
88
import { ENTRY_GROUP_PADDING, ENTRY_LABEL_CLASS } from '../../constants';
99

1010
export default defineComponent({
@@ -23,14 +23,7 @@ export default defineComponent({
2323
'GameSystem.AdxHidInput.Button3',
2424
'GameSystem.AdxHidInput.Button4',
2525
];
26-
const options = [
27-
{ label: t('mod.ioKeyMap.disabled'), value: 'None' },
28-
{ label: t('mod.ioKeyMap.select'), value: 'Select' },
29-
{ label: t('mod.ioKeyMap.select1P'), value: 'Select1P' },
30-
{ label: t('mod.ioKeyMap.select2P'), value: 'Select2P' },
31-
{ label: t('mod.ioKeyMap.service'), value: 'Service' },
32-
{ label: t('mod.ioKeyMap.test'), value: 'Test' },
33-
];
26+
const options = optionsIoKeyMap(t);
3427

3528
const del = async () => {
3629
load.value = true

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

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { globalCapture, modInfo, updateModInfo } from '@/store/refs';
55
import { useAsyncState } from '@vueuse/core';
66
import { Button, Select, CheckBox } from '@munet/ui';
77
import { defineComponent, PropType, ref, computed, watch } from 'vue';
8-
import ConfigEntry from '../../ConfigEntry';
8+
import ConfigEntry, {optionsIoKeyMap} from '../../ConfigEntry';
99
import { ENTRY_GROUP_PADDING, ENTRY_LABEL_CLASS } from '../../constants';
1010

1111
export default defineComponent({
@@ -25,14 +25,7 @@ export default defineComponent({
2525
},
2626
})
2727

28-
const options = [
29-
{ label: t('mod.ioKeyMap.disabled'), value: 'None' },
30-
{ label: t('mod.ioKeyMap.select'), value: 'Select' },
31-
{ label: t('mod.ioKeyMap.select1P'), value: 'Select1P' },
32-
{ label: t('mod.ioKeyMap.select2P'), value: 'Select2P' },
33-
{ label: t('mod.ioKeyMap.service'), value: 'Service' },
34-
{ label: t('mod.ioKeyMap.test'), value: 'Test' },
35-
];
28+
const options = optionsIoKeyMap(t);
3629

3730
const PREFIX = 'GameSystem.MaimollerIO.';
3831
const useLegacyEntryPath = PREFIX + 'UseLegacy';
@@ -62,7 +55,7 @@ export default defineComponent({
6255
return () => <div class={["flex flex-col gap-2", ENTRY_GROUP_PADDING]}>
6356
{!isMmlRequirementSatisfied.value ? <div class="flex gap-2 items-center m-l-35">
6457
<span class="c-orange">{t('mod.mmlIo.notInstalled')}</span>
65-
<Button variant="secondary" onClick={() => install.execute()} ing={install.isLoading.value}>{t('mod.oneClickInstall')}</Button>
58+
<Button variant="secondary" onClick={() => install.execute()} ing={install.isLoading.value}>{t('mod.mmlIo.oneClickInstall')}</Button>
6659
</div>
6760
: <div class="flex gap-2 items-center m-l-35">
6861
<span class="c-green-6">{t('mod.mmlIo.installed')}</span>

MaiChartManager/Front/src/views/ModManager/types/KeyCodeName.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,8 @@ export enum KeyCodeName {
4646
Select2P = "Select2P",
4747
Service = "Service",
4848
Test = "Test",
49+
CustomFn1 = "CustomFn1",
50+
CustomFn2 = "CustomFn2",
51+
CustomFn3 = "CustomFn3",
52+
CustomFn4 = "CustomFn4",
4953
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
export enum VKCode {
2+
None = "None",
3+
Alpha0 = "Alpha0", // 0 键
4+
Alpha1 = "Alpha1",
5+
Alpha2 = "Alpha2",
6+
Alpha3 = "Alpha3",
7+
Alpha4 = "Alpha4",
8+
Alpha5 = "Alpha5",
9+
Alpha6 = "Alpha6",
10+
Alpha7 = "Alpha7",
11+
Alpha8 = "Alpha8",
12+
Alpha9 = "Alpha9",
13+
Keypad0 = "Keypad0", // 数字键盘 0 键
14+
Keypad1 = "Keypad1",
15+
Keypad2 = "Keypad2",
16+
Keypad3 = "Keypad3",
17+
Keypad4 = "Keypad4",
18+
Keypad5 = "Keypad5",
19+
Keypad6 = "Keypad6",
20+
Keypad7 = "Keypad7",
21+
Keypad8 = "Keypad8",
22+
Keypad9 = "Keypad9",
23+
F1 = "F1",
24+
F2 = "F2",
25+
F3 = "F3",
26+
F4 = "F4",
27+
F5 = "F5",
28+
F6 = "F6",
29+
F7 = "F7",
30+
F8 = "F8",
31+
F9 = "F9",
32+
F10 = "F10",
33+
F11 = "F11",
34+
F12 = "F12",
35+
Enter = "Enter", // VK_RETURN 输入键
36+
Space = "Space", // 空格键
37+
Backspace = "Backspace", // VK_BACK
38+
Tab = "Tab",
39+
Esc = "Esc", // VK_ESCAPE
40+
Insert = "Insert",
41+
Delete = "Delete",
42+
Home = "Home",
43+
End = "End",
44+
Pause = "Pause",
45+
PageUp = "PageUp", // VK_PRIOR
46+
PageDown = "PageDown", // VK_NEXT
47+
UpArrow = "UpArrow", // VK_UP
48+
DownArrow = "DownArrow", // VK_DOWN
49+
LeftArrow = "LeftArrow", // VK_LEFT
50+
RightArrow = "RightArrow", // VK_RIGHT
51+
}

MaiChartManager/Services/MaidataImportService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ public ImportChartResult ImportMaidata(
274274
foreach (var (key, value) in kvps)
275275
{
276276
maiData[key] = value;
277+
if (key.StartsWith("inote") || key.StartsWith("lv") || key.StartsWith("first") ||
278+
key.StartsWith("wholebpm")) maiData[key] = maiData[key].Trim();
277279
}
278280

279281
var allCharts = new Dictionary<int, AllChartsEntry>();

0 commit comments

Comments
 (0)