+ const oppCol = V.GetOppCol(this.game.mycolor);
+ if (!!data.rematchSent) {
+ if (this.game.rematchOffer != oppCol) {
+ // Opponent sended rematch offer while we were offline:
+ this.rematchOffer = "received";
+ GameStorage.update(
+ this.gameRef,
+ { rematchOffer: oppCol }
+ );
+ }
+ }
+ else {
+ if (this.game.rematchOffer == oppCol) {
+ // Opponent cancelled rematch offer while we were offline:
+ this.rematchOffer = "";
+ GameStorage.update(
+ this.gameRef,
+ { rematchOffer: "" }
+ );
+ }
+ }
+ }
+ else {
+ const L = this.game.moves.length;
+ const oppIdx = 1 - ["w", "b"].indexOf(this.game.mycolor);
+ this.game.clocks[oppIdx] = data.clock;
+ if (data.movesCount > L) {
+ // Just got last move from him
+ this.$refs["basegame"].play(data.lastMove, "received");
+ this.processMove(data.lastMove);
+ } else {
+ if (!!this.clockUpdate) clearInterval(this.clockUpdate);
+ this.re_setClocks();
+ }
+ if (!!data.drawSent) this.drawOffer = "received";
+ if (!!data.score) {
+ this.drawOffer = "";
+ if (this.game.score == "*")
+ this.gameOver(data.score, data.scoreMsg);
+ }