Skip to content

Commit 8c07d8f

Browse files
committed
Add player and turn indicators
1 parent 756af9f commit 8c07d8f

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

src/views/games/PlayerView.vue

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<template>
2-
<v-card class="player-view">
2+
<v-card
3+
dark
4+
class="player-view"
5+
:class="[isMyTurn ? 'active' : '', 'player' + index]"
6+
>
37
<v-container fluid>
48
<v-layout align-center justify-center column>
59
<v-layout
@@ -59,6 +63,15 @@ export default {
5963
}
6064
},
6165
computed: {
66+
index() {
67+
return this.playerData.player.index;
68+
},
69+
isMyTurn() {
70+
return (
71+
this.playerData.player.index ==
72+
this.playerData.player.map.currentPlayerIndex
73+
);
74+
},
6275
...mapState("lobby", {
6376
userPicture(state) {
6477
let user = state.onlineUsers[this.name];
@@ -84,4 +97,25 @@ export default {
8497
.player-view {
8598
width: 100%;
8699
}
100+
101+
.player0 {
102+
background-color: blue;
103+
}
104+
105+
.player1 {
106+
background-color: red;
107+
}
108+
109+
.active {
110+
animation: glow 1s infinite alternate;
111+
}
112+
113+
@keyframes glow {
114+
from {
115+
box-shadow: 0 0 10px -10px #aef4af;
116+
}
117+
to {
118+
box-shadow: 0 0 10px 10px #aef4af;
119+
}
120+
}
87121
</style>

0 commit comments

Comments
 (0)