1
0

Integrated music in the Game.jsx

This commit is contained in:
Mathias Wagner 2023-11-19 15:13:15 +01:00
parent fb0a1e0b14
commit b78aed6502
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

View File

@ -3,8 +3,9 @@ import {GroupContext} from "@/common/contexts/GroupContext.jsx";
import {Navigate} from "react-router"; import {Navigate} from "react-router";
import "./styles.sass"; import "./styles.sass";
import Waiting from "@/pages/Game/states/Waiting"; import Waiting from "@/pages/Game/states/Waiting";
import {socket} from "@/common/utils/socket.js"; import Calculate from "@/pages/Game/states/Calculate";
import Calculate from "@/pages/Game/states/Calculate/index.js"; import Sound from "react-sound";
import HintSound from "@/common/sounds/hint.mp3";
export const Game = () => { export const Game = () => {
const {groups} = useContext(GroupContext); const {groups} = useContext(GroupContext);
@ -23,8 +24,13 @@ export const Game = () => {
return ( return (
<div className="game-page"> <div className="game-page">
{currentState === "hint" && <h2 className="hint"><span>Ziel</span>: Erhalte durch den Verkauf von Kuchen {currentState === "hint" && <>
so viel Gewinn wie möglich.</h2>} <Sound url={HintSound} playStatus={Sound.status.PLAYING} volume={60} loop={false}/>
<h2 className="hint">
<span>Ziel</span>: Erhalte durch den Verkauf von Kuchen
so viel Gewinn wie möglich.
</h2>
</>}
{currentState === "waiting" && <Waiting setState={setCurrentState}/>} {currentState === "waiting" && <Waiting setState={setCurrentState}/>}
{currentState === "calculate" && <Calculate setState={setCurrentState}/>} {currentState === "calculate" && <Calculate setState={setCurrentState}/>}
</div> </div>