mirror of
https://github.com/AkiChase/scrcpy-mask
synced 2025-02-22 14:42:15 +08:00
feat(i18n): add keyboard page i18n
This commit is contained in:
parent
4c2b0ad84b
commit
e266c7b3bf
@ -18,7 +18,9 @@ import { useGlobalStore } from "../../store/global";
|
||||
import { DropdownOption, NDropdown, useDialog, useMessage } from "naive-ui";
|
||||
import { onBeforeRouteLeave } from "vue-router";
|
||||
import { useKeyboardStore } from "../../store/keyboard";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
const { t } = useI18n();
|
||||
const store = useGlobalStore();
|
||||
const keyboardStore = useKeyboardStore();
|
||||
const dialog = useDialog();
|
||||
@ -27,27 +29,27 @@ const message = useMessage();
|
||||
const addButtonPos = ref({ x: 0, y: 0 });
|
||||
const addButtonOptions: DropdownOption[] = [
|
||||
{
|
||||
label: "普通点击",
|
||||
label: () => t("pages.KeyBoard.addButton.Tap"),
|
||||
key: "Tap",
|
||||
},
|
||||
{
|
||||
label: "键盘行走",
|
||||
label: () => t("pages.KeyBoard.addButton.SteeringWheel"),
|
||||
key: "SteeringWheel",
|
||||
},
|
||||
{
|
||||
label: "技能",
|
||||
label: () => t("pages.KeyBoard.addButton.Skill"),
|
||||
key: "DirectionalSkill",
|
||||
},
|
||||
{
|
||||
label: "技能取消",
|
||||
label: () => t("pages.KeyBoard.addButton.CancelSkill"),
|
||||
key: "CancelSkill",
|
||||
},
|
||||
{
|
||||
label: "观察视角",
|
||||
label: () => t("pages.KeyBoard.addButton.Observation"),
|
||||
key: "Observation",
|
||||
},
|
||||
{
|
||||
label: "宏",
|
||||
label: () => t("pages.KeyBoard.addButton.Macro"),
|
||||
key: "Macro",
|
||||
},
|
||||
];
|
||||
@ -83,7 +85,7 @@ function onAddButtonSelect(
|
||||
} else if (type === "DirectionalSkill") {
|
||||
(keyMapping as unknown as KeyDirectionalSkill).range = 30;
|
||||
} else if (type === "CancelSkill") {
|
||||
keyMapping.note = "取消技能";
|
||||
keyMapping.note = t("pages.KeyBoard.addButton.CancelSkill");
|
||||
} else if (type === "Observation") {
|
||||
(keyMapping as unknown as KeyMappingObservation).scale = 0.6;
|
||||
} else if (type === "Macro") {
|
||||
@ -141,7 +143,7 @@ function setCurButtonKey(curKey: string) {
|
||||
return;
|
||||
|
||||
if (!isKeyUnique(curKey)) {
|
||||
message.error("按键重复:" + curKey);
|
||||
message.error(t("pages.KeyBoard.buttonKeyRepeat", [curKey]));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -250,16 +252,16 @@ onBeforeRouteLeave(() => {
|
||||
document.removeEventListener("wheel", handleMouseWheel);
|
||||
if (keyboardStore.edited) {
|
||||
dialog.warning({
|
||||
title: "Warning",
|
||||
content: "当前方案尚未保存,是否保存?",
|
||||
positiveText: "保存",
|
||||
negativeText: "取消",
|
||||
title: t("pages.KeyBoard.noSaveDialog.title"),
|
||||
content: t("pages.KeyBoard.noSaveDialog.content"),
|
||||
positiveText: t("pages.KeyBoard.noSaveDialog.positiveText"),
|
||||
negativeText: t("pages.KeyBoard.noSaveDialog.negativeText"),
|
||||
onPositiveClick: () => {
|
||||
if (store.applyEditKeyMappingList()) {
|
||||
keyboardStore.edited = false;
|
||||
resolve(true);
|
||||
} else {
|
||||
message.error("存在重复按键,无法保存");
|
||||
message.error(t("pages.KeyBoard.noSaveDialog.keyRepeat"));
|
||||
resolve(false);
|
||||
}
|
||||
},
|
||||
|
@ -16,6 +16,7 @@ import {
|
||||
import { CloseCircle, Settings } from "@vicons/ionicons5";
|
||||
import { KeyCommon, KeyMacro, KeyMacroList } from "../../keyMappingConfig";
|
||||
import { useKeyboardStore } from "../../store/keyboard";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
const props = defineProps<{
|
||||
index: number;
|
||||
@ -23,6 +24,7 @@ const props = defineProps<{
|
||||
|
||||
const keyboardStore = useKeyboardStore();
|
||||
|
||||
const { t } = useI18n();
|
||||
const store = useGlobalStore();
|
||||
const message = useMessage();
|
||||
const elementRef = ref<HTMLElement | null>(null);
|
||||
@ -139,10 +141,10 @@ function saveMacro() {
|
||||
(keyMapping.value as KeyMacro).macro = macro;
|
||||
showMacroModal.value = false;
|
||||
keyboardStore.edited = true;
|
||||
message.success("宏代码解析成功,但不保证代码正确性,请自行测试");
|
||||
message.success(t("pages.KeyBoard.KeyCommon.macroParseSuccess"));
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
message.error("宏代码保存失败,请检查代码格式是否正确");
|
||||
message.error(t("pages.KeyBoard.KeyCommon.macroParseFailed"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,29 +215,40 @@ function showSetting() {
|
||||
? "普通点击"
|
||||
: "宏"
|
||||
}}</NH4>
|
||||
<NFormItem v-if="keyMapping.type === 'Macro'" label="宏代码">
|
||||
<NButton type="success" @click="editMacro"> 编辑代码 </NButton>
|
||||
<NFormItem
|
||||
v-if="keyMapping.type === 'Macro'"
|
||||
:label="$t('pages.KeyBoard.KeyCommon.macro')"
|
||||
>
|
||||
<NButton type="success" @click="editMacro">
|
||||
{{ $t("pages.KeyBoard.KeyCommon.editMacro") }}
|
||||
</NButton>
|
||||
</NFormItem>
|
||||
<NFormItem v-if="keyMapping.type === 'Tap'" label="触摸时长">
|
||||
<NFormItem
|
||||
v-if="keyMapping.type === 'Tap'"
|
||||
:label="$t('pages.KeyBoard.setting.touchTime')"
|
||||
>
|
||||
<NInputNumber
|
||||
v-model:value="keyMapping.time"
|
||||
:min="0"
|
||||
placeholder="请输入触摸时长(ms)"
|
||||
:placeholder="$t('pages.KeyBoard.setting.touchTimePlaceholder')"
|
||||
@update:value="keyboardStore.edited = true"
|
||||
/>
|
||||
</NFormItem>
|
||||
<NFormItem v-if="keyMapping.type !== 'Macro'" label="触点ID">
|
||||
<NFormItem
|
||||
v-if="keyMapping.type !== 'Macro'"
|
||||
:label="$t('pages.KeyBoard.setting.pointerID')"
|
||||
>
|
||||
<NInputNumber
|
||||
v-model:value="keyMapping.pointerId"
|
||||
:min="0"
|
||||
placeholder="请输入触点ID"
|
||||
:placeholder="$t('pages.KeyBoard.setting.pointerIDPlaceholder')"
|
||||
@update:value="keyboardStore.edited = true"
|
||||
/>
|
||||
</NFormItem>
|
||||
<NFormItem label="备注">
|
||||
<NFormItem :label="$t('pages.KeyBoard.setting.note')">
|
||||
<NInput
|
||||
v-model:value="keyMapping.note"
|
||||
placeholder="请输入备注"
|
||||
:placeholder="$t('pages.KeyBoard.setting.notePlaceholder')"
|
||||
@update:value="keyboardStore.edited = true"
|
||||
/>
|
||||
</NFormItem>
|
||||
@ -245,33 +258,36 @@ function showSetting() {
|
||||
v-model:show="showMacroModal"
|
||||
@before-leave="saveMacro"
|
||||
>
|
||||
<NCard style="width: 50%; height: 80%" title="宏编辑">
|
||||
<NCard
|
||||
style="width: 50%; height: 80%"
|
||||
:title="$t('pages.KeyBoard.KeyCommon.macroModal.title')"
|
||||
>
|
||||
<NFlex vertical style="height: 100%">
|
||||
<div>按下按键执行</div>
|
||||
<div>{{ $t("pages.KeyBoard.KeyCommon.macroModal.down") }}</div>
|
||||
<NInput
|
||||
type="textarea"
|
||||
style="flex-grow: 1"
|
||||
placeholder="JSON宏代码, 可为空"
|
||||
placeholder="$t('pages.KeyBoard.KeyCommon.macroModal.placeholder')"
|
||||
v-model:value="editedMacroRaw.down"
|
||||
@update:value="macroEditedFlag = true"
|
||||
round
|
||||
clearable
|
||||
/>
|
||||
<div>按住执行</div>
|
||||
<div>{{ $t("pages.KeyBoard.KeyCommon.macroModal.loop") }}</div>
|
||||
<NInput
|
||||
type="textarea"
|
||||
style="flex-grow: 1"
|
||||
placeholder="JSON宏代码, 可为空"
|
||||
:placeholder="$t('pages.KeyBoard.KeyCommon.macroModal.placeholder')"
|
||||
v-model:value="editedMacroRaw.loop"
|
||||
@update:value="macroEditedFlag = true"
|
||||
round
|
||||
clearable
|
||||
/>
|
||||
<div>抬起执行</div>
|
||||
<div>{{ $t("pages.KeyBoard.KeyCommon.macroModal.up") }}</div>
|
||||
<NInput
|
||||
type="textarea"
|
||||
style="flex-grow: 1"
|
||||
placeholder="JSON宏代码, 可为空"
|
||||
:placeholder="$t('pages.KeyBoard.KeyCommon.macroModal.placeholder')"
|
||||
v-model:value="editedMacroRaw.up"
|
||||
@update:value="macroEditedFlag = true"
|
||||
round
|
||||
|
@ -109,7 +109,7 @@ function dragHandler(downEvent: MouseEvent) {
|
||||
<template>
|
||||
<div v-show="keyboardStore.showKeyInfoFlag" class="key-info" @contextmenu.prevent>
|
||||
<div class="key-info-header" @mousedown="dragHandler">
|
||||
Key Info
|
||||
{{ $t('pages.KeyBoard.KeyInfo.title') }}
|
||||
<div
|
||||
class="key-info-close"
|
||||
@click="keyboardStore.showKeyInfoFlag = false"
|
||||
@ -121,7 +121,7 @@ function dragHandler(downEvent: MouseEvent) {
|
||||
<div style="border-bottom: 1px solid var(--light-color)">
|
||||
{{ mouseX }}, {{ mouseY }}
|
||||
</div>
|
||||
<div v-if="keyboardCodeList.length === 0">Press any key</div>
|
||||
<div v-if="keyboardCodeList.length === 0">{{ $t('pages.KeyBoard.KeyInfo.note') }}</div>
|
||||
<div v-for="code in keyboardCodeList">
|
||||
{{ code }}
|
||||
</div>
|
||||
|
@ -124,27 +124,27 @@ function showSetting() {
|
||||
top: `${settingPosY}px`,
|
||||
}"
|
||||
>
|
||||
<NH4 prefix="bar">观察视角</NH4>
|
||||
<NFormItem label="灵敏度">
|
||||
<NH4 prefix="bar">{{ $t("pages.KeyBoard.Observation.observation") }}</NH4>
|
||||
<NFormItem :label="$t('pages.KeyBoard.Observation.scale')">
|
||||
<NInputNumber
|
||||
v-model:value="keyMapping.scale"
|
||||
placeholder="请输入灵敏度"
|
||||
:placeholder="$t('pages.KeyBoard.Observation.scalePlaceholder')"
|
||||
:step="0.1"
|
||||
@update:value="keyboardStore.edited = true"
|
||||
/>
|
||||
</NFormItem>
|
||||
<NFormItem label="触点ID">
|
||||
<NFormItem :label="$t('pages.KeyBoard.setting.pointerID')">
|
||||
<NInputNumber
|
||||
v-model:value="keyMapping.pointerId"
|
||||
:min="0"
|
||||
placeholder="请输入触点ID"
|
||||
:placeholder="$t('pages.KeyBoard.setting.pointerIDPlaceholder')"
|
||||
@update:value="keyboardStore.edited = true"
|
||||
/>
|
||||
</NFormItem>
|
||||
<NFormItem label="备注">
|
||||
<NFormItem :label="$t('pages.KeyBoard.setting.note')">
|
||||
<NInput
|
||||
v-model:value="keyMapping.note"
|
||||
placeholder="请输入备注"
|
||||
:placeholder="$t('pages.KeyBoard.setting.notePlaceholder')"
|
||||
@update:value="keyboardStore.edited = true"
|
||||
/>
|
||||
</NFormItem>
|
||||
|
@ -18,7 +18,9 @@ import { Store } from "@tauri-apps/plugin-store";
|
||||
import { loadDefaultKeyconfig } from "../../invoke";
|
||||
import { KeyMappingConfig } from "../../keyMappingConfig";
|
||||
import { useKeyboardStore } from "../../store/keyboard";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
const { t } = useI18n();
|
||||
const store = useGlobalStore();
|
||||
const keyboardStore = useKeyboardStore();
|
||||
const localStore = new Store("store.bin");
|
||||
@ -126,7 +128,7 @@ function dragHandler(downEvent: MouseEvent) {
|
||||
keyboardStore.showSettingFlag &&
|
||||
store.keyMappingConfigList.length === 1
|
||||
) {
|
||||
message.info("当前仅有一个按键方案,点击导入默认,可导入预设方案");
|
||||
message.info(t("pages.KeyBoard.KeySetting.onlyOneConfig"));
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -139,14 +141,14 @@ function importKeyMappingConfig() {
|
||||
keyMappingConfig = JSON.parse(importModalInputValue.value);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
message.error("导入失败");
|
||||
message.error(t("pages.KeyBoard.KeySetting.importFailed"));
|
||||
return;
|
||||
}
|
||||
store.keyMappingConfigList.push(keyMappingConfig);
|
||||
store.setKeyMappingIndex(store.keyMappingConfigList.length - 1);
|
||||
showImportModal.value = false;
|
||||
localStore.set("keyMappingConfigList", store.keyMappingConfigList);
|
||||
message.success("按键方案已导入");
|
||||
message.success(t("pages.KeyBoard.KeySetting.importSuccess"));
|
||||
}
|
||||
|
||||
async function importDefaultKeyMappingConfig() {
|
||||
@ -161,17 +163,17 @@ async function importDefaultKeyMappingConfig() {
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
message.error("默认按键方案导入失败");
|
||||
message.error(t("pages.KeyBoard.KeySetting.importDefaultFailed"));
|
||||
return;
|
||||
}
|
||||
|
||||
localStore.set("keyMappingConfigList", store.keyMappingConfigList);
|
||||
message.success(`已导入${count}个默认方案`);
|
||||
message.success(t("pages.KeyBoard.KeySetting.importDefaultSuccess", [count]));
|
||||
}
|
||||
|
||||
function createKeyMappingConfig() {
|
||||
if (keyboardStore.edited) {
|
||||
message.error("请先保存或还原当前方案");
|
||||
message.error(t("pages.KeyBoard.KeySetting.configEdited"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -179,7 +181,7 @@ function createKeyMappingConfig() {
|
||||
"keyboardElement"
|
||||
) as HTMLElement;
|
||||
const newConfig: KeyMappingConfig = {
|
||||
title: "新方案",
|
||||
title: t("pages.KeyBoard.KeySetting.newConfig"),
|
||||
relativeSize: {
|
||||
w: keyboardElement.clientWidth,
|
||||
h: keyboardElement.clientHeight,
|
||||
@ -189,18 +191,21 @@ function createKeyMappingConfig() {
|
||||
store.keyMappingConfigList.push(newConfig);
|
||||
store.setKeyMappingIndex(store.keyMappingConfigList.length - 1);
|
||||
localStore.set("keyMappingConfigList", store.keyMappingConfigList);
|
||||
message.success("新方案已创建");
|
||||
message.success(t("pages.KeyBoard.KeySetting.newConfigSuccess"));
|
||||
}
|
||||
|
||||
function copyCurKeyMappingConfig() {
|
||||
if (keyboardStore.edited) {
|
||||
message.error("请先保存或还原当前方案");
|
||||
message.error(t("pages.KeyBoard.KeySetting.configEdited"));
|
||||
return;
|
||||
}
|
||||
|
||||
const curConfig = store.keyMappingConfigList[store.curKeyMappingIndex];
|
||||
const newTitle = t("pages.KeyBoard.KeySetting.copyConfigTitle", [
|
||||
curConfig.title,
|
||||
]);
|
||||
const newConfig: KeyMappingConfig = {
|
||||
title: curConfig.title + "-副本",
|
||||
title: newTitle,
|
||||
relativeSize: curConfig.relativeSize,
|
||||
list: curConfig.list,
|
||||
};
|
||||
@ -209,12 +214,12 @@ function copyCurKeyMappingConfig() {
|
||||
keyboardStore.activeSteeringWheelButtonKeyIndex = -1;
|
||||
store.setKeyMappingIndex(store.keyMappingConfigList.length - 1);
|
||||
localStore.set("keyMappingConfigList", store.keyMappingConfigList);
|
||||
message.success("方案已复制为:" + curConfig.title + "-副本");
|
||||
message.success(t("pages.KeyBoard.KeySetting.copyConfigSuccess", [newTitle]));
|
||||
}
|
||||
|
||||
function delCurKeyMappingConfig() {
|
||||
if (store.keyMappingConfigList.length <= 1) {
|
||||
message.error("至少保留一个方案");
|
||||
message.error(t("pages.KeyBoard.KeySetting.delConfigLeast"));
|
||||
return;
|
||||
}
|
||||
const title = store.keyMappingConfigList[store.curKeyMappingIndex].title;
|
||||
@ -228,7 +233,7 @@ function delCurKeyMappingConfig() {
|
||||
store.curKeyMappingIndex > 0 ? store.curKeyMappingIndex - 1 : 0
|
||||
);
|
||||
localStore.set("keyMappingConfigList", store.keyMappingConfigList);
|
||||
message.success("方案已删除:" + title);
|
||||
message.success(t("pages.KeyBoard.KeySetting.delSuccess", [title]));
|
||||
}
|
||||
|
||||
function renameKeyMappingConfig() {
|
||||
@ -237,9 +242,9 @@ function renameKeyMappingConfig() {
|
||||
if (newTitle !== "") {
|
||||
store.keyMappingConfigList[store.curKeyMappingIndex].title = newTitle;
|
||||
localStore.set("keyMappingConfigList", store.keyMappingConfigList);
|
||||
message.success("方案已重命名为:" + newTitle);
|
||||
message.success(t("pages.KeyBoard.KeySetting.renameSuccess", [newTitle]));
|
||||
} else {
|
||||
message.error("方案名不能为空");
|
||||
message.error(t("pages.KeyBoard.KeySetting.renameEmpty"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -249,11 +254,11 @@ function exportKeyMappingConfig() {
|
||||
navigator.clipboard
|
||||
.writeText(data)
|
||||
.then(() => {
|
||||
message.success("当前按键方案已导出到剪切板");
|
||||
message.success(t("pages.KeyBoard.KeySetting.exportSuccess"));
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
message.error("按键方案导出失败");
|
||||
message.error(t("pages.KeyBoard.KeySetting.exportFailed"));
|
||||
});
|
||||
}
|
||||
|
||||
@ -261,7 +266,7 @@ function saveKeyMappingConfig() {
|
||||
if (store.applyEditKeyMappingList()) {
|
||||
keyboardStore.edited = false;
|
||||
} else {
|
||||
message.error("存在重复按键,无法保存");
|
||||
message.error(t("pages.KeyBoard.KeySetting.saveKeyRepeat"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -278,14 +283,16 @@ function checkConfigSize() {
|
||||
keyboardElement.clientHeight !== relativeSize.h
|
||||
) {
|
||||
message.warning(
|
||||
`请注意当前按键方案"${curKeyMappingConfig.title}"与蒙版尺寸不一致,若有需要可进行迁移`
|
||||
t("pages.KeyBoard.KeySetting.checkConfigSizeWarning", [
|
||||
curKeyMappingConfig.title,
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function migrateKeyMappingConfig() {
|
||||
if (keyboardStore.edited) {
|
||||
message.error("请先保存或还原当前按键方案");
|
||||
message.error(t("pages.KeyBoard.KeySetting.configEdited"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -313,25 +320,29 @@ function migrateKeyMappingConfig() {
|
||||
keyMapping.posY = Math.round((keyMapping.posY / relativeSize.h) * sizeH);
|
||||
}
|
||||
// migrate title
|
||||
newConfig.title += "-迁移";
|
||||
newConfig.title = t("pages.KeyBoard.KeySetting.migrateConfigTitle", [
|
||||
newConfig.title,
|
||||
]);
|
||||
|
||||
store.keyMappingConfigList.splice(
|
||||
store.curKeyMappingIndex + 1,
|
||||
0,
|
||||
newConfig
|
||||
);
|
||||
message.success("已迁移到新方案:" + newConfig.title);
|
||||
message.success(
|
||||
t("pages.KeyBoard.KeySetting.migrateConfigSuccess", [newConfig.title])
|
||||
);
|
||||
keyboardStore.activeButtonIndex = -1;
|
||||
keyboardStore.activeSteeringWheelButtonKeyIndex = -1;
|
||||
store.setKeyMappingIndex(store.curKeyMappingIndex + 1);
|
||||
} else {
|
||||
message.info("当前方案符合蒙版尺寸,无需迁移");
|
||||
message.info(t("pages.KeyBoard.KeySetting.migrateConfigNeedless"));
|
||||
}
|
||||
}
|
||||
|
||||
function selectKeyMappingConfig(index: number) {
|
||||
if (keyboardStore.edited) {
|
||||
message.error("请先保存或还原当前按键方案");
|
||||
message.error(t("pages.KeyBoard.KeySetting.configEdited"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -355,7 +366,7 @@ function resetKeyMappingConfig() {
|
||||
size="large"
|
||||
class="key-setting-btn"
|
||||
id="keySettingBtn"
|
||||
title="长按可拖动"
|
||||
:title="$t('pages.KeyBoard.KeySetting.buttonDrag')"
|
||||
@mousedown="dragHandler"
|
||||
:style="{
|
||||
left: keySettingPos.x + 'px',
|
||||
@ -381,50 +392,73 @@ function resetKeyMappingConfig() {
|
||||
>
|
||||
<NIcon><CloseCircle></CloseCircle></NIcon>
|
||||
</NButton>
|
||||
<NH4 prefix="bar">按键方案</NH4>
|
||||
<NH4 prefix="bar">{{ $t("pages.KeyBoard.KeySetting.config") }}</NH4>
|
||||
<NSelect
|
||||
:value="store.curKeyMappingIndex"
|
||||
@update:value="selectKeyMappingConfig"
|
||||
:options="keyMappingNameOptions"
|
||||
/>
|
||||
<NP style="margin-top: 20px">
|
||||
Relative Size:{{ curRelativeSize.w }}x{{ curRelativeSize.h }}
|
||||
{{
|
||||
$t("pages.KeyBoard.KeySetting.configRelativeSize", [
|
||||
curRelativeSize.w,
|
||||
curRelativeSize.h,
|
||||
])
|
||||
}}
|
||||
</NP>
|
||||
<NFlex style="margin-top: 20px">
|
||||
<template v-if="keyboardStore.edited">
|
||||
<NButton type="success" @click="saveKeyMappingConfig">保存方案</NButton>
|
||||
<NButton type="error" @click="resetKeyMappingConfig">还原方案</NButton>
|
||||
<NButton type="success" @click="saveKeyMappingConfig">{{
|
||||
$t("pages.KeyBoard.KeySetting.saveConfig")
|
||||
}}</NButton>
|
||||
<NButton type="error" @click="resetKeyMappingConfig">{{
|
||||
$t("pages.KeyBoard.KeySetting.resetConfig")
|
||||
}}</NButton>
|
||||
</template>
|
||||
<NButton @click="createKeyMappingConfig">新建方案</NButton>
|
||||
<NButton @click="copyCurKeyMappingConfig">复制方案</NButton>
|
||||
<NButton @click="migrateKeyMappingConfig">迁移方案</NButton>
|
||||
<NButton @click="delCurKeyMappingConfig">删除方案</NButton>
|
||||
<NButton @click="createKeyMappingConfig">{{
|
||||
$t("pages.KeyBoard.KeySetting.createConfig")
|
||||
}}</NButton>
|
||||
<NButton @click="copyCurKeyMappingConfig">{{
|
||||
$t("pages.KeyBoard.KeySetting.copyConfig")
|
||||
}}</NButton>
|
||||
<NButton @click="migrateKeyMappingConfig">{{
|
||||
$t("pages.KeyBoard.KeySetting.migrateConfig")
|
||||
}}</NButton>
|
||||
<NButton @click="delCurKeyMappingConfig">{{
|
||||
$t("pages.KeyBoard.KeySetting.delConfig")
|
||||
}}</NButton>
|
||||
<NButton
|
||||
@click="
|
||||
showRenameModal = true;
|
||||
renameModalInputValue =
|
||||
store.keyMappingConfigList[store.curKeyMappingIndex].title;
|
||||
"
|
||||
>重命名</NButton
|
||||
>{{ $t("pages.KeyBoard.KeySetting.renameConfig") }}</NButton
|
||||
>
|
||||
</NFlex>
|
||||
<NH4 prefix="bar">其他</NH4>
|
||||
<NH4 prefix="bar">{{ $t("pages.KeyBoard.KeySetting.others") }}</NH4>
|
||||
<NFlex>
|
||||
<NButton
|
||||
@click="
|
||||
showImportModal = true;
|
||||
importModalInputValue = '';
|
||||
"
|
||||
>导入方案</NButton
|
||||
>{{ $t("pages.KeyBoard.KeySetting.importConfig") }}</NButton
|
||||
>
|
||||
<NButton @click="exportKeyMappingConfig">导出方案</NButton>
|
||||
<NButton @click="importDefaultKeyMappingConfig">导入默认</NButton>
|
||||
<NButton @click="exportKeyMappingConfig">{{
|
||||
$t("pages.KeyBoard.KeySetting.exportConfig")
|
||||
}}</NButton>
|
||||
<NButton @click="importDefaultKeyMappingConfig">{{
|
||||
$t("pages.KeyBoard.KeySetting.importDefaultConfig")
|
||||
}}</NButton>
|
||||
<NButton
|
||||
@click="keyboardStore.showKeyInfoFlag = !keyboardStore.showKeyInfoFlag"
|
||||
>按键信息</NButton
|
||||
>{{ $t("pages.KeyBoard.KeySetting.keyInfo") }}</NButton
|
||||
>
|
||||
</NFlex>
|
||||
<NP style="margin-top: 40px">提示:右键空白区域可添加按键</NP>
|
||||
<NP style="margin-top: 40px">{{
|
||||
$t("pages.KeyBoard.KeySetting.addButtonTip")
|
||||
}}</NP>
|
||||
</div>
|
||||
<NModal v-model:show="showImportModal">
|
||||
<NCard style="width: 40%; height: 50%">
|
||||
@ -432,24 +466,27 @@ function resetKeyMappingConfig() {
|
||||
<NInput
|
||||
type="textarea"
|
||||
style="flex-grow: 1"
|
||||
placeholder="粘贴单个按键方案的JSON文本 (此处无法对按键方案的合法性进行判断, 请确保JSON内容正确)"
|
||||
:placeholder="$t('pages.KeyBoard.KeySetting.importPlaceholder')"
|
||||
v-model:value="importModalInputValue"
|
||||
round
|
||||
clearable
|
||||
/>
|
||||
<NButton type="success" round @click="importKeyMappingConfig"
|
||||
>导入</NButton
|
||||
>
|
||||
<NButton type="success" round @click="importKeyMappingConfig">{{
|
||||
$t("pages.KeyBoard.KeySetting.import")
|
||||
}}</NButton>
|
||||
</NFlex>
|
||||
</NCard>
|
||||
</NModal>
|
||||
<NModal v-model:show="showRenameModal">
|
||||
<NCard style="width: 40%" title="重命名按键方案">
|
||||
<NCard
|
||||
style="width: 40%"
|
||||
:title="$t('pages.KeyBoard.KeySetting.renameTitle')"
|
||||
>
|
||||
<NFlex vertical>
|
||||
<NInput v-model:value="renameModalInputValue" clearable />
|
||||
<NButton type="success" round @click="renameKeyMappingConfig"
|
||||
>重命名</NButton
|
||||
>
|
||||
<NButton type="success" round @click="renameKeyMappingConfig">{{
|
||||
$t("pages.KeyBoard.KeySetting.renameConfig")
|
||||
}}</NButton>
|
||||
</NFlex>
|
||||
</NCard>
|
||||
</NModal>
|
||||
|
@ -260,27 +260,30 @@ function updateRangeIndicator(element?: HTMLElement) {
|
||||
top: `${settingPosY}px`,
|
||||
}"
|
||||
>
|
||||
<NH4 prefix="bar">技能</NH4>
|
||||
<NFormItem label="选项">
|
||||
<NH4 prefix="bar">{{ $t("pages.KeyBoard.KeySkill.skill") }}</NH4>
|
||||
<NFormItem :label="$t('pages.KeyBoard.KeySkill.options')">
|
||||
<NFlex vertical>
|
||||
<NCheckbox
|
||||
@click="changeSkillType('trigger-double')"
|
||||
:checked="isTriggerWhenDoublePressed"
|
||||
>双击施放</NCheckbox
|
||||
>{{ $t("pages.KeyBoard.KeySkill.double") }}</NCheckbox
|
||||
>
|
||||
<NCheckbox
|
||||
@click="changeSkillType('direction')"
|
||||
:checked="isDirectionless"
|
||||
>无方向技能</NCheckbox
|
||||
>{{ $t("pages.KeyBoard.KeySkill.directionless") }}</NCheckbox
|
||||
>
|
||||
<NCheckbox
|
||||
@click="changeSkillType('trigger')"
|
||||
:checked="isTriggerWhenPressed"
|
||||
>按下时触发</NCheckbox
|
||||
>{{ $t("pages.KeyBoard.KeySkill.triggerWhenPressed") }}</NCheckbox
|
||||
>
|
||||
</NFlex>
|
||||
</NFormItem>
|
||||
<NFormItem v-if="!isDirectionless" label="范围">
|
||||
<NFormItem
|
||||
v-if="!isDirectionless"
|
||||
:label="$t('pages.KeyBoard.KeySkill.range')"
|
||||
>
|
||||
<NInputNumber
|
||||
v-if="keyMapping.type === 'DirectionalSkill'"
|
||||
v-model:value="keyMapping.range"
|
||||
@ -317,27 +320,27 @@ function updateRangeIndicator(element?: HTMLElement) {
|
||||
</NFormItem>
|
||||
<NFormItem
|
||||
v-if="(keyMapping.type==='TriggerWhenPressedSkill'&&!(keyMapping as KeyTriggerWhenPressedSkill).directional)"
|
||||
label="触摸时长"
|
||||
:label="$t('pages.KeyBoard.setting.touchTime')"
|
||||
>
|
||||
<NInputNumber
|
||||
v-model:value="keyMapping.rangeOrTime"
|
||||
:min="0"
|
||||
placeholder="请输入触摸时长(ms)"
|
||||
:placeholder="$t('pages.KeyBoard.setting.touchTimePlaceholder')"
|
||||
@update:value="keyboardStore.edited = true"
|
||||
/>
|
||||
</NFormItem>
|
||||
<NFormItem label="触点ID">
|
||||
<NFormItem :label="$t('pages.KeyBoard.setting.pointerID')">
|
||||
<NInputNumber
|
||||
v-model:value="keyMapping.pointerId"
|
||||
:min="0"
|
||||
placeholder="请输入触点ID"
|
||||
:placeholder="$t('pages.KeyBoard.setting.pointerIDPlaceholder')"
|
||||
@update:value="keyboardStore.edited = true"
|
||||
/>
|
||||
</NFormItem>
|
||||
<NFormItem label="备注">
|
||||
<NFormItem :label="$t('pages.KeyBoard.setting.note')">
|
||||
<NInput
|
||||
v-model:value="keyMapping.note"
|
||||
placeholder="请输入备注"
|
||||
:placeholder="$t('pages.KeyBoard.setting.notePlaceholder')"
|
||||
@update:value="keyboardStore.edited = true"
|
||||
/>
|
||||
</NFormItem>
|
||||
|
@ -184,26 +184,28 @@ function showSetting() {
|
||||
top: `${settingPosY}px`,
|
||||
}"
|
||||
>
|
||||
<NH4 prefix="bar">键盘行走</NH4>
|
||||
<NFormItem label="偏移">
|
||||
<NH4 prefix="bar">{{
|
||||
$t("pages.KeyBoard.SteeringWheel.steeringWheel")
|
||||
}}</NH4>
|
||||
<NFormItem :label="$t('pages.KeyBoard.SteeringWheel.offset')">
|
||||
<NInputNumber
|
||||
v-model:value="keyMapping.offset"
|
||||
:min="1"
|
||||
@update:value="keyboardStore.edited = true"
|
||||
/>
|
||||
</NFormItem>
|
||||
<NFormItem label="触点ID">
|
||||
<NFormItem :label="$t('pages.KeyBoard.setting.pointerID')">
|
||||
<NInputNumber
|
||||
v-model:value="keyMapping.pointerId"
|
||||
:min="0"
|
||||
placeholder="请输入触点ID"
|
||||
:placeholder="$t('pages.KeyBoard.setting.pointerIDPlaceholder')"
|
||||
@update:value="keyboardStore.edited = true"
|
||||
/>
|
||||
</NFormItem>
|
||||
<NFormItem label="备注">
|
||||
<NFormItem :label="$t('pages.KeyBoard.setting.note')">
|
||||
<NInput
|
||||
v-model:value="keyMapping.note"
|
||||
placeholder="请输入备注"
|
||||
:placeholder="$t('pages.KeyBoard.setting.notePlaceholder')"
|
||||
@update:value="keyboardStore.edited = true"
|
||||
/>
|
||||
</NFormItem>
|
||||
|
@ -110,6 +110,108 @@
|
||||
"curVersion": "Current version: {0}",
|
||||
"checkUpdate": "Check for updates"
|
||||
}
|
||||
},
|
||||
"KeyBoard": {
|
||||
"noSaveDialog": {
|
||||
"title": "Warning",
|
||||
"content": "The current plan has not been saved. Do you want to save it?",
|
||||
"positiveText": "Save",
|
||||
"negativeText": "Cancel",
|
||||
"keyRepeat": "There are duplicate keystrokes and cannot be saved."
|
||||
},
|
||||
"addButton": {
|
||||
"SteeringWheel": "SteeringWheel",
|
||||
"Tap": "Tap",
|
||||
"Skill": "Skill",
|
||||
"CancelSkill": "CancelSkill",
|
||||
"Observation": "Observation",
|
||||
"Macro": "Macro"
|
||||
},
|
||||
"buttonKeyRepeat": "Key repeat: {0}",
|
||||
"KeyCommon": {
|
||||
"macroParseSuccess": "The macro code is parsed successfully, but the correctness of the code is not guaranteed. Please test by yourself.",
|
||||
"macroParseFailed": "Macro code failed to save, please check whether the code format is correct.",
|
||||
"macro": "Macro code",
|
||||
"editMacro": "Edit macro",
|
||||
"macroModal": {
|
||||
"title": "Macro editor",
|
||||
"down": "Macro executed on key press",
|
||||
"placeholder": "JSON macro code, can be empty",
|
||||
"loop": "Macro executed on key press and hold",
|
||||
"up": "Macro executed on key up"
|
||||
}
|
||||
},
|
||||
"setting": {
|
||||
"touchTime": "Touch duration",
|
||||
"touchTimePlaceholder": "Touch duration (ms)",
|
||||
"pointerID": "Pointer ID",
|
||||
"pointerIDPlaceholder": "Please enter Pointer ID",
|
||||
"note": "Note",
|
||||
"notePlaceholder": "Please enter note"
|
||||
},
|
||||
"KeyInfo": {
|
||||
"title": "按键信息",
|
||||
"note": "按下任意键"
|
||||
},
|
||||
"Observation": {
|
||||
"observation": "Observation",
|
||||
"scale": "Sensitivity",
|
||||
"scalePlaceholder": "Please enter sensitivity"
|
||||
},
|
||||
"KeySetting": {
|
||||
"onlyOneConfig": "There is currently only one config. Click Import Default to import the preset configs.",
|
||||
"importFailed": "Import failed",
|
||||
"importSuccess": "Key config has been imported",
|
||||
"importDefaultFailed": "Import of default key config failed",
|
||||
"importDefaultSuccess": "{0} default configs have been imported",
|
||||
"configEdited": "Please save or reset the current config first",
|
||||
"newConfig": "New Config",
|
||||
"newConfigSuccess": "New config has been created",
|
||||
"copyConfigTitle": "{0}-Copy",
|
||||
"copyConfigSuccess": "The config has been copied as: {0}",
|
||||
"delConfigLeast": "Keep at least one config",
|
||||
"delSuccess": "Config deleted: {0}",
|
||||
"renameSuccess": "Config has been renamed: {0}",
|
||||
"renameEmpty": "Config name cannot be empty",
|
||||
"exportSuccess": "The current key config has been exported to the clipboard",
|
||||
"exportFailed": "Key config export failed",
|
||||
"saveKeyRepeat": "There are duplicate key and cannot be saved.",
|
||||
"checkConfigSizeWarning": "Please note that the current key config \"{0}\" is inconsistent with the mask size. You can migrate it if necessary.",
|
||||
"migrateConfigTitle": "{0}-Migrate",
|
||||
"migrateConfigSuccess": "Migrated to new config: {0}",
|
||||
"migrateConfigNeedless": "The current config conforms to the mask size and does not need to be migrated",
|
||||
"buttonDrag": "Long press to drag",
|
||||
"config": "Key mapping config",
|
||||
"configRelativeSize": "Relative Mask Size: {0}x{1}",
|
||||
"saveConfig": "Save config",
|
||||
"resetConfig": "Reset config",
|
||||
"renameConfig": "Rename",
|
||||
"renameTitle": "Rename key config",
|
||||
"import": "import",
|
||||
"importPlaceholder": "Paste the JSON text of a key mapping config (the legality of the key mapping config cannot be judged here, please ensure that the JSON content is correct)",
|
||||
"addButtonTip": "Tip: Right-click on the blank area to add buttons",
|
||||
"keyInfo": "Key Info",
|
||||
"importDefaultConfig": "Import default",
|
||||
"exportConfig": "Export config",
|
||||
"importConfig": "Import config",
|
||||
"others": "Others",
|
||||
"delConfig": "Delete config",
|
||||
"migrateConfig": "Migration config",
|
||||
"copyConfig": "Copy config",
|
||||
"createConfig": "Create config"
|
||||
},
|
||||
"KeySkill": {
|
||||
"skill": "Skill",
|
||||
"options": "Options",
|
||||
"double": "Double click to cast",
|
||||
"directionless": "Directionless skills",
|
||||
"triggerWhenPressed": "Trigger when pressed",
|
||||
"range": "Range"
|
||||
},
|
||||
"SteeringWheel": {
|
||||
"steeringWheel": "SteeringWheel",
|
||||
"offset": "Offset"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sidebar": {
|
||||
|
@ -110,6 +110,108 @@
|
||||
"checkUpdate": "检查更新",
|
||||
"checkUpdateOnStartup": "启动时检查软件更新"
|
||||
}
|
||||
},
|
||||
"KeyBoard": {
|
||||
"addButton": {
|
||||
"Tap": "普通点击",
|
||||
"SteeringWheel": "键盘行走",
|
||||
"Skill": "技能",
|
||||
"CancelSkill": "技能取消",
|
||||
"Observation": "观察视角",
|
||||
"Macro": "宏"
|
||||
},
|
||||
"buttonKeyRepeat": "按键重复: {0}",
|
||||
"noSaveDialog": {
|
||||
"title": "警告",
|
||||
"content": "当前方案尚未保存,是否保存?",
|
||||
"positiveText": "保存",
|
||||
"negativeText": "取消",
|
||||
"keyRepeat": "存在重复按键,无法保存"
|
||||
},
|
||||
"KeyCommon": {
|
||||
"macroParseSuccess": "宏代码解析成功,但不保证代码正确性,请自行测试",
|
||||
"macroParseFailed": "宏代码保存失败,请检查代码格式是否正确",
|
||||
"macro": "宏代码",
|
||||
"editMacro": "编辑宏代码",
|
||||
"macroModal": {
|
||||
"title": "宏编辑",
|
||||
"down": "按下按键执行的宏",
|
||||
"loop": "按住执行的宏",
|
||||
"placeholder": "JSON宏代码, 可为空",
|
||||
"up": "抬起执行的宏"
|
||||
}
|
||||
},
|
||||
"setting": {
|
||||
"touchTime": "触摸时长",
|
||||
"touchTimePlaceholder": "请输入触摸时长(ms)",
|
||||
"pointerID": "触点ID",
|
||||
"pointerIDPlaceholder": "请输入触点ID",
|
||||
"note": "备注",
|
||||
"notePlaceholder": "请输入备注"
|
||||
},
|
||||
"KeyInfo": {
|
||||
"title": "Key Info",
|
||||
"note": "Press any key"
|
||||
},
|
||||
"Observation": {
|
||||
"observation": "观察视角",
|
||||
"scale": "灵敏度",
|
||||
"scalePlaceholder": "请输入灵敏度"
|
||||
},
|
||||
"KeySetting": {
|
||||
"onlyOneConfig": "当前仅有一个按键方案,点击导入默认,可导入预设方案",
|
||||
"importFailed": "导入失败",
|
||||
"importSuccess": "按键方案已导入",
|
||||
"importDefaultFailed": "默认按键方案导入失败",
|
||||
"importDefaultSuccess": "已导入{0}个默认方案",
|
||||
"configEdited": "请先保存或还原当前方案",
|
||||
"newConfig": "新方案",
|
||||
"newConfigSuccess": "新方案已创建",
|
||||
"copyConfigTitle": "{0}-副本",
|
||||
"copyConfigSuccess": "方案已复制为:{0}",
|
||||
"exportSuccess": "当前按键方案已导出到剪切板",
|
||||
"exportFailed": "按键方案导出失败",
|
||||
"checkConfigSizeWarning": "请注意当前按键方案\"{0}\"与蒙版尺寸不一致,若有需要可进行迁移",
|
||||
"migrateConfigTitle": "{0}-迁移",
|
||||
"migrateConfigSuccess": "已迁移到新方案:{0}",
|
||||
"migrateConfigNeedless": "当前方案符合蒙版尺寸,无需迁移",
|
||||
"buttonDrag": "长按可拖动",
|
||||
"config": "按键映射方案",
|
||||
"configRelativeSize": "相对蒙版尺寸: {0}x{1}",
|
||||
"saveConfig": "保存方案",
|
||||
"resetConfig": "还原方案",
|
||||
"createConfig": "新建方案",
|
||||
"copyConfig": "复制方案",
|
||||
"migrateConfig": "迁移方案",
|
||||
"delConfig": "删除方案",
|
||||
"renameConfig": "重命名",
|
||||
"others": "其他",
|
||||
"importConfig": "导入方案",
|
||||
"exportConfig": "导出方案",
|
||||
"importDefaultConfig": "导入默认",
|
||||
"keyInfo": "按键信息",
|
||||
"addButtonTip": "提示:右键空白区域可添加按键",
|
||||
"importPlaceholder": "粘贴单个按键方案的JSON文本 (此处无法对按键方案的合法性进行判断, 请确保JSON内容正确)",
|
||||
"import": "导入",
|
||||
"renameTitle": "重命名按键方案",
|
||||
"delConfigLeast": "至少保留一个方案",
|
||||
"delSuccess": "方案已删除:{0}",
|
||||
"renameSuccess": "方案已重命名为:{0}",
|
||||
"renameEmpty": "方案名不能为空",
|
||||
"saveKeyRepeat": "存在重复按键,无法保存"
|
||||
},
|
||||
"KeySkill": {
|
||||
"skill": "技能",
|
||||
"options": "选项",
|
||||
"double": "双击施放",
|
||||
"directionless": "无方向技能",
|
||||
"triggerWhenPressed": "按下时触发",
|
||||
"range": "范围"
|
||||
},
|
||||
"SteeringWheel": {
|
||||
"steeringWheel": "键盘行走",
|
||||
"offset": "偏移"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sidebar": {
|
||||
|
Loading…
Reference in New Issue
Block a user