From 80e1260ac89be0296388dfb0a0998bb7c4e68873 Mon Sep 17 00:00:00 2001 From: pireu2 Date: Thu, 28 Sep 2023 22:11:27 +0300 Subject: [PATCH 1/2] game x sound to come from admin panel like the other sounds --- src/screens/Game.tsx | 3 --- src/shared/GameRound/GameRoundAdmin.tsx | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/screens/Game.tsx b/src/screens/Game.tsx index a0bf113..18bfacd 100644 --- a/src/screens/Game.tsx +++ b/src/screens/Game.tsx @@ -38,13 +38,10 @@ const Game = () => { return; } const audio = new Audio(wrongAnswerSound); - const { play, stop } = useSounds(audio); - play(audio); setWrongAnswers(Math.min(3, game.wrongAnswer)); setTimeout(() => { setWrongAnswers(0); - stop(audio); }, 2000); }, [game?.wrongAnswer]); diff --git a/src/shared/GameRound/GameRoundAdmin.tsx b/src/shared/GameRound/GameRoundAdmin.tsx index 2fe0248..2902bc8 100644 --- a/src/shared/GameRound/GameRoundAdmin.tsx +++ b/src/shared/GameRound/GameRoundAdmin.tsx @@ -20,6 +20,7 @@ import { NormalGame } from '../../types/game'; import { useSounds } from '../../hooks/useSounds.hook'; import round_start from '../../static/round_start.mp3'; import correct_answer from '../../static/correct_answer.mp3'; +import wrongAnswerSound from '../../static/x.mp3'; const GameRoundAdmin = (props: any) => { const [questions, setQuestions] = useState([]); @@ -101,6 +102,9 @@ const GameRoundAdmin = (props: any) => { }; const setAllWrong = () => { + if (counterWrongAnswers != 3){ + playSound(wrongAnswerSound, 5000); + } GamesService.update(selectedGame, { ...game, wrongAnswer: 3 @@ -380,12 +384,20 @@ const GameRoundAdmin = (props: any) => {

Wrong answers

-