generated from Game-as-a-Service/Gaas-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from Game-as-a-Service/feat/game-over
feat: game over show score board
- Loading branch information
Showing
5 changed files
with
111 additions
and
1 deletion.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<script setup> | ||
import { computed } from 'vue' | ||
import { useGameStore } from '@/stores/game' | ||
import imgSrcs from '@/models/Avatars.js' | ||
const gameStore = useGameStore() | ||
const players = computed(() => | ||
gameStore.gameStatus.players.map((player, i) => ({ | ||
name: player.player_id, | ||
score: player.score, | ||
imgSrc: imgSrcs[i], | ||
})).sort((a, b) => b.score - a.score) | ||
) | ||
const winner = computed(() => players.value[0].name) | ||
</script> | ||
|
||
<template> | ||
<div class="m-4"> | ||
<h5 class="text-white font-bold text-center text-[64px] mb-3"> | ||
遊戲結束, {{ winner }}獲勝! | ||
</h5> | ||
<div class="bg-black py-3 px-5 text-white bg-opacity-60 rounded-3xl"> | ||
<div | ||
v-for="player of players" | ||
:key="player.name" | ||
class="flex items-center w-[700px] p-2 border-b border-grey70" | ||
> | ||
<div class="w-[60px] h-[60px]"> | ||
<img :src="player.imgSrc"> | ||
</div> | ||
<h6 class="pl-3 flex items-center text-[28px] "> | ||
<div class="truncate w-[240px]"> | ||
{{ player.name }} | ||
</div> | ||
: {{ player.score }}分 | ||
</h6> | ||
</div> | ||
</div> | ||
<div class="flex justify-evenly pt-4"> | ||
<img src="/src/assets/images/scoreBoard/play-again.svg"> | ||
<img src="/src/assets/images/scoreBoard/exit.svg"> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
.backgroundBlur { | ||
backdrop-filter: blur(2px); | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters