Skip to content

Commit

Permalink
Merge branch 'main' into deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackRam-oss committed Jul 22, 2024
2 parents 7dff3f0 + 0e0fb81 commit a7f66ef
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/screens/NextButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { GameStepManager } from '@drincs/pixi-vn';
import { StepLabelProps } from '@drincs/pixi-vn/dist/override';
import { Button } from '@mui/joy';
import { motion } from "framer-motion";
Expand All @@ -21,26 +20,29 @@ export default function NextButton({ nextOnClick }: {
const navigate = useMyNavigate();
const { t } = useTranslation(["translation"]);
useEffect(() => {
window.addEventListener('keydown', onkeydown);
window.addEventListener("keypress", onkeypress);
window.addEventListener("keyup", onkeyup);

return () => {
window.removeEventListener('keydown', onkeydown);
window.removeEventListener("keypress", onkeypress);
window.removeEventListener("keyup", onkeyup);
};
}, []);

function onkeydown(event: KeyboardEvent) {
if (event.code == 'Enter' || event.code == 'Space') {
if (!GameStepManager.canGoNext) {
return;
}
function onkeypress(event: KeyboardEvent) {
if ((event.code == 'Enter' || event.code == 'Space')) {
setSkip(true)
}
}

function onkeyup(event: KeyboardEvent) {
if ((event.code == 'Enter' || event.code == 'Space')) {
setSkip(false)
nextOnClick({
t,
navigate,
notify: (message, variant) => enqueueSnackbar(message, { variant }),
})
if (skip) {
setSkip(false)
}
}
}

Expand Down

0 comments on commit a7f66ef

Please sign in to comment.