From 8caadc3a7de0ca69ca49d155aec8d3a8ebf3150d Mon Sep 17 00:00:00 2001 From: Patrick McDavid Date: Sun, 15 Dec 2024 19:08:14 -0700 Subject: [PATCH] feat: add sorted scoreboard feature to display player scores on game board --- src/views/gameBoard.vue | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/views/gameBoard.vue b/src/views/gameBoard.vue index ba6a30f..67dab9c 100644 --- a/src/views/gameBoard.vue +++ b/src/views/gameBoard.vue @@ -42,6 +42,15 @@ export default { lightningLocations: [] } }, + computed: { + sortedScoreboard() { + + const playersWithPoints = this.game.GamePlayers.filter(player => player.stats.gamePoint !== undefined && player.stats.gamePoint > 0); + return playersWithPoints.sort((a, b) => { + return b.stats.gamePoint - a.stats.gamePoint + }) + } + }, methods: { handleKeypress(event) { //console.log('Key pressed:', event.key); @@ -556,6 +565,21 @@ export default { +
+
+

Scores

+

Points are earned by holding the goal square when the game ticks. First player to five points wins!

+
    +
  1. + {{ gp.Player.name }} {{ gp.stats.gamePoint }} points{{ gp.stats.killedSomeone? `, ${gp.stats.killedSomeone} kills`:`` }} +
  2. +
+
+ No points yet! Get to that goal square! +
+
+ +