From 276e1c827523b78f08fb5c9d351a8a76aed5181e Mon Sep 17 00:00:00 2001 From: Alberto Xamin Date: Thu, 1 Jul 2021 17:46:16 +0200 Subject: [PATCH] can't play card message --- backend/bang/players.py | 1 + frontend/src/components/Player.vue | 8 ++++++++ frontend/src/i18n/en.json | 1 + frontend/src/i18n/it.json | 1 + 4 files changed, 11 insertions(+) diff --git a/backend/bang/players.py b/backend/bang/players.py index 317f4b7..ae83626 100644 --- a/backend/bang/players.py +++ b/backend/bang/players.py @@ -592,6 +592,7 @@ class Player: self.hand.insert(hand_index, card) if withCard: self.hand.insert(_with, withCard) + self.sio.emit('cant_play_card', room=self.sid) elif (card.usable_next_turn and card.can_be_used_now) or (isinstance(card, grc.ShopCard) and card.kind == grc.ShopCardKind.BLACK): if did_play_card: self.game.deck.scrap(card, True) diff --git a/frontend/src/components/Player.vue b/frontend/src/components/Player.vue index 847e2e5..137db62 100644 --- a/frontend/src/components/Player.vue +++ b/frontend/src/components/Player.vue @@ -55,6 +55,7 @@ + @@ -129,6 +130,7 @@ export default { noStar: false, committed_suit_manette: null, gold_nuggets: 0, + cantplaycard: false, }), sockets: { role(role) { @@ -198,6 +200,12 @@ export default { this.notifycard = null }.bind(this), 4000) }, + cant_play_card() { + this.cantplaycard = true + setTimeout(function(){ + this.cantplaycard = false + }.bind(this), 1000) + }, event_card(card) { this.eventCard = card }, diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index 5401ea2..9374e7e 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -82,6 +82,7 @@ "submit": "Submit", "copy": "Copy invite", "no_players_in_range": "You can't see the other players, equip a weapon or a scope!", + "cantplaycard": "You can't play this card like that!", "chat": { "spectators": " | A spectator is watching the game | {n} spectators are watching the game", "chat": "Chat", diff --git a/frontend/src/i18n/it.json b/frontend/src/i18n/it.json index 71e9e2d..8454861 100644 --- a/frontend/src/i18n/it.json +++ b/frontend/src/i18n/it.json @@ -82,6 +82,7 @@ "submit": "Invia", "copy": "Copia invito", "no_players_in_range": "Non vedi nessun giocatore, equipaggia un arma o un mirino!", + "cantplaycard": "Non puoi giocare questa carta in questo modo!", "chat": { "spectators": " | Uno spettatore sta guardando la partita | {n} spettatori stanno guardando la partita", "chat": "Chat",