|
|
|
@ -29,6 +29,7 @@ interface MyGraphComponentProps {
|
|
|
|
|
setNetwork: (network: Network) => void
|
|
|
|
|
showLast: boolean
|
|
|
|
|
setNetworkEnigme: (networkEnigme: Map<number, Pair<Indice, boolean>[]>) => void
|
|
|
|
|
setPlayerIndex: (playerIndex: number) => void
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let lastAskingPlayer = 0
|
|
|
|
@ -45,10 +46,12 @@ let cptHistory = 0
|
|
|
|
|
let lastNodes: NodePerson[] = []
|
|
|
|
|
let cptEndgame = 0
|
|
|
|
|
let firstEnigme = true
|
|
|
|
|
let firstIndex = true
|
|
|
|
|
let endgame= false
|
|
|
|
|
let firstHistory = true
|
|
|
|
|
|
|
|
|
|
const MyGraphComponent: React.FC<MyGraphComponentProps> = ({onNodeClick, handleShowTurnBar, handleTurnBarTextChange, playerTouched, setPlayerTouched, changecptTour, solo, isDaily, isEasy, addToHistory, showLast, setNetwork, setNetworkEnigme}) => {
|
|
|
|
|
|
|
|
|
|
const MyGraphComponent: React.FC<MyGraphComponentProps> = ({onNodeClick, handleShowTurnBar, handleTurnBarTextChange, playerTouched, setPlayerTouched, changecptTour, solo, isDaily, isEasy, addToHistory, showLast, setNetwork, setNetworkEnigme, setPlayerIndex}) => {
|
|
|
|
|
let cptTour: number = 0
|
|
|
|
|
|
|
|
|
|
//* Gestion du temps :
|
|
|
|
@ -118,6 +121,11 @@ const MyGraphComponent: React.FC<MyGraphComponentProps> = ({onNodeClick, handleS
|
|
|
|
|
}, [showLast])
|
|
|
|
|
|
|
|
|
|
let playerIndex: number = turnPlayerIndex
|
|
|
|
|
|
|
|
|
|
if (firstIndex){
|
|
|
|
|
firstIndex=false
|
|
|
|
|
setPlayerIndex(playerIndex)
|
|
|
|
|
}
|
|
|
|
|
let index = 0
|
|
|
|
|
for (let i=0; i<players.length; i++){
|
|
|
|
|
if(players[i].id == socket.id){
|
|
|
|
@ -292,15 +300,14 @@ const MyGraphComponent: React.FC<MyGraphComponentProps> = ({onNodeClick, handleS
|
|
|
|
|
setNetwork(network)
|
|
|
|
|
|
|
|
|
|
if (isDaily){
|
|
|
|
|
if(!isEasy){
|
|
|
|
|
// setNetworkEnigme(dailyEnigme)
|
|
|
|
|
setNetworkEnigme(dailyEnigme)
|
|
|
|
|
if (!isEasy){
|
|
|
|
|
dailyEnigme.forEach((pairs, index) => {
|
|
|
|
|
pairs.forEach((pair) => {
|
|
|
|
|
const i = indices.findIndex((indice) => pair.first.getId() === indice.getId())
|
|
|
|
|
const node = networkData.nodes.get().find((n) => index == n.id)
|
|
|
|
|
if (node != undefined){
|
|
|
|
|
networkData.nodes.update({id: node.id, label: node.label + positionToEmoji(i, pair.second)})
|
|
|
|
|
// const test = networkData.nodes.get().find((n) => index == n.id)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
@ -312,8 +319,9 @@ const MyGraphComponent: React.FC<MyGraphComponentProps> = ({onNodeClick, handleS
|
|
|
|
|
addToHistory("Indice " + positionToEmoji(index, true) + " : " + indice.ToString("fr"))
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
socket.on("reset graph", () => {
|
|
|
|
|
console.log("reset graph")
|
|
|
|
@ -348,6 +356,7 @@ const MyGraphComponent: React.FC<MyGraphComponentProps> = ({onNodeClick, handleS
|
|
|
|
|
if (node!=undefined){
|
|
|
|
|
onNodeClick(false)
|
|
|
|
|
playerIndex = newPlayerIndex
|
|
|
|
|
setPlayerIndex(playerIndex)
|
|
|
|
|
if (mapIndexPersons.get(askedIndex)?.find((p) => p.getId() == id) == undefined){
|
|
|
|
|
const p = personNetwork.getPersons().find((p)=> p.getId() == id)
|
|
|
|
|
const tab = mapIndexPersons.get(askedIndex)
|
|
|
|
@ -524,7 +533,6 @@ const MyGraphComponent: React.FC<MyGraphComponentProps> = ({onNodeClick, handleS
|
|
|
|
|
askedWrongBot=false
|
|
|
|
|
endgame = true
|
|
|
|
|
firstHistory=true
|
|
|
|
|
|
|
|
|
|
try{
|
|
|
|
|
if(isLoggedIn){
|
|
|
|
|
if(!solo){
|
|
|
|
|