proceed to next round

This commit is contained in:
Settel 2021-09-20 10:41:34 +02:00
parent b921f7b7ee
commit a00931d50a
5 changed files with 46 additions and 3 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="play"> <div class="play">
<div class="play__layout"> <div :class="['play__layout', { 'play__layout__fade-out': fadeOut }]">
<div class="play__layout-playground"> <div class="play__layout-playground">
<Quote :text="quote" /> <Quote :text="quote" />
<Sources :sources="sources" :selectable="selectable" /> <Sources :sources="sources" :selectable="selectable" />
@ -16,6 +16,9 @@
<script> <script>
export default { export default {
computed: { computed: {
fadeOut() {
return this.$store.state.game.phase === 'round-end'
},
gamePhase() { gamePhase() {
return this.$store.state.game.phase return this.$store.state.game.phase
}, },
@ -71,7 +74,13 @@ body,
margin: 16px 16px 0 0; margin: 16px 16px 0 0;
} }
&__fade-out {
animation: play-fade-out 0.7s linear;
animation-fill-mode: forwards;
}
} }
}
@keyframes play-fade-out {
to { opacity: 0; }
} }
</style> </style>

View File

@ -16,6 +16,8 @@ func (gm *Game) ContinueGame() {
gm.revealShowCount() gm.revealShowCount()
case PHASE_REVEAL_SHOW_COUNT: case PHASE_REVEAL_SHOW_COUNT:
gm.revealSource() gm.revealSource()
case PHASE_REVEAL_SOURCE:
gm.nextRound()
default: default:
fmt.Printf("invalid state, can't continue game in %s state, %s phase\n", state, phase) fmt.Printf("invalid state, can't continue game in %s state, %s phase\n", state, phase)
return return

View File

@ -0,0 +1,32 @@
package game
import (
"fmt"
"time"
)
func (gm *Game) nextRound() {
if err := gm.changeGamePhase(STATE_PLAY, PHASE_REVEAL_SOURCE, PHASE_ROUND_END); err != nil {
fmt.Println(err)
return
}
gm.notifyClients()
time.Sleep(2 * time.Second)
err := gm.changeGameState(STATE_PLAY, STATE_READY_SET, "Go!")
if err != nil {
fmt.Println(err)
return
}
gm.notifyClients()
time.Sleep(2 * time.Second)
err = gm.changeGameState(STATE_READY_SET, STATE_PLAY, PHASE_NONE)
if err != nil {
fmt.Println(err)
return
}
gm.runRound()
}

View File

@ -2,7 +2,6 @@ package game
import ( import (
"fmt" "fmt"
// "time"
) )
func (gm *Game) revealShowCount() { func (gm *Game) revealShowCount() {

View File

@ -19,6 +19,7 @@ const (
PHASE_REVEAL_START = "reveal-start" PHASE_REVEAL_START = "reveal-start"
PHASE_REVEAL_SHOW_COUNT = "reveal-show-count" PHASE_REVEAL_SHOW_COUNT = "reveal-show-count"
PHASE_REVEAL_SOURCE = "reveal-source" PHASE_REVEAL_SOURCE = "reveal-source"
PHASE_ROUND_END = "round-end"
) )
const ( const (