|
|
@ -1,4 +1,4 @@
|
|
|
|
import React, {useEffect} from 'react';
|
|
|
|
import React, {useEffect, useState} from 'react';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Style */
|
|
|
|
/* Style */
|
|
|
@ -11,6 +11,9 @@ import Person from '../res/img/Person.png';
|
|
|
|
import Leave from '../res/icon/leave.png';
|
|
|
|
import Leave from '../res/icon/leave.png';
|
|
|
|
import Replay from '../res/icon/replay.png';
|
|
|
|
import Replay from '../res/icon/replay.png';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* sound */
|
|
|
|
|
|
|
|
import WinSound from '../res/Audio/win.wav';
|
|
|
|
|
|
|
|
|
|
|
|
/* Component */
|
|
|
|
/* Component */
|
|
|
|
import PersonStatus from '../Components/PersonStatus';
|
|
|
|
import PersonStatus from '../Components/PersonStatus';
|
|
|
|
import ButtonImgNav from '../Components/ButtonImgNav';
|
|
|
|
import ButtonImgNav from '../Components/ButtonImgNav';
|
|
|
@ -64,6 +67,11 @@ function EndGame() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
|
|
handleWinSound();
|
|
|
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
useEffect(() => {
|
|
|
|
const container = document.getElementById("vis-graph");
|
|
|
|
const container = document.getElementById("vis-graph");
|
|
|
|
if (!container) {
|
|
|
|
if (!container) {
|
|
|
@ -126,8 +134,21 @@ function EndGame() {
|
|
|
|
indicenull = true;
|
|
|
|
indicenull = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//* Sound
|
|
|
|
|
|
|
|
const [playTurnSound, setPlayTurnSound] = useState(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleWinSound = () => {
|
|
|
|
|
|
|
|
setTimeout(() => { // on attend 1s avant de jouer le son
|
|
|
|
|
|
|
|
setPlayTurnSound(true);
|
|
|
|
|
|
|
|
}, 300);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setTimeout(() => { // on attend 2s avant de remettre le son à false
|
|
|
|
|
|
|
|
setPlayTurnSound(false);
|
|
|
|
|
|
|
|
}, 2000);
|
|
|
|
|
|
|
|
};
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
|
|
|
|
{playTurnSound && <audio src={WinSound} autoPlay />}
|
|
|
|
{!IsSolo ? (
|
|
|
|
{!IsSolo ? (
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<div className="head">
|
|
|
|
<div className="head">
|
|
|
|