|
|
@ -44,7 +44,8 @@ let lastNodes: NodePerson[] = []
|
|
|
|
const MyGraphComponent: React.FC<MyGraphComponentProps> = ({onNodeClick, handleShowTurnBar, handleTurnBarTextChange, playerTouched, setPlayerTouched, changecptTour, solo, addToHistory, showLast, setNetwork}) => {
|
|
|
|
const MyGraphComponent: React.FC<MyGraphComponentProps> = ({onNodeClick, handleShowTurnBar, handleTurnBarTextChange, playerTouched, setPlayerTouched, changecptTour, solo, addToHistory, showLast, setNetwork}) => {
|
|
|
|
let cptTour: number = 0
|
|
|
|
let cptTour: number = 0
|
|
|
|
|
|
|
|
|
|
|
|
const {user} = useAuth()
|
|
|
|
const {isLoggedIn, user} = useAuth()
|
|
|
|
|
|
|
|
console.log('isLoggedIn : ' + isLoggedIn);
|
|
|
|
const { indices, indice, person, personNetwork, setNodeIdData, players, askedPersons, setActualPlayerIndexData, room, actualPlayerIndex, turnPlayerIndex, setTurnPlayerIndexData, setWinnerData } = useGame();
|
|
|
|
const { indices, indice, person, personNetwork, setNodeIdData, players, askedPersons, setActualPlayerIndexData, room, actualPlayerIndex, turnPlayerIndex, setTurnPlayerIndexData, setWinnerData } = useGame();
|
|
|
|
const params = new URLSearchParams(window.location.search);
|
|
|
|
const params = new URLSearchParams(window.location.search);
|
|
|
|
|
|
|
|
|
|
|
@ -448,15 +449,35 @@ let cptTour: number = 0
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
socket.on("end game", (winnerIndex) =>{
|
|
|
|
socket.on("end game", (winnerIndex) =>{
|
|
|
|
|
|
|
|
const currentPlayer = players[actualPlayerIndex];
|
|
|
|
|
|
|
|
const winner = players[winnerIndex];
|
|
|
|
|
|
|
|
|
|
|
|
setNodeIdData(-1)
|
|
|
|
setNodeIdData(-1)
|
|
|
|
setActualPlayerIndexData(-1)
|
|
|
|
setActualPlayerIndexData(-1)
|
|
|
|
setLastIndex(-1)
|
|
|
|
setLastIndex(-1)
|
|
|
|
setPlayerTouched(-1)
|
|
|
|
setPlayerTouched(-1)
|
|
|
|
setWinnerData(players[winnerIndex])
|
|
|
|
setWinnerData(players[winnerIndex])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log('isLoggedIn : ' + isLoggedIn);
|
|
|
|
|
|
|
|
if(isLoggedIn){
|
|
|
|
|
|
|
|
if(solo){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
if(winner.id === currentPlayer.id){
|
|
|
|
|
|
|
|
console.log("Vous avez gagné !");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
console.log("Vous avez perdu !");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
first = true
|
|
|
|
first = true
|
|
|
|
cptHistory = 0
|
|
|
|
cptHistory = 0
|
|
|
|
askedWrong=false
|
|
|
|
askedWrong=false
|
|
|
|
askedWrongBot=false
|
|
|
|
askedWrongBot=false
|
|
|
|
|
|
|
|
|
|
|
|
socket.off("end game")
|
|
|
|
socket.off("end game")
|
|
|
|
socket.off("asked all")
|
|
|
|
socket.off("asked all")
|
|
|
|
socket.off("opacity activated")
|
|
|
|
socket.off("opacity activated")
|
|
|
|