newGame.type = this.classifyObject(data.game);
newGame.vname = this.getVname(data.game.vid);
newGame.rid = data.from;
- newGame.score = "*";
this.games.push(newGame);
}
break;
}
case "connect":
case "gconnect":
-console.log(data.code + " " + data.from);
this.$set(this.people, data.from, {name:"", id:0, gamer:data.code[0]=='g'});
this.st.conn.send(JSON.stringify({code:"askidentity", target:data.from}));
if (data.code == "connect")
this.st.conn.send(JSON.stringify({code:"askgame", target:data.from}));
break;
case "disconnect":
- case "pdisconnect":
-console.log(data.code + " " + data.from);
+ case "gdisconnect":
this.$delete(this.people, data.from);
if (data.code == "disconnect")
{
challOrWatch: function(sid, e) {
switch (e.target.innerHTML)
{
- case "Challenge":
+ case "Available":
this.tryChallenge(sid);
break;
case "Playing":
this.showGame(this.games.find(
- g => g.type=="live" && g.players.some(pl => pl.sid == sid)));
+ g => g.players.some(pl => pl.sid == sid || pl.uid == this.people[sid].id)));
break;
};
},