diff --git a/src/components/game/GameCanvas.tsx b/src/components/game/GameCanvas.tsx index 57b1489..5f50f7d 100644 --- a/src/components/game/GameCanvas.tsx +++ b/src/components/game/GameCanvas.tsx @@ -740,15 +740,29 @@ function GameCanvas({ }); }, 1000); } else if (questionTimeLeft === 0 && showQuestionModal) { - // 시간 초과 시 자동 제출 - submitAnswer(); - setShowQuestionModal(false); + // 시간 초과 시 자동으로 오답 처리 + if (currentPixel) { + // 시간 초과시 자동으로 false 결과 전송 + startCooldown(1); + setLives((prev) => Math.max(0, prev - 1)); + + sendGameResult({ + x: currentPixel.x, + y: currentPixel.y, + color: currentPixel.color, + result: false, + }); + + setShowQuestionModal(false); + setShowResult(false); + setCurrentPixel(null); + } } return () => { clearInterval(timerId); }; - }, [showQuestionModal, questionTimeLeft, submitAnswer]); + }, [showQuestionModal, questionTimeLeft, currentPixel, startCooldown, setLives, sendGameResult]); // 게임 데이터 및 캔버스 초기화 const { getSynchronizedServerTime } = useTimeSyncStore(); diff --git a/src/components/modal/QuestionModal.tsx b/src/components/modal/QuestionModal.tsx index 4f76485..dc36639 100644 --- a/src/components/modal/QuestionModal.tsx +++ b/src/components/modal/QuestionModal.tsx @@ -32,8 +32,18 @@ const QuestionModal: React.FC = ({ }) => { if (!isOpen || !currentQuestion) return null; + const handleKeyDown = (event: React.KeyboardEvent) => { + if (event.key === 'Enter') { + event.preventDefault(); // 엔터 키 기본 동작 방지 + event.stopPropagation(); // 이벤트 전파 중단 + } + }; + return ( -
+

문제

@@ -129,4 +139,4 @@ const QuestionModal: React.FC = ({ ); }; -export default QuestionModal; \ No newline at end of file +export default QuestionModal;