Skip to content

Commit

Permalink
[๐Ÿ› ๏ธ REFACTOR] sounds, sound ํด๋” ํ†ต์ผ ๋ฐ ๊ฒฝ๋กœ ์ˆ˜์ •
Browse files Browse the repository at this point in the history
  • Loading branch information
bishoe01 committed Aug 2, 2024
1 parent ed38ffd commit 3eba8a0
Show file tree
Hide file tree
Showing 27 changed files with 12 additions and 11 deletions.
Binary file removed handtris/public/gif/tetris.gif
Binary file not shown.
Binary file removed handtris/public/gif/tetris_.mp4
Binary file not shown.
Binary file removed handtris/public/sound/Click Sound 47609.mp3
Binary file not shown.
Binary file removed handtris/public/sound/Click.mp3
Binary file not shown.
Binary file removed handtris/public/sound/Menu Click Sound.mp3
Binary file not shown.
Binary file removed handtris/public/sound/ThemeMusic.mp3
Binary file not shown.
Binary file removed handtris/public/sound/ThemeMusic2.mp3
Binary file not shown.
File renamed without changes.
Binary file removed handtris/public/sound/chaves.ogg
Binary file not shown.
Binary file removed handtris/public/sound/clear.ogg
Binary file not shown.
File renamed without changes.
Binary file removed handtris/public/sound/combo.ogg
Binary file not shown.
Binary file removed handtris/public/sound/combo_ext.ogg
Binary file not shown.
Binary file removed handtris/public/sound/dialog.mp3
Binary file not shown.
File renamed without changes.
Binary file removed handtris/public/sound/hold.ogg
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file removed handtris/public/sound/tetris.ogg
Binary file not shown.
Binary file removed handtris/public/sound/themeA.ogg
Binary file not shown.
Binary file removed handtris/public/sounds/Game Health Recharge.wav
Binary file not shown.
Binary file removed handtris/public/sounds/blockdown.wav
Binary file not shown.
Binary file removed handtris/public/sounds/tetris.mp3
Binary file not shown.
Binary file removed handtris/public/sounds/upsidedown.wav
Binary file not shown.
Binary file removed handtris/public/sounds/upsidedown2.wav
Binary file not shown.
Binary file removed handtris/public/sounds/winner.wav
Binary file not shown.
23 changes: 12 additions & 11 deletions handtris/src/components/TetrisPlay.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";
import { useEffect, useRef, useCallback, useState } from "react";
import { WebSocketManager } from "@/components/WebSocketManager";
import { Piece, TetrisGame } from "@/components/TetrisGame";
import { TetrisGame } from "@/components/TetrisGame";
import { HandGestureManager } from "@/components/HandGestureManager";
import Image from "next/image";
import { playSoundEffect } from "@/hook/howl";
Expand Down Expand Up @@ -110,7 +110,6 @@ const Home: React.FC = () => {
fetchRoomPlayers();
}, [fetchRoomPlayers]);


useEffect(() => {
const roomCode = getRoomCode();
const handleBeforeUnload = () => {
Expand Down Expand Up @@ -160,7 +159,7 @@ const Home: React.FC = () => {
}
};
connectWebSocket();
}, []);
});

useEffect(() => {
const preventRefresh = (e: KeyboardEvent | BeforeUnloadEvent) => {
Expand Down Expand Up @@ -347,7 +346,7 @@ const Home: React.FC = () => {
const handleReadyToggle = () => {
if (!isOwner) {
handleReadyClick();
playSoundEffect("/sounds/ready.mp3");
playSoundEffect("/sound/ready.mp3");
}
};

Expand Down Expand Up @@ -378,7 +377,7 @@ const Home: React.FC = () => {
},
`/app/${roomCode}/tetris/start`,
);
playSoundEffect("/sounds/start.mp3");
playSoundEffect("/sound/start.mp3");
// console.log("Message sent to start the game");
} catch (error) {
console.error("Failed to send message to start the game", error);
Expand Down Expand Up @@ -546,7 +545,7 @@ const Home: React.FC = () => {
}, 1000);
return () => clearInterval(interval);
}, []);
const triggerGestureFeedback = (feedback: string) => {
const triggerGestureFeedback = (feedback: string) => {
if (feedback === lastGesture) {
if (feedbackTimeoutRef.current) {
clearTimeout(feedbackTimeoutRef.current);
Expand Down Expand Up @@ -576,10 +575,9 @@ const triggerGestureFeedback = (feedback: string) => {
triggerGestureFeedback,
lastGestureRef,
});

const onResults = useCallback(
(results: HandLandmarkResults & { bothHandsDetected: boolean }) => {

setIsHandDetected(results.bothHandsDetected);

if (borderRef.current) {
Expand All @@ -590,7 +588,7 @@ const triggerGestureFeedback = (feedback: string) => {
},
[handleGesture],
);

useEffect(() => {
if (videoRef.current) {
navigator.mediaDevices
Expand All @@ -614,7 +612,11 @@ const triggerGestureFeedback = (feedback: string) => {
// NOTE ํšจ๊ณผ์ถ”๊ฐ€
setTimeout(() => setShowDonutWarning(false), 3000);
}
drawNextBlock(nextBlock);
drawNextBlock(
tetrisGameRef.current.getNextBlock(),
nextBlockRef.current,
tetrisGameRef.current,
);
}
}, [tetrisGameRef.current?.getNextBlock()]);

Expand Down Expand Up @@ -911,7 +913,6 @@ const triggerGestureFeedback = (feedback: string) => {
id="canvas"
width="350"
height="271"
className=""
/>
</div>
<div className="absolute inset-0"></div>
Expand Down

0 comments on commit 3eba8a0

Please sign in to comment.