+ // lastate was received, but maybe game wasn't ready yet:
+ processLastate: function() {
+ const data = this.lastate;
+ this.lastate = undefined; //security...
+ const L = this.game.moves.length;
+ if (data.movesCount > L)
+ {
+ // Just got last move from him
+ this.$refs["basegame"].play(data.lastMove,
+ "receive", this.game.vname!="Dark" ? "animate" : null);
+ if (data.score != "*" && this.game.score == "*")
+ {
+ // Opponent resigned or aborted game, or accepted draw offer
+ // (this is not a stalemate or checkmate)
+ this.$refs["basegame"].endGame(data.score, "Opponent action");
+ }
+ this.game.clocks = data.clocks; //TODO: check this?
+ if (!!data.lastMove.draw)
+ this.drawOffer = "received";
+ }
+ },