Updated the Game.jsx
This commit is contained in:
parent
60c0a89ed7
commit
d10b1ea8e9
@ -6,12 +6,16 @@ import Waiting from "@/pages/Game/states/Waiting";
|
|||||||
import Calculate from "@/pages/Game/states/Calculate";
|
import Calculate from "@/pages/Game/states/Calculate";
|
||||||
import Sound from "react-sound";
|
import Sound from "react-sound";
|
||||||
import HintSound from "@/common/sounds/hint.mp3";
|
import HintSound from "@/common/sounds/hint.mp3";
|
||||||
|
import {MusicContext} from "@/common/contexts/MusicContext.jsx";
|
||||||
|
|
||||||
export const Game = () => {
|
export const Game = () => {
|
||||||
const {groups} = useContext(GroupContext);
|
const {groups} = useContext(GroupContext);
|
||||||
|
|
||||||
const [currentState, setCurrentState] = useState("hint");
|
const [currentState, setCurrentState] = useState("hint");
|
||||||
|
|
||||||
|
|
||||||
|
const {musicEnabled} = useContext(MusicContext);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const timeout = setTimeout(() => {
|
const timeout = setTimeout(() => {
|
||||||
setCurrentState("waiting");
|
setCurrentState("waiting");
|
||||||
@ -25,7 +29,7 @@ export const Game = () => {
|
|||||||
return (
|
return (
|
||||||
<div className="game-page">
|
<div className="game-page">
|
||||||
{currentState === "hint" && <>
|
{currentState === "hint" && <>
|
||||||
<Sound url={HintSound} playStatus={Sound.status.PLAYING} volume={60} loop={false}/>
|
<Sound url={HintSound} playStatus={Sound.status.PLAYING} volume={musicEnabled ? 60 : 0} loop={false}/>
|
||||||
<h2 className="hint">
|
<h2 className="hint">
|
||||||
<span>Ziel</span>: Erhalte durch den Verkauf von Kuchen
|
<span>Ziel</span>: Erhalte durch den Verkauf von Kuchen
|
||||||
so viel Gewinn wie möglich.
|
so viel Gewinn wie möglich.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user