Improve history overview
This commit is contained in:
parent
f91f7ea7ed
commit
c3e203e9d4
@ -1,29 +1,53 @@
|
|||||||
<template>
|
<template>
|
||||||
<table v-if="round.loser">
|
<md-app v-if="round.loser">
|
||||||
<tr>
|
<md-app-content>
|
||||||
<td>Round: {{ round.number + 1 }}</td>
|
<div class="md-layout">
|
||||||
<td>Loser: {{ round.loser.name }}</td>
|
<div class="md-layout-item centered">
|
||||||
</tr>
|
<h3>Round {{ round.number + 1 }}, {{ round.loser.name }} lost</h3>
|
||||||
<tr v-for="(playerRoll, pId) in round.rolls">
|
</div>
|
||||||
<td>{{ players[pId].name }}:</td>
|
</div>
|
||||||
<td>
|
<div class="md-layout">
|
||||||
<template v-for="(count, number) in playerRoll">
|
<div class="md-layout-item">
|
||||||
<die v-for="n in count" :number="number" :key="'r'+pId+round.number+n+number"></die>
|
<table>
|
||||||
</template>
|
<tr>
|
||||||
</td>
|
<td></td>
|
||||||
</tr>
|
<td>Throws</td>
|
||||||
</table>
|
</tr>
|
||||||
|
<tr v-for="(playerRoll, pId) in round.rolls">
|
||||||
|
<td>{{ players[pId].name }}</td>
|
||||||
|
<td>
|
||||||
|
<template v-for="(count, number) in playerRoll">
|
||||||
|
<die v-for="n in count" :number="number" :key="'r'+pId+round.number+n+number"></die>
|
||||||
|
</template>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="md-layout-item">
|
||||||
|
<round-turns :round="round" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</md-app-content>
|
||||||
|
</md-app>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {Component, Prop, Vue} from 'vue-property-decorator'
|
import {Component, Prop, Vue} from 'vue-property-decorator'
|
||||||
import {RoundObject, PlayerObject} from "@/objects/objects";
|
import {RoundObject, PlayerObject} from "@/objects/objects";
|
||||||
import Die from "@/components/Die.vue";
|
import Die from "@/components/Die.vue";
|
||||||
|
import RoundTurns from "@/components/RoundTurns.vue";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {Die}
|
components: {RoundTurns, Die}
|
||||||
})
|
})
|
||||||
export default class Round extends Vue {
|
export default class Round extends Vue {
|
||||||
@Prop() private round!: RoundObject;
|
@Prop() private round!: RoundObject;
|
||||||
@Prop() private players!: Record<string, PlayerObject>;
|
@Prop() private players!: Record<string, PlayerObject>;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.centered {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
29
src/components/RoundTurns.vue
Normal file
29
src/components/RoundTurns.vue
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<template>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td>Guesses</td>
|
||||||
|
</tr>
|
||||||
|
<tr v-for="turn in round.turns">
|
||||||
|
<td>
|
||||||
|
{{ turn.number + 1 }} - {{ turn.player.name }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<die v-for="n in turn.diceCount" :number="turn.dieValue" :key="'g'+n+turn.dieValue"></die>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import {Component, Prop, Vue} from 'vue-property-decorator'
|
||||||
|
import {RoundObject} from "@/objects/objects";
|
||||||
|
import Die from "@/components/Die.vue";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
components: {Die}
|
||||||
|
})
|
||||||
|
export default class RoundTurns extends Vue {
|
||||||
|
@Prop() private round!: RoundObject;
|
||||||
|
}
|
||||||
|
</script>
|
@ -74,14 +74,7 @@
|
|||||||
<br><br>
|
<br><br>
|
||||||
<template v-if="lastTurn">
|
<template v-if="lastTurn">
|
||||||
Last guesses: <br>
|
Last guesses: <br>
|
||||||
<table>
|
<round-turns :round="currentRound" />
|
||||||
<tr v-for="turn in currentRound.turns">
|
|
||||||
<td>{{ turn.player.name }} ({{ turn.number + 1 }}):</td>
|
|
||||||
<td>
|
|
||||||
<die v-for="n in turn.diceCount" :number="turn.dieValue" :key="'g'+n+turn.dieValue"></die>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</template>
|
</template>
|
||||||
<br>
|
<br>
|
||||||
<template v-if="!myTurn">Someone else is playing, waiting for your turn<br></template>
|
<template v-if="!myTurn">Someone else is playing, waiting for your turn<br></template>
|
||||||
@ -100,16 +93,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<md-app>
|
<template v-if="gameStateObject && gameStarted">
|
||||||
<md-app-content>
|
History: <br>
|
||||||
<template v-if="gameStateObject && gameStarted">
|
<template v-for="round in gameStateObject.rounds.slice().reverse()">
|
||||||
History: <br>
|
<round :round="round" :players="playersKeyedById"/>
|
||||||
<template v-for="round in gameStateObject.rounds.slice().reverse()">
|
<br>
|
||||||
<round :round="round" :players="playersKeyedById" />
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
|
||||||
</md-app-content>
|
|
||||||
</md-app>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -117,11 +107,23 @@
|
|||||||
import {Component, Vue} from 'vue-property-decorator'
|
import {Component, Vue} from 'vue-property-decorator'
|
||||||
import PerudoApi from "@/services/PerudoApi";
|
import PerudoApi from "@/services/PerudoApi";
|
||||||
import Die from "@/components/Die.vue";
|
import Die from "@/components/Die.vue";
|
||||||
import {ApiObject, GameState, GameStateObject, IsStartedObject, JoinCreateGameObject, MyTurnObject, RoundObject, TurnObject, GameStateState, PlayerObject} from "@/objects/objects";
|
import {
|
||||||
import Round from "@/components/Round.vue"; // @ is an alias to /src
|
ApiObject,
|
||||||
|
GameState,
|
||||||
|
GameStateObject,
|
||||||
|
IsStartedObject,
|
||||||
|
JoinCreateGameObject,
|
||||||
|
MyTurnObject,
|
||||||
|
RoundObject,
|
||||||
|
TurnObject,
|
||||||
|
GameStateState,
|
||||||
|
PlayerObject
|
||||||
|
} from "@/objects/objects";
|
||||||
|
import Round from "@/components/Round.vue";
|
||||||
|
import RoundTurns from "@/components/RoundTurns.vue";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {Round, Die}
|
components: {RoundTurns, Round, Die}
|
||||||
})
|
})
|
||||||
export default class Home extends Vue {
|
export default class Home extends Vue {
|
||||||
private gameState: GameState = GameState.Setup;
|
private gameState: GameState = GameState.Setup;
|
||||||
|
Loading…
Reference in New Issue
Block a user