|
|
@ -37,9 +37,21 @@ io.on('connection', (socket) => {
|
|
|
|
io.to(playerId).emit("join during game", networkPerson, person, indices, start, map.get(room).tab, nodes)
|
|
|
|
io.to(playerId).emit("join during game", networkPerson, person, indices, start, map.get(room).tab, nodes)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
socket.on("join back game", (player) => {
|
|
|
|
|
|
|
|
for (const k of map.keys()){
|
|
|
|
|
|
|
|
const tab = map.get(k)
|
|
|
|
|
|
|
|
for (let i = 0; i<tab.tab.length; i++){
|
|
|
|
|
|
|
|
if (tab.tab[i].pseudo === player.pseudo && tab.tab[i].type !== "User"){
|
|
|
|
|
|
|
|
if (tab.started){
|
|
|
|
|
|
|
|
io.to(socket.id).emit("join back game", k)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
socket.on("lobby joined", (room, player) =>{
|
|
|
|
socket.on("lobby joined", (room, player) =>{
|
|
|
|
if (lastSocketJoined != player.id){
|
|
|
|
|
|
|
|
lastSocketJoined=player.id
|
|
|
|
|
|
|
|
const game = map.get(room)
|
|
|
|
const game = map.get(room)
|
|
|
|
if (game !== undefined){
|
|
|
|
if (game !== undefined){
|
|
|
|
if (game.tab.length == 6 && !game.started){
|
|
|
|
if (game.tab.length == 6 && !game.started){
|
|
|
@ -88,7 +100,6 @@ io.on('connection', (socket) => {
|
|
|
|
const playerArray = Array.from(map.entries()).map(([key, value]) => ({ key, value }))
|
|
|
|
const playerArray = Array.from(map.entries()).map(([key, value]) => ({ key, value }))
|
|
|
|
const playerJson = JSON.stringify(playerArray);
|
|
|
|
const playerJson = JSON.stringify(playerArray);
|
|
|
|
io.emit("request lobbies", playerJson)
|
|
|
|
io.emit("request lobbies", playerJson)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|