"Play with?": "Play with?",
"Playing": "Playing",
"Please log in to accept corr challenges": "Please log in to accept corr challenges",
+ "Please log in to play correspondance games": "Please log in to play correspondance games",
"Please select a variant": "Please select a variant",
"Practice": "Practice",
"Processing... Please wait": "Processing... Please wait",
"Play with?": "¿ Jugar con ?",
"Playing": "Jugando",
"Please log in to accept corr challenges": "Inicia sesión para aceptar los desafíos por correspondencia",
+ "Please log in to play correspondance games": "Inicia sesión para jugar partidas por correspondancia",
"Please select a variant": "Por favor seleccione una variante",
"Practice": "Práctica",
"Processing... Please wait": "Procesando... por favor espere",
"Play with?": "Jouer avec ?",
"Playing": "Jouant",
"Please log in to accept corr challenges": "Identifiez vous pour accepter des défis par correspondance",
+ "Please log in to play correspondance games": "Identifiez vous pour jouer des parties par correspondance",
"Please select a variant": "Sélectionnez une variante SVP",
"Practice": "Pratiquer",
"Processing... Please wait": "Traitement en cours... Attendez SVP",
this.st.conn.send(JSON.stringify({code:"pollclients"}));
},
isConnected: function(index) {
- const name = this.game.players[index].name;
- if (this.st.user.name == name)
+ const player = this.game.players[index];
+ // Is it me ?
+ if (this.st.user.sid == player.sid || this.st.user.id == player.uid)
return true;
- return Object.values(this.people).some(p => p.name == name);
+ // Try to find a match in people:
+ return Object.keys(this.people).some(sid => sid == player.sid) ||
+ Object.values(this.people).some(p => p.id == player.uid);
},
socketMessageListener: function(msg) {
const data = JSON.parse(msg.data);
this.newchallenge.to = this.people[sid].name;
doClick("modalNewgame");
},
- challOrWatch: function(sid, e) {
- switch (e.target.innerHTML)
+ challOrWatch: function(sid) {
+ if (!this.people[sid].gamer)
{
- case "Available":
- this.tryChallenge(sid);
- break;
- case "Playing":
- this.showGame(this.games.find(
- g => g.players.some(pl => pl.sid == sid || pl.uid == this.people[sid].id)));
- break;
- };
+ // Available, in Hall
+ this.tryChallenge(sid);
+ }
+ else
+ {
+ // Playing, in Game
+ this.showGame(this.games.find(
+ g => g.players.some(pl => pl.sid == sid || pl.uid == this.people[sid].id)));
+ }
},
newChallenge: async function() {
if (this.newchallenge.vid == "")