populate Revelation (WIP)

This commit is contained in:
Settel 2021-09-05 01:51:10 +02:00
parent 0e9799e846
commit e66a776e96
5 changed files with 28 additions and 17 deletions

View File

@ -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); }
}
</style>

View File

@ -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
}

View File

@ -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
}

View File

@ -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 (

View File

@ -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 {