+ case "identity":
+ {
+ let player = this.people.find(p => p.sid == data.user.sid);
+ player.id = data.user.id;
+ player.name = data.user.name;
+ // Sending last state only for live games: corr games are complete
+ if (this.game.type == "live" && this.game.oppsid == player.sid)
+ {
+ // Send our "last state" informations to opponent
+ const L = this.game.moves.length;
+ this.st.conn.send(JSON.stringify({
+ code: "lastate",
+ target: player.sid,
+ state:
+ {
+ lastMove: (L>0 ? this.game.moves[L-1] : undefined),
+ score: this.game.score,
+ movesCount: L,
+ drawOffer: this.drawOffer,
+ clocks: this.game.clocks,
+ }
+ }));
+ }
+ break;
+ }
+ case "newmove":
+ // NOTE: this call to play() will trigger processMove()
+ this.$refs["basegame"].play(data.move,
+ "receive", this.game.vname!="Dark" ? "animate" : null);
+ break;