From e66a776e96a26a9863814a2c185f930cebadd1c2 Mon Sep 17 00:00:00 2001 From: Settel Date: Sun, 5 Sep 2021 01:51:10 +0200 Subject: [PATCH] populate Revelation (WIP) --- client/src/components/Play.vue | 10 +++++----- server/src/game/continueGame.go | 4 ++-- server/src/game/populateGetRoundInfo.go | 18 +++++++++++++++--- server/src/game/struct.go | 8 ++++---- server/src/syncdata/syncdata.go | 5 ++--- 5 files changed, 28 insertions(+), 17 deletions(-) diff --git a/client/src/components/Play.vue b/client/src/components/Play.vue index 90724cd..5d9e124 100644 --- a/client/src/components/Play.vue +++ b/client/src/components/Play.vue @@ -17,9 +17,9 @@ export default { computed: { cssLayoutClass() { - if (this.$store.state.game.phase === 'reveal-start-1') { + if (this.$store.state.game.phase === 'reveal-start') { return 'play__layout-playground__flip-out' - } else if (this.$store.state.game.phase === 'reveal-start-2') { + } else if (this.$store.state.game.phase === 'reveal-show-count') { return 'play__layout-playground__flip-in' } @@ -80,7 +80,7 @@ body, } &__flip-in { - animation: flip-in .5s ease-in-out; + animation: flip-in .5s linear; animation-fill-mode: forwards; } } @@ -97,7 +97,7 @@ body, to { transform: rotateX(90deg); } } @keyframes flip-in { - from { transform: rotateX(90deg); } - to { transform: rotateX(0deg); } + 0% { transform: rotateX(90deg); } + 90% { transform: rotateX(0deg); } } diff --git a/server/src/game/continueGame.go b/server/src/game/continueGame.go index 8c59fe8..81e7aad 100644 --- a/server/src/game/continueGame.go +++ b/server/src/game/continueGame.go @@ -27,7 +27,7 @@ func (gm *Game) proceedToReveal() { return } - if err := gm.changeGamePhase(STATE_PLAY, PHASE_SELECT_QUOTE, PHASE_REVEAL_START1); err != nil { + if err := gm.changeGamePhase(STATE_PLAY, PHASE_SELECT_QUOTE, PHASE_REVEAL_START); err != nil { fmt.Println(err) return } @@ -35,7 +35,7 @@ func (gm *Game) proceedToReveal() { time.Sleep(1 * time.Second) - if err := gm.changeGamePhase(STATE_PLAY, PHASE_REVEAL_START1, PHASE_REVEAL_START2); err != nil { + if err := gm.changeGamePhase(STATE_PLAY, PHASE_REVEAL_START, PHASE_REVEAL_SHOW_COUNT); err != nil { fmt.Println(err) return } diff --git a/server/src/game/populateGetRoundInfo.go b/server/src/game/populateGetRoundInfo.go index d69412b..2bfe572 100644 --- a/server/src/game/populateGetRoundInfo.go +++ b/server/src/game/populateGetRoundInfo.go @@ -24,13 +24,12 @@ func (gm *Game) populateGetRoundInfo() *syncdata.RoundInfo { }) } - roundInfo := syncdata.RoundInfo{ + return &syncdata.RoundInfo{ Quote: quote.GetQuote(), Sources: sources, Selections: gm.getSelections(), + Revelation: gm.getRevelation(), } - - return &roundInfo } func (gm *Game) getSelections() map[string]bool { @@ -49,3 +48,16 @@ func (gm *Game) getSelections() map[string]bool { return selections } + +func (gm *Game) getRevelation() *syncdata.Revelation { + if gm.state != STATE_PLAY || gm.phase != PHASE_REVEAL_SHOW_COUNT { + return nil + } + + votes := make(map[string]syncdata.Votes, 0) + revelation := syncdata.Revelation{ + Votes: votes, + } + + return &revelation +} diff --git a/server/src/game/struct.go b/server/src/game/struct.go index fade01c..f3b97ac 100644 --- a/server/src/game/struct.go +++ b/server/src/game/struct.go @@ -14,10 +14,10 @@ const ( ) const ( - PHASE_NONE = "" - PHASE_SELECT_QUOTE = "select-quote" - PHASE_REVEAL_START1 = "reveal-start-1" - PHASE_REVEAL_START2 = "reveal-start-2" + PHASE_NONE = "" + PHASE_SELECT_QUOTE = "select-quote" + PHASE_REVEAL_START = "reveal-start" + PHASE_REVEAL_SHOW_COUNT = "reveal-show-count" ) const ( diff --git a/server/src/syncdata/syncdata.go b/server/src/syncdata/syncdata.go index d135ef7..5d8ab0b 100644 --- a/server/src/syncdata/syncdata.go +++ b/server/src/syncdata/syncdata.go @@ -18,8 +18,7 @@ type SourceInfo struct { } type Votes struct { - Count int `json:"count"` - Players []string `json:"players"` + Count int `json:"count"` } type Revelation struct { @@ -30,7 +29,7 @@ type RoundInfo struct { Quote string `json:"quote"` Sources []SourceInfo `json:"sources"` Selections map[string]bool `json:"selections"` - Revelation Revelation `json:"revelation"` + Revelation *Revelation `json:"revelation"` } type GameInfo struct {