From b4fb161253c5e7b4581ca37d22339111dd4aa861 Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Wed, 5 Jun 2019 11:56:03 +0200 Subject: [PATCH] TODO: GameStorage.update + clocks started... --- client/src/components/BaseGame.vue | 2 +- client/src/utils/storage.js | 4 ++-- client/src/views/Game.vue | 30 ++++++++++++++++++++++++------ 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/client/src/components/BaseGame.vue b/client/src/components/BaseGame.vue index e8ca6967..5ee5e0c7 100644 --- a/client/src/components/BaseGame.vue +++ b/client/src/components/BaseGame.vue @@ -145,7 +145,7 @@ export default { endGame: function(score) { this.score = score; this.showScoreMsg(score); - this.$emit("gameover"); //score not required (TODO?) + this.$emit("gameover", score); }, animateMove: function(move) { let startSquare = document.getElementById(getSquareId(move.start)); diff --git a/client/src/utils/storage.js b/client/src/utils/storage.js index 48435b51..8a7c5268 100644 --- a/client/src/utils/storage.js +++ b/client/src/utils/storage.js @@ -110,12 +110,12 @@ export const GameStorage = // localStorage: // TODO: also option to takeback a move ? Is fen included in move ? // NOTE: for live games only (all on server for corr) - update: function(fen, moves, clocks, started, score) + update: function(fen, move, clocks, started, score) { let gameState = JSON.parse(localStorage.getItem("gameState")); if (!!fen) { - gameState.moves = moves; + gameState.moves.push(move); gameState.fen = fen; gameState.clocks = clocks; } diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index dd04b869..13dc4865 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -16,7 +16,8 @@ pareil quand quelqu'un reco.