0
0
Fork 0

Add ResetGame button when someone has the right answer.

This commit is contained in:
Oliver-Akins 2021-01-07 18:17:37 -07:00
parent c1226a81c5
commit 21bca5f468

View file

@ -1,10 +1,15 @@
<template>
<div id="PlayerHand">
<div class="recentQuestion" v-if="mostRecentQuestion">
<div class="flex-center" v-if="mostRecentQuestion">
{{ mostRecentQuestion }}
</div>
<div class="gameOver" v-else-if="gameOver">
<button>Go to Lobby</button>
<div class="flex-center" v-else-if="gameOver">
<button
class="clickable"
@click.stop="endGame"
>
Go to Lobby
</button>
</div>
<div class="hand" v-else>
<div
@ -56,6 +61,11 @@ export default {
questions() {
return this.$store.state.questions;
},
gameOver() {
let targetAnswer = this.$store.state.chosen_object.toLowerCase()+`.`;
return this.$store.state.answers.team_1.includes(targetAnswer)
|| this.$store.state.answers.team_2.includes(targetAnswer);
},
},
methods: {
sendCard(cardIndex) {
@ -78,6 +88,11 @@ export default {
this.$socket.client.emit(`SendCard`, data);
},
endGame() {
this.$socket.client.emit(`ResetGame`, {
game_code: this.$store.state.game_code
});
},
},
mounted() {
if (this.isGuesser) {
@ -130,7 +145,7 @@ export default {
width: 95%;
}
.recentQuestion {
.flex-center {
justify-content: center;
align-items: center;
display: flex;