animate on continue game

This commit is contained in:
Settel 2021-09-03 21:53:58 +02:00
parent d79e3a8956
commit 8213902159
4 changed files with 47 additions and 6 deletions

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="play"> <div class="play">
<div class="play__layout"> <div class="play__layout">
<div class="play__layout-playground"> <div :class="['play__layout-playground', cssLayoutClass ]">
<Quote :text="quote" /> <Quote :text="quote" />
<Sources :sources="sources" :selectable="selectable" /> <Sources :sources="sources" :selectable="selectable" />
<ConfirmButton v-if="selectable"/> <ConfirmButton v-if="selectable"/>
@ -16,6 +16,15 @@
<script> <script>
export default { export default {
computed: { computed: {
cssLayoutClass() {
if (this.$store.state.game.phase === 'reveal-start-1') {
return 'play__layout-playground__flip-out'
} else if (this.$store.state.game.phase === 'reveal-start-2') {
return 'play__layout-playground__flip-in'
}
return
},
gamePhase() { gamePhase() {
return this.$store.state.game.phase return this.$store.state.game.phase
}, },
@ -59,16 +68,36 @@ body,
display: flex; display: flex;
width: 100%; width: 100%;
height: 100%; height: 100%;
perspective: 1200px;
&-playground { &-playground {
position: relative; position: relative;
flex-grow: 1; flex-grow: 1;
&__flip-out {
animation: flip-out .5s ease-in-out;
animation-fill-mode: forwards;
}
&__flip-in {
animation: flip-in .5s ease-in-out;
animation-fill-mode: forwards;
}
} }
&-right-column { &-right-column {
width: 200px; width: 200px;
margin: 16px 16px 0 0; margin: 16px 16px 0 0;
} }
} }
}
@keyframes flip-out {
to { transform: rotateX(90deg); }
}
@keyframes flip-in {
from { transform: rotateX(90deg); }
to { transform: rotateX(0deg); }
} }
</style> </style>

View File

@ -5,4 +5,8 @@ export default function(data) {
store.commit('game/setStateAndPhase', data.game) store.commit('game/setStateAndPhase', data.game)
store.commit('players/setPlayers', data.game) store.commit('players/setPlayers', data.game)
store.commit('round/setRound', data.game) store.commit('round/setRound', data.game)
if (data.game.state === 'play' && data.game.phase === 'reveal-start-2') {
store.commit('selection/clearSelection')
}
} }

View File

@ -2,6 +2,7 @@ package game
import ( import (
"fmt" "fmt"
"time"
) )
func (gm *Game) ContinueGame() { func (gm *Game) ContinueGame() {
@ -26,12 +27,18 @@ func (gm *Game) proceedToReveal() {
return return
} }
err := gm.changeGamePhase(STATE_PLAY, PHASE_SELECT_QUOTE, PHASE_REVEAL_START) if err := gm.changeGamePhase(STATE_PLAY, PHASE_SELECT_QUOTE, PHASE_REVEAL_START1); err != nil {
if err != nil {
fmt.Println(err) fmt.Println(err)
return return
} }
gm.notifyClients()
time.Sleep(1 * time.Second)
if err := gm.changeGamePhase(STATE_PLAY, PHASE_REVEAL_START1, PHASE_REVEAL_START2); err != nil {
fmt.Println(err)
return
}
gm.notifyClients() gm.notifyClients()
} }

View File

@ -16,7 +16,8 @@ const (
const ( const (
PHASE_NONE = "" PHASE_NONE = ""
PHASE_SELECT_QUOTE = "select-quote" PHASE_SELECT_QUOTE = "select-quote"
PHASE_REVEAL_START = "reveal-start" PHASE_REVEAL_START1 = "reveal-start-1"
PHASE_REVEAL_START2 = "reveal-start-2"
) )
const ( const (