Skip to content

Commit

Permalink
feat() add sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
immortal-tofu committed Nov 29, 2023
1 parent fce6764 commit 9746bb1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Binary file added src/modules/game/assets/begin.mp3
Binary file not shown.
Binary file added src/modules/game/assets/good_guys_win.mp3
Binary file not shown.
8 changes: 7 additions & 1 deletion src/modules/game/components/Game/Game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { useParams } from 'react-router-dom';
import { abi } from '../../../../abi/cipherbomb.json';
import { getEventContract, getReadContract, onNextBlock } from '../../../../utils/rpc';
import { Splash } from '../../../common-ui/components/Splash';
import begin from '../../assets/begin.mp3';
import goodGuysWin from '../../assets/good_guys_win.mp3';
import { Table } from '../Table';
import { WaitingRoom } from '../WaitingRoom';

Expand Down Expand Up @@ -92,13 +94,17 @@ export const Game = ({ account, provider }: GameProps) => {

useEffect(() => {
const gameHasStarted = () => {
onNextBlock(() => setGameIsRunning(true));
onNextBlock(() => {
void new Audio(begin).play();
setGameIsRunning(true);
});
};
const gameHasBeenOpen = () => {
onNextBlock(refreshInformations);
};

const onGoodGuysWin = () => {
void new Audio(goodGuysWin).play();
setEndGame('good');
onNextBlock(refreshInformations);
onNextBlock(refreshPlayers);
Expand Down

0 comments on commit 9746bb1

Please sign in to comment.