X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FGame.vue;h=7b14055f969f595bbb217fb7f7f9d14e82bec646;hp=1ffcda41cf495facddf1892988c4e71cb689ee67;hb=63ca2b89cfe577efd168c6b2e26750cb01b66d64;hpb=430a203855578f9bbf4c851165c6066a741ff1f8 diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index 1ffcda41..7b14055f 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -2,7 +2,7 @@ main .row #chat.col-sm-12.col-md-4.col-md-offset-4 - Chat(:players="game.players") + Chat(:players="game.players" @newchat="processChat") .row .col-sm-12 #actions(v-if="game.mode!='analyze' && game.score=='*'") @@ -11,8 +11,6 @@ main button(@click="resign") Resign div Names: {{ game.players[0].name }} - {{ game.players[1].name }} div(v-if="game.score=='*'") Time: {{ virtualClocks[0] }} - {{ virtualClocks[1] }} - div(v-if="game.type=='corr'") {{ game.corrMsg }} - textarea(v-if="game.score=='*'" v-model="corrMsg") BaseGame(:game="game" :vr="vr" ref="basegame" @newmove="processMove" @gameover="gameOver") @@ -41,7 +39,6 @@ export default { rid: "" }, game: {players:[{name:""},{name:""}]}, //passed to BaseGame - corrMsg: "", //to send offline messages in corr games virtualClocks: [0, 0], //initialized with true game.clocks vr: null, //"variant rules" object initialized from FEN drawOffer: "", //TODO: use for button style @@ -198,7 +195,6 @@ export default { game:myGame, target:data.from})); break; case "newmove": - this.corrMsg = data.move.message; //may be empty this.$set(this.game, "moveToPlay", data.move); //TODO: Vue3... break; case "lastate": //got opponent infos about last move @@ -366,7 +362,6 @@ export default { vanish: s.vanish, start: s.start, end: s.end, - message: m.message, }; }); } @@ -447,8 +442,6 @@ export default { addTime = this.game.increment - elapsed/1000; } let sendMove = Object.assign({}, filtered_move, {addTime: addTime}); - if (this.game.type == "corr") - sendMove.message = this.corrMsg; this.people.forEach(p => { if (p.sid != this.st.user.sid) { @@ -472,7 +465,6 @@ export default { GameStorage.update(this.gameRef.id, { fen: move.fen, - message: this.corrMsg, move: { squares: filtered_move, @@ -513,6 +505,10 @@ export default { if (this.repeat[repIdx] >= 3) this.drawOffer = "received"; //TODO: will print "mutual agreement"... }, + processChat: function(chat) { + if (this.game.type == "corr") + GameStorage.update(this.gameRef.id, {chat: chat}); + }, gameOver: function(score, scoreMsg) { this.game.mode = "analyze"; this.game.score = score;