show role on death

This commit is contained in:
Alberto Xamin 2020-11-22 23:33:52 +01:00
parent e40d10ad80
commit 0599a98e7b
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2
3 changed files with 5 additions and 3 deletions

View File

@ -199,6 +199,8 @@ class Game:
self.players.pop(index)
self.sio.emit('room', room=self.name, data={'name': self.name, 'started': self.started, 'players': [p.name for p in self.players]})
self.sio.emit('chat_message', room=self.name, data=f'{player.name} è morto.')
if self.started:
self.sio.emit('chat_message', room=self.name, data=f'{player.name} era {player.role.name}!')
for p in self.players:
p.notify_self()
self.players_map = {c.name: i for i, c in enumerate(self.players)}

View File

@ -1,7 +1,7 @@
<template>
<div class="lobby">
<div style="flex-grow: 4;">
<h2>Lobby: {{ lobbyName }}</h2>
<h2 v-if="!started">Lobby: {{ lobbyName }}</h2>
<h3>Giocatori (tu sei {{username}})</h3>
<div class="players-table">
<Card v-if="startGameCard" :card="startGameCard" @click.native="startGame"/>

View File

@ -9,7 +9,7 @@
<Card v-for="card in equipment" v-bind:key="card.name+card.number" :card="card" />
</transition-group>
</div>
<transition-group name="list" tag="div" style="display: flex; justify-content: space-evenly;">
<transition-group name="list" tag="div" style="display: flex; justify-content: space-evenly; margin-bottom:2pt;">
<span v-for="(n, i) in lives" v-bind:key="n" :alt="i"></span>
<span v-for="(n, i) in (max_lives-lives)" v-bind:key="n" :alt="i">💀</span>
</transition-group>
@ -27,7 +27,7 @@
<Chooser v-if="shouldChooseCard" text="Scegli che carta pescare" :cards="available_cards" :select="choose"/>
<Chooser v-if="lives <= 0 && max_lives > 0" text="SEI MORTO" />
<Chooser v-if="win_status !== undefined" :text="win_status?'HAI VINTO':'HAI PERSO'" />
<Chooser v-if="show_role" text="Tu sei" :cards="[my_role]" :hintText="my_role.goal" :cancel="() => {show_role=false}" cancelText="OK" />
<Chooser v-if="show_role" text="Tu sei" :cards="[my_role]" :hintText="my_role.goal" :select="() => {show_role=false}" :cancel="() => {show_role=false}" cancelText="OK" />
<Chooser v-if="!show_role && is_my_turn" text="GIOCA IL TUO TURNO" :key="is_my_turn" class="turn-notify" />
<Chooser v-if="hasToPickResponse" text="ESTRAI UNA CARTA" :key="hasToPickResponse" class="turn-notify" />
</div>