mirror of
https://github.com/AkiChase/scrcpy-mask
synced 2025-02-20 21:32:16 +08:00
feat(KeyBoard): add menu item for KeySight and KeyFire
This commit is contained in:
parent
556e69ca46
commit
ab67d20198
@ -8,6 +8,7 @@ import KeySkill from "./KeySkill.vue";
|
|||||||
import KeyObservation from "./KeyObservation.vue";
|
import KeyObservation from "./KeyObservation.vue";
|
||||||
import KeySight from "./KeySight.vue";
|
import KeySight from "./KeySight.vue";
|
||||||
import KeyFire from "./KeyFire.vue";
|
import KeyFire from "./KeyFire.vue";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
KeyDirectionalSkill,
|
KeyDirectionalSkill,
|
||||||
KeySteeringWheel as KeyMappingSteeringWheel,
|
KeySteeringWheel as KeyMappingSteeringWheel,
|
||||||
@ -15,6 +16,8 @@ import {
|
|||||||
KeyTap,
|
KeyTap,
|
||||||
KeyMacro,
|
KeyMacro,
|
||||||
KeyMapping,
|
KeyMapping,
|
||||||
|
KeySight as KeyMappingKeySight,
|
||||||
|
KeyFire as KeyMappingKeyFire,
|
||||||
} from "../../keyMappingConfig";
|
} from "../../keyMappingConfig";
|
||||||
import { useGlobalStore } from "../../store/global";
|
import { useGlobalStore } from "../../store/global";
|
||||||
import { DropdownOption, NDropdown, useDialog, useMessage } from "naive-ui";
|
import { DropdownOption, NDropdown, useDialog, useMessage } from "naive-ui";
|
||||||
@ -54,6 +57,14 @@ const addButtonOptions: DropdownOption[] = [
|
|||||||
label: () => t("pages.KeyBoard.addButton.Macro"),
|
label: () => t("pages.KeyBoard.addButton.Macro"),
|
||||||
key: "Macro",
|
key: "Macro",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: () => t("pages.KeyBoard.addButton.Sight"),
|
||||||
|
key: "Sight",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: () => t("pages.KeyBoard.addButton.Fire"),
|
||||||
|
key: "Fire",
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
function onAddButtonSelect(
|
function onAddButtonSelect(
|
||||||
@ -64,6 +75,8 @@ function onAddButtonSelect(
|
|||||||
| "CancelSkill"
|
| "CancelSkill"
|
||||||
| "Observation"
|
| "Observation"
|
||||||
| "Macro"
|
| "Macro"
|
||||||
|
| "Sight"
|
||||||
|
| "Fire"
|
||||||
) {
|
) {
|
||||||
keyboardStore.showButtonAddFlag = false;
|
keyboardStore.showButtonAddFlag = false;
|
||||||
const keyMapping = {
|
const keyMapping = {
|
||||||
@ -72,11 +85,13 @@ function onAddButtonSelect(
|
|||||||
note: "",
|
note: "",
|
||||||
posX: addButtonPos.value.x - 70,
|
posX: addButtonPos.value.x - 70,
|
||||||
posY: addButtonPos.value.y - 30,
|
posY: addButtonPos.value.y - 30,
|
||||||
pointerId: 2, // default skill pointerId
|
pointerId: 2, // default skill and fire pointerId
|
||||||
};
|
};
|
||||||
if (type === "Tap") {
|
if (type === "Tap") {
|
||||||
|
keyMapping.pointerId = 3;
|
||||||
(keyMapping as KeyTap).time = 80;
|
(keyMapping as KeyTap).time = 80;
|
||||||
} else if (type === "SteeringWheel") {
|
} else if (type === "SteeringWheel") {
|
||||||
|
keyMapping.pointerId = 1;
|
||||||
(keyMapping as unknown as KeyMappingSteeringWheel).key = {
|
(keyMapping as unknown as KeyMappingSteeringWheel).key = {
|
||||||
left: "NONE1",
|
left: "NONE1",
|
||||||
right: "NONE2",
|
right: "NONE2",
|
||||||
@ -89,14 +104,36 @@ function onAddButtonSelect(
|
|||||||
} else if (type === "CancelSkill") {
|
} else if (type === "CancelSkill") {
|
||||||
keyMapping.note = t("pages.KeyBoard.addButton.CancelSkill");
|
keyMapping.note = t("pages.KeyBoard.addButton.CancelSkill");
|
||||||
} else if (type === "Observation") {
|
} else if (type === "Observation") {
|
||||||
|
keyMapping.pointerId = 4;
|
||||||
(keyMapping as unknown as KeyMappingObservation).scale = 0.6;
|
(keyMapping as unknown as KeyMappingObservation).scale = 0.6;
|
||||||
} else if (type === "Macro") {
|
} else if (type === "Macro") {
|
||||||
|
delete (keyMapping as any).pointerId;
|
||||||
(keyMapping as unknown as KeyMacro).macro = {
|
(keyMapping as unknown as KeyMacro).macro = {
|
||||||
down: null,
|
down: null,
|
||||||
loop: null,
|
loop: null,
|
||||||
up: null,
|
up: null,
|
||||||
};
|
};
|
||||||
delete (keyMapping as any).pointerId;
|
} else if (type === "Sight") {
|
||||||
|
for (const mapping of store.editKeyMappingList) {
|
||||||
|
if (mapping.type === "Sight") {
|
||||||
|
message.error(t("pages.KeyBoard.addButton.existSight"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
keyMapping.pointerId = 0;
|
||||||
|
(keyMapping as unknown as KeyMappingKeySight).scaleX = 0.5;
|
||||||
|
(keyMapping as unknown as KeyMappingKeySight).scaleY = 0.5;
|
||||||
|
} else if (type === "Fire") {
|
||||||
|
for (const mapping of store.editKeyMappingList) {
|
||||||
|
if (mapping.type === "Fire") {
|
||||||
|
message.error(t("pages.KeyBoard.addButton.existFire"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete (keyMapping as any).key;
|
||||||
|
(keyMapping as unknown as KeyMappingKeyFire).scaleX = 0.5;
|
||||||
|
(keyMapping as unknown as KeyMappingKeyFire).scaleY = 0.5;
|
||||||
|
(keyMapping as unknown as KeyMappingKeyFire).drag = false;
|
||||||
} else return;
|
} else return;
|
||||||
keyboardStore.edited = true;
|
keyboardStore.edited = true;
|
||||||
store.editKeyMappingList.push(keyMapping as KeyMapping);
|
store.editKeyMappingList.push(keyMapping as KeyMapping);
|
||||||
|
@ -650,7 +650,7 @@ function addSightShortcuts(
|
|||||||
sightKeyMapping: KeySight,
|
sightKeyMapping: KeySight,
|
||||||
fireKeyMapping?: KeyFire
|
fireKeyMapping?: KeyFire
|
||||||
) {
|
) {
|
||||||
// TODO 3. 可视化组件 4. 组件配置中唯一
|
// TODO 5. 调整所有按键设置宽度,英文的存在换行问题
|
||||||
const appWindow = getCurrent();
|
const appWindow = getCurrent();
|
||||||
|
|
||||||
let mouseLock = false;
|
let mouseLock = false;
|
||||||
|
@ -133,7 +133,11 @@
|
|||||||
"Skill": "Skill",
|
"Skill": "Skill",
|
||||||
"CancelSkill": "CancelSkill",
|
"CancelSkill": "CancelSkill",
|
||||||
"Observation": "Observation",
|
"Observation": "Observation",
|
||||||
"Macro": "Macro"
|
"Macro": "Macro",
|
||||||
|
"Sight": "Front sight",
|
||||||
|
"Fire": "Fire",
|
||||||
|
"existFire": "Fire button already exists",
|
||||||
|
"existSight": "Front sight button already exists"
|
||||||
},
|
},
|
||||||
"buttonKeyRepeat": "Key repeat: {0}",
|
"buttonKeyRepeat": "Key repeat: {0}",
|
||||||
"KeyCommon": {
|
"KeyCommon": {
|
||||||
|
@ -126,7 +126,11 @@
|
|||||||
"Skill": "技能",
|
"Skill": "技能",
|
||||||
"CancelSkill": "技能取消",
|
"CancelSkill": "技能取消",
|
||||||
"Observation": "观察视角",
|
"Observation": "观察视角",
|
||||||
"Macro": "宏"
|
"Macro": "宏",
|
||||||
|
"Sight": "准星",
|
||||||
|
"Fire": "开火",
|
||||||
|
"existSight": "已存在准星按钮",
|
||||||
|
"existFire": "已存在开火按钮"
|
||||||
},
|
},
|
||||||
"buttonKeyRepeat": "按键重复: {0}",
|
"buttonKeyRepeat": "按键重复: {0}",
|
||||||
"noSaveDialog": {
|
"noSaveDialog": {
|
||||||
|
Loading…
Reference in New Issue
Block a user