From ae638ba920d0d5da5a0758e7dbc806c70dc9c282 Mon Sep 17 00:00:00 2001 From: legonzaur Date: Fri, 17 May 2024 15:03:55 +0200 Subject: [PATCH] Feat : create functionb hooks for winner and loser screens Related to #49 --- components/GameBoard.vue | 24 ++++++++++++++++++++++++ netcode/Game.ts | 1 + 2 files changed, 25 insertions(+) diff --git a/components/GameBoard.vue b/components/GameBoard.vue index 746ae61..1e6ab22 100644 --- a/components/GameBoard.vue +++ b/components/GameBoard.vue @@ -12,6 +12,30 @@ watch( playSound('/sounds/ding.mp3') } }) + +watch( + () => goStore.current_game?.losers, + () => { + if (goStore.self?.uuid && goStore.current_game?.losers && goStore.current_game.losers.includes(goStore.self.uuid)) { + showLoserScreen() + } + }) + +watch( + () => goStore.current_game?.ended, + () => { + if (goStore.current_game?.ended && goStore.self?.uuid && goStore.current_game?.losers && !goStore.current_game.losers.includes(goStore.self.uuid)) { + showWinnerScreen() + } + }) + +function showLoserScreen() { + // playSound('/sounds/ding.mp3') +} + +function showWinnerScreen() { + // playSound('/sounds/ding.mp3') +}