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