finals table (WIP)

This commit is contained in:
Settel 2021-09-21 07:57:15 +02:00
parent 56bb29611b
commit 247f14559d
8 changed files with 157 additions and 16 deletions

View File

@ -44,15 +44,6 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
html,
body,
#__nuxt,
#__layout,
.layout-default,
.page-play {
height: 100%;
}
.play { .play {
position: relative; position: relative;
width: 100%; width: 100%;

View File

@ -1,6 +1,6 @@
fade-out<template> fade-out<template>
<div class="ready-set"> <div class="ready-set">
<div :class="['ready-set__container', flipOut ]"> <div :class="['ready-set__container', fadeOut ]">
<div class="ready-set__box1" /> <div class="ready-set__box1" />
<div class="ready-set__box2" /> <div class="ready-set__box2" />
<div class="ready-set__box3" /> <div class="ready-set__box3" />
@ -18,7 +18,7 @@ fade-out<template>
export default { export default {
props: ['text'], props: ['text'],
computed: { computed: {
flipOut() { fadeOut() {
if (this.text === '' ){ if (this.text === '' ){
return 'ready-set__container__fade-out' return 'ready-set__container__fade-out'
} }
@ -39,11 +39,15 @@ export default {
<style lang="scss"> <style lang="scss">
.ready-set { .ready-set {
display: flex;
position: relative;
width: 100%;
height: 100%;
align-items: center;
justify-content: center;
&__container { &__container {
position: absolute; position: relative;
left: 50%;
top: 100px;
margin: 0 0 0 -300px;
width: 600px; width: 600px;
height: 600px; height: 600px;
overflow: hidden; overflow: hidden;

View File

@ -0,0 +1,111 @@
<template>
<div class="final">
<div class="final__container">
<div class="final__table-outer-border">
<div class="final__table-head">
<div class="final__title">{{ title }}</div>
</div>
<div class="final__table-body">
<table>
<tr v-for="player in players" :key="player.id">
<td>{{ player.name }}</td>
<td>{{ player.score }}</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
computed: {
title() {
return 'Team Banana Mania'
},
players() {
return [
{ name: 'Hans-Hugo', score: 170 },
{ name: 'Ferdinand', score: 140 },
{ name: 'Ann-Marie', score: 137 },
{ name: 'Jocelyn', score: 80 },
{ name: 'Klaus-Bernd', score: 61 },
{ name: 'Annegret', score: 11 },
{ name: 'Jens-Jörg Hinterhammer-Füllschmied', score: 9 },
{ name: 'Brunhilde', score: 7 },
{ name: 'Margarete Bausenkopf', score: 7 },
{ name: 'Edwin', score: 1 },
{ name: 'Bastoph', score: 0 },
{ name: 'Henndirk', score: -12 },
]
},
},
}
</script>
<style lang="scss">
.final {
display: flex;
width: 100%;
height: 100%;
align-items: center;
justify-content: center;
&__container {
margin: 64px 0;
width: 600px;
min-height: 600px;
}
&__table-outer-border {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
background-color: #8060c0;
padding: 4px;
border-radius: 32px;
}
&__table-head {
display: flex;
width: 100%;
height: 100px;
align-items: center;
justify-content: center;
background-color: #402080;
border-radius: 32px 32px 0 0;
margin-bottom: 4px;
}
&__title {
color: #ffffff;
font-family: "Wendy One";
font-size: 48px;
}
&__table-body {
width: 100%;
height: 100%;
background-color: #402080;
border-radius: 0 0 32px 32px;
color: #ffffff;
font-family: Dosis;
font-size: 32px;
table {
width: 100%;
padding: 64px;
}
td {
max-width: 300px;
white-space: nowrap;
overflow: hidden;
}
td ~ td {
text-align: right;
}
}
}
</style>

View File

@ -3,3 +3,13 @@
<Nuxt /> <Nuxt />
</div> </div>
</template> </template>
<style lang="scss">
html,
body,
#__nuxt,
#__layout,
.layout-default {
height: 100%;
}
</style>

View File

@ -11,6 +11,7 @@
</div> </div>
<ReadySet v-if="gameState === 'ready-set'" :text="gamePhase" /> <ReadySet v-if="gameState === 'ready-set'" :text="gamePhase" />
<Play v-if="gameState === 'play'" /> <Play v-if="gameState === 'play'" />
<Final v-if="gameState === 'final'" />
</div> </div>
</div> </div>
<div class="page-play__container-debug"> <div class="page-play__container-debug">
@ -42,6 +43,7 @@ export default {
<style lang="scss"> <style lang="scss">
.page-play { .page-play {
width: 100%; width: 100%;
height: 100%;
&__container { &__container {
display: flex; display: flex;

View File

@ -0,0 +1,21 @@
package game
import (
"fmt"
)
func (gm *Game) runFinal() {
state, _ := gm.GetState()
if state != STATE_IDLE && state != STATE_PLAY {
fmt.Println(fmt.Errorf("expected state \"IDLE\" | \"PLAY\" != \"%s\"", state))
return
}
err := gm.changeGameState(STATE_ANY, STATE_FINAL, PHASE_NONE)
if err != nil {
fmt.Println(err)
return
}
gm.notifyClients()
}

View File

@ -6,7 +6,8 @@ import (
func (gm *Game) StartGame() { func (gm *Game) StartGame() {
// go gm.runCountdown() // go gm.runCountdown()
go gm.runRound() // go gm.runRound()
go gm.runFinal()
} }
func (gm *Game) ResetGame() { func (gm *Game) ResetGame() {

View File

@ -11,6 +11,7 @@ const (
STATE_IDLE = "idle" STATE_IDLE = "idle"
STATE_READY_SET = "ready-set" STATE_READY_SET = "ready-set"
STATE_PLAY = "play" STATE_PLAY = "play"
STATE_FINAL = "final"
) )
const ( const (