X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FGame.vue;h=2beb10cb64c6f5b6193b21a3277ce42aa141a5f2;hb=b9ce3d0fbe6cf8cba01912706ad578144bc9b42f;hp=99b1f22eef7aa5d6a23ee74a1435cf0a4112a57e;hpb=1c15969ecec2a86ee7dffe570e53dfd61fd06b22;p=vchess.git diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index 99b1f22e..2beb10cb 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -252,9 +252,6 @@ export default { }, // NOTE: some redundant code with Hall.vue (mostly related to people array) created: function() { - if (this.$route.query["focus"] === "false") - // Focus explicitely set to false from Hall (live game) - this.focus = false; this.atCreation(); }, mounted: function() { @@ -749,10 +746,15 @@ export default { if (!this.game || !this.game.moves) this.lastateAsked = true; else this.sendLastate(data.from); break; + // TODO: possible bad scenario: reload page while oppponent sends a + // move => get both lastate and newmove, process both, add move twice. + // Confirm scenario? Fix? case "lastate": { // Got opponent infos about last move this.gotLastate = true; this.lastate = data.data; + if (this.lastate.movesCount - 1 > this.gotMoveIdx) + this.gotMoveIdx = this.lastate.movesCount - 1; if (this.game.rendered) // Game is rendered (Board component) this.processLastate(); @@ -760,6 +762,12 @@ export default { break; } case "newmove": { + +// DEBUG: +console.log("Receive move"); +console.log(data.data); +//moveslist not updated when receiving a move? (see in baseGame) + const movePlus = data.data; const movesCount = this.game.moves.length; if (movePlus.index > movesCount) { @@ -1054,7 +1062,7 @@ export default { let gameInfo = { id: getRandString(), //ignored if corr fen: V.GenRandInitFen(this.game.randomness), - players: this.game.players.reverse(), + players: [this.game.players[1], this.game.players[0]], vid: this.game.vid, cadence: this.game.cadence }; @@ -1265,7 +1273,7 @@ export default { this.$nextTick(() => { this.game.rendered = true; // Did lastate arrive before game was rendered? - if (this.lastate) this.processLastate(); + if (!!this.lastate) this.processLastate(); }); if (this.lastateAsked) { this.lastateAsked = false; @@ -1772,19 +1780,19 @@ span.yourturn background-color: lightyellow .draw-received, .draw-received:hover - background-color: lightgreen + background-color: #73C6B6 .draw-threerep, .draw-threerep:hover - background-color: #e4d1fc + background-color: #D2B4DE .rematch-sent, .rematch-sent:hover background-color: lightyellow .rematch-received, .rematch-received:hover - background-color: lightgreen + background-color: #48C9B0 .somethingnew - background-color: #c5fefe + background-color: #D2B4DE .diagram margin: 0 auto