pending action visualizer
This commit is contained in:
parent
360457907b
commit
3232cc0e6e
@ -216,6 +216,7 @@ class Game:
|
||||
'max_lives': p.max_lives,
|
||||
'is_sheriff': isinstance(p.role, roles.Sheriff),
|
||||
'is_my_turn': p.is_my_turn,
|
||||
'pending_action': p.pending_action,
|
||||
} for p in self.players]
|
||||
self.sio.emit('players_update', room=self.name, data=data)
|
||||
|
||||
|
@ -66,6 +66,7 @@ class Player:
|
||||
self.lives = self.max_lives
|
||||
self.hand = []
|
||||
self.equipment = []
|
||||
self.pending_action = PendingAction.WAIT
|
||||
|
||||
def set_available_character(self, available):
|
||||
self.available_characters = available
|
||||
|
@ -13,6 +13,7 @@
|
||||
</transition-group>
|
||||
<Card :card="p.card" :class="{is_my_turn:p.is_my_turn}"/>
|
||||
<tiny-hand :ncards="p.ncards"/>
|
||||
<span style="position:absolute;top:0;">{{getActionEmoji(p)}}</span>
|
||||
<div class="tiny-equipment">
|
||||
<Card v-for="card in p.equipment" v-bind:key="card.name+card.number" :card="card" />
|
||||
</div>
|
||||
@ -122,6 +123,16 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getActionEmoji(p) {
|
||||
if (p.is_my_turn === undefined || p.pending_action === undefined) return '';
|
||||
if (p.pending_action != 4) {
|
||||
return '▶️'
|
||||
} else if (p.is_my_turn) {
|
||||
return '⏸'
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
getPlayerCard(player) {
|
||||
return {
|
||||
name: player.name,
|
||||
|
Loading…
Reference in New Issue
Block a user