|
|
|
@ -24,14 +24,15 @@ import { colorToEmoji, positionToColor } from "../ColorHelper";
|
|
|
|
|
|
|
|
|
|
interface MyGraphComponentProps {
|
|
|
|
|
onNodeClick: (shouldShowChoiceBar: boolean) => void;
|
|
|
|
|
handleShowTurnBar: (shouldShowTurnBar: boolean) => void
|
|
|
|
|
handleShowTurnBar: (shouldShowTurnBar: boolean) => void;
|
|
|
|
|
FromSolo: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let lastAskingPlayer = 0
|
|
|
|
|
let lastNodeId = -1
|
|
|
|
|
let first = true
|
|
|
|
|
|
|
|
|
|
const MyGraphComponent: React.FC<MyGraphComponentProps> = ({onNodeClick, handleShowTurnBar}) => {
|
|
|
|
|
const MyGraphComponent: React.FC<MyGraphComponentProps> = ({onNodeClick, handleShowTurnBar, FromSolo}) => {
|
|
|
|
|
|
|
|
|
|
const { indices, indice, person, personNetwork, setNodeIdData, players, askedPersons, setActualPlayerIndexData, room, actualPlayerIndex, turnPlayerIndex } = useGame();
|
|
|
|
|
|
|
|
|
@ -96,8 +97,26 @@ const MyGraphComponent: React.FC<MyGraphComponentProps> = ({onNodeClick, handleS
|
|
|
|
|
const networkData = { nodes: nodes, edges: graph.edges };
|
|
|
|
|
const network = new Network(container, networkData, initialOptions);
|
|
|
|
|
|
|
|
|
|
if(FromSolo){
|
|
|
|
|
|
|
|
|
|
//* lsti = Generate indice (paramNbIndice) //une couleur par indice
|
|
|
|
|
/*
|
|
|
|
|
Onclick :
|
|
|
|
|
nbcoup = 0;
|
|
|
|
|
pour chaque indice i :
|
|
|
|
|
jeton = IsNodeInIndice(node,i)
|
|
|
|
|
lstJ.add(jeton)
|
|
|
|
|
if jeton == X :
|
|
|
|
|
rep = false
|
|
|
|
|
if(rep) :
|
|
|
|
|
endgame()
|
|
|
|
|
break
|
|
|
|
|
afficheJeton(jeton)
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
socket.on("node checked",(id, works, color, newPlayerIndex) => {
|
|
|
|
|
const node = nodes.get().find((n) => id == n.id)
|
|
|
|
|
if (node!=undefined){
|
|
|
|
@ -150,8 +169,9 @@ const MyGraphComponent: React.FC<MyGraphComponentProps> = ({onNodeClick, handleS
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -198,6 +218,8 @@ const MyGraphComponent: React.FC<MyGraphComponentProps> = ({onNodeClick, handleS
|
|
|
|
|
onNodeClick(false)
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} //notfromsolo
|
|
|
|
|
|
|
|
|
|
}, []); // Le tableau vide signifie que cela ne s'exécutera qu'une fois après le premier rendu
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|