Update code to work with new api version
This commit is contained in:
parent
300819bc07
commit
14cc278a41
15908
package-lock.json
generated
15908
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -57,6 +57,7 @@ export interface TurnObject {
|
||||
|
||||
export interface PlayerObject {
|
||||
id: string,
|
||||
hash: string,
|
||||
name: string,
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@
|
||||
</template>
|
||||
|
||||
<template v-if="gameStateObject && gameRunning">
|
||||
<span v-if="previousRound && previousRound.loser.name === name">You lost the previous round!<br></span>
|
||||
<span v-if="previousRound && previousRound.loser.hash === playerHash">You lost the previous round!<br></span>
|
||||
Round: {{ currentRound.number + 1 }} <br>
|
||||
Turn: {{ lastTurn ? lastTurn.number + 2 : 1 }} <br>
|
||||
|
||||
@ -87,7 +87,7 @@
|
||||
<template v-if="!myTurn">Someone else is playing, waiting for your turn<br></template>
|
||||
Players: <br>
|
||||
<template v-for="player in gameStateObject.players">
|
||||
-{{ player.id === gameStateObject.currentPlayer.id ? '>' : '-' }}{{ player.name }}<br>
|
||||
-{{ player.hash === gameStateObject.currentPlayer.hash ? '>' : '-' }}{{ player.name }}<br>
|
||||
</template>
|
||||
<br>
|
||||
</template>
|
||||
@ -142,6 +142,7 @@ export default class Home extends Vue {
|
||||
private owner: boolean = false;
|
||||
|
||||
private playerId: string | null = null;
|
||||
private playerHash: string | null = null;
|
||||
private gameTimer: number | null = null;
|
||||
|
||||
private diceCount: string = '1';
|
||||
@ -172,7 +173,7 @@ export default class Home extends Vue {
|
||||
if (this.gameStateObject) {
|
||||
let players = this.gameStateObject.players;
|
||||
for (let key in players) {
|
||||
newPlayers[players[key].id] = players[key];
|
||||
newPlayers[players[key].hash] = players[key];
|
||||
}
|
||||
}
|
||||
return newPlayers;
|
||||
@ -200,6 +201,7 @@ export default class Home extends Vue {
|
||||
}
|
||||
PerudoApi.instance.createGame(this.name).then((response: JoinCreateGameObject) => {
|
||||
this.playerId = response.player.id;
|
||||
this.playerHash = response.player.hash;
|
||||
this.code = response.code;
|
||||
this.owner = true;
|
||||
|
||||
@ -223,6 +225,7 @@ export default class Home extends Vue {
|
||||
}
|
||||
PerudoApi.instance.joinGame(this.name, this.code).then((response: JoinCreateGameObject) => {
|
||||
this.playerId = response.player.id;
|
||||
this.playerHash = response.player.hash;
|
||||
this.gameTimer = setInterval(() => {
|
||||
this.checkStarted();
|
||||
}, 1000);
|
||||
|
Loading…
x
Reference in New Issue
Block a user