X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fcomponents%2FBaseGame.vue;h=1ec412e1dc775edcf3b8e9c17d23a16f449556f9;hb=5e1bc6519d4c81aeac40aec7390c64c913cbf566;hp=0ed908a584333fe733ab4243faa594dd164025ae;hpb=2c5d7b20742b802d9c47916915c1114bcfc9a9c3;p=vchess.git diff --git a/client/src/components/BaseGame.vue b/client/src/components/BaseGame.vue index 0ed908a5..1ec412e1 100644 --- a/client/src/components/BaseGame.vue +++ b/client/src/components/BaseGame.vue @@ -21,6 +21,7 @@ div#baseGame :vname="game.vname" :incheck="incheck" @play-move="play" + @click-square="clickSquare" ) #turnIndicator(v-if="showTurn") {{ turn }} #controls.button-group @@ -227,10 +228,8 @@ export default { this.incheck = this.vr.getCheckSquares(this.vr.turn); const score = this.vr.getCurrentScore(); if (L > 0 && this.moves[L - 1].notation != "...") { - if (["1-0","0-1"].includes(score)) - this.moves[L - 1].notation += "#"; - else if (this.vr.getCheckSquares(this.vr.turn).length > 0) - this.moves[L - 1].notation += "+"; + if (["1-0","0-1"].includes(score)) this.moves[L - 1].notation += "#"; + else if (this.incheck.length > 0) this.moves[L - 1].notation += "+"; } }, positionCursorTo: function(index) { @@ -364,6 +363,11 @@ export default { ); } }, + clickSquare: function(square) { + // Some variants make use of a single click at specific times: + const move = this.vr.doClick(square); + if (!!move) this.play(move); + }, // "light": if gotoMove() or gotoEnd() play: function(move, received, light, noemit) { // Freeze while choices are shown: @@ -428,10 +432,8 @@ export default { const computeScore = () => { const score = this.vr.getCurrentScore(); if (!navigate) { - if (["1-0","0-1"].includes(score)) - this.lastMove.notation += "#"; - else if (this.vr.getCheckSquares(this.vr.turn).length > 0) - this.lastMove.notation += "+"; + if (["1-0","0-1"].includes(score)) this.lastMove.notation += "#"; + else if (this.incheck.length > 0) this.lastMove.notation += "+"; } if (score != "*" && this.game.mode == "analyze") { const message = getScoreMessage(score);