mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-06-25 17:10:43 +00:00
Update room.core.vue
This commit is contained in:
parent
840e2c3744
commit
7f2286f1fd
1 changed files with 60 additions and 54 deletions
|
|
@ -164,6 +164,66 @@ function calcWasdVec() {
|
|||
|
||||
let isDashing = false;
|
||||
|
||||
watch(canvas, () => {
|
||||
if (canvas.value == null) return;
|
||||
|
||||
canvas.value!.addEventListener('keydown', (ev) => {
|
||||
if (!controller.isReady.value) return;
|
||||
if (ev.repeat) return;
|
||||
|
||||
switch (ev.code) {
|
||||
case 'KeyW':
|
||||
isWPressing = true;
|
||||
controller.setCameraMoveVector(calcWasdVec(), isDashing);
|
||||
break;
|
||||
case 'KeyS':
|
||||
isSPressing = true;
|
||||
controller.setCameraMoveVector(calcWasdVec(), isDashing);
|
||||
break;
|
||||
case 'KeyA':
|
||||
isAPressing = true;
|
||||
controller.setCameraMoveVector(calcWasdVec(), isDashing);
|
||||
break;
|
||||
case 'KeyD':
|
||||
isDPressing = true;
|
||||
controller.setCameraMoveVector(calcWasdVec(), isDashing);
|
||||
break;
|
||||
case 'ShiftLeft':
|
||||
case 'ShiftRight':
|
||||
isDashing = true;
|
||||
controller.setCameraMoveVector(calcWasdVec(), isDashing);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
canvas.value!.addEventListener('keyup', (ev) => {
|
||||
if (!controller.isReady.value) return;
|
||||
switch (ev.code) {
|
||||
case 'KeyW':
|
||||
isWPressing = false;
|
||||
controller.setCameraMoveVector(calcWasdVec(), isDashing);
|
||||
break;
|
||||
case 'KeyS':
|
||||
isSPressing = false;
|
||||
controller.setCameraMoveVector(calcWasdVec(), isDashing);
|
||||
break;
|
||||
case 'KeyA':
|
||||
isAPressing = false;
|
||||
controller.setCameraMoveVector(calcWasdVec(), isDashing);
|
||||
break;
|
||||
case 'KeyD':
|
||||
isDPressing = false;
|
||||
controller.setCameraMoveVector(calcWasdVec(), isDashing);
|
||||
break;
|
||||
case 'ShiftLeft':
|
||||
case 'ShiftRight':
|
||||
isDashing = false;
|
||||
controller.setCameraMoveVector(calcWasdVec(), isDashing);
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const joyStickRadiusPx = 100;
|
||||
const joyStickEl = useTemplateRef('joyStickEl');
|
||||
const joyStickVec = ref({ x: 0, y: 0 });
|
||||
|
|
@ -251,60 +311,6 @@ onMounted(async () => {
|
|||
});
|
||||
}
|
||||
|
||||
canvas.value!.addEventListener('keydown', (ev) => {
|
||||
if (ev.repeat) return;
|
||||
|
||||
switch (ev.code) {
|
||||
case 'KeyW':
|
||||
isWPressing = true;
|
||||
controller.setCameraMoveVector(calcWasdVec(), isDashing);
|
||||
break;
|
||||
case 'KeyS':
|
||||
isSPressing = true;
|
||||
controller.setCameraMoveVector(calcWasdVec(), isDashing);
|
||||
break;
|
||||
case 'KeyA':
|
||||
isAPressing = true;
|
||||
controller.setCameraMoveVector(calcWasdVec(), isDashing);
|
||||
break;
|
||||
case 'KeyD':
|
||||
isDPressing = true;
|
||||
controller.setCameraMoveVector(calcWasdVec(), isDashing);
|
||||
break;
|
||||
case 'ShiftLeft':
|
||||
case 'ShiftRight':
|
||||
isDashing = true;
|
||||
controller.setCameraMoveVector(calcWasdVec(), isDashing);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
canvas.value!.addEventListener('keyup', (ev) => {
|
||||
switch (ev.code) {
|
||||
case 'KeyW':
|
||||
isWPressing = false;
|
||||
controller.setCameraMoveVector(calcWasdVec(), isDashing);
|
||||
break;
|
||||
case 'KeyS':
|
||||
isSPressing = false;
|
||||
controller.setCameraMoveVector(calcWasdVec(), isDashing);
|
||||
break;
|
||||
case 'KeyA':
|
||||
isAPressing = false;
|
||||
controller.setCameraMoveVector(calcWasdVec(), isDashing);
|
||||
break;
|
||||
case 'KeyD':
|
||||
isDPressing = false;
|
||||
controller.setCameraMoveVector(calcWasdVec(), isDashing);
|
||||
break;
|
||||
case 'ShiftLeft':
|
||||
case 'ShiftRight':
|
||||
isDashing = false;
|
||||
controller.setCameraMoveVector(calcWasdVec(), isDashing);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
watch([graphicsQuality, fps, resolution, antialias], () => {
|
||||
refresh();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue