Merge branch 'dev' into gold-rush

This commit is contained in:
Giulio 2021-06-20 18:56:11 +02:00
commit b2ea62bce9
5 changed files with 57 additions and 7 deletions

View File

@ -344,7 +344,7 @@ class Player:
if self.game.check_event(ce.FratelliDiSangue) and self.lives > 1 and not self.is_giving_life and len([p for p in self.game.get_alive_players() if p != self and p.lives < p.max_lives]): if self.game.check_event(ce.FratelliDiSangue) and self.lives > 1 and not self.is_giving_life and len([p for p in self.game.get_alive_players() if p != self and p.lives < p.max_lives]):
self.available_cards = [{ self.available_cards = [{
'name': p.name, 'name': p.name,
'icon': p.role.icon if(self.game.initial_players == 3) else '⭐️' if p['is_sheriff'] else '🤠', 'icon': p.role.icon if(self.game.initial_players == 3) else '⭐️' if isinstance(p.role, r.Sheriff) else '🤠',
'alt_text': ''.join(['❤️']*p.lives)+''.join(['💀']*(p.max_lives-p.lives)), 'alt_text': ''.join(['❤️']*p.lives)+''.join(['💀']*(p.max_lives-p.lives)),
'noDesc': True 'noDesc': True
} for p in self.game.get_alive_players() if p != self and p.lives < p.max_lives] } for p in self.game.get_alive_players() if p != self and p.lives < p.max_lives]
@ -383,7 +383,7 @@ class Player:
elif self.is_my_turn and self.pending_action == PendingAction.PLAY and pile == 'event' and self.game.check_event(ce.Rimbalzo) and len([c for c in self.hand if c.name == cs.Bang(0,0).name]) > 0: elif self.is_my_turn and self.pending_action == PendingAction.PLAY and pile == 'event' and self.game.check_event(ce.Rimbalzo) and len([c for c in self.hand if c.name == cs.Bang(0,0).name]) > 0:
self.available_cards = [{ self.available_cards = [{
'name': p.name, 'name': p.name,
'icon': p.role.icon if(self.game.initial_players == 3) else '⭐️' if p['is_sheriff'] else '🤠', 'icon': p.role.icon if(self.game.initial_players == 3) else '⭐️' if isinstance(p.role, r.Sheriff) else '🤠',
'noDesc': True 'noDesc': True
} for p in self.game.get_alive_players() if len(p.equipment) > 0 and p != self] } for p in self.game.get_alive_players() if len(p.equipment) > 0 and p != self]
self.available_cards.append({'icon': '', 'noDesc': True}) self.available_cards.append({'icon': '', 'noDesc': True})
@ -457,8 +457,8 @@ class Player:
self.hand.append(self.game.deck.draw()) self.hand.append(self.game.deck.draw())
if len([c for c in self.gold_rush_equipment if isinstance(c, grc.Piccone)]) > 0: if len([c for c in self.gold_rush_equipment if isinstance(c, grc.Piccone)]) > 0:
self.hand.append(self.game.deck.draw()) self.hand.append(self.game.deck.draw())
self.manette()
self.notify_self() self.notify_self()
self.manette()
def manette(self): def manette(self):
if self.game.check_event(ceh.Manette): if self.game.check_event(ceh.Manette):

View File

@ -13,10 +13,10 @@
<input type="button" class="btn" :value="(showHelp?'X':'?')" style="min-width:28pt;border-radius:100%;cursor:pointer;" @click="getHelp"/> <input type="button" class="btn" :value="(showHelp?'X':'?')" style="min-width:28pt;border-radius:100%;cursor:pointer;" @click="getHelp"/>
<select id="theme" class="btn" v-model="theme"> <select id="theme" class="btn" v-model="theme">
<option <option
v-for="(theme, i) in ['light.☀️.Light', 'dark.🌙️.Dark', 'sepia..Sepia', 'grayscale..Grayscale']" v-for="(theme, i) in ['light.☀️', 'dark.🌙️', 'sepia.🌇️', 'grayscale.📰️']"
:key="`theme-${i}`" :key="`theme-${i}`"
:value="theme.split('.')[0]"> :value="theme.split('.')[0]">
{{theme.split('.')[1]}} {{theme.split('.')[2]}} {{theme.split('.')[1]}} {{$t(`theme.${theme.split('.')[0]}`)}}
</option> </option>
</select> </select>
<select id="lang" class="btn" v-model="$i18n.locale" @change="storeLangPref"> <select id="lang" class="btn" v-model="$i18n.locale" @change="storeLangPref">
@ -111,6 +111,11 @@ export default {
if (localStorage.getItem('lang')) { if (localStorage.getItem('lang')) {
this.$i18n.locale = localStorage.getItem('lang'); this.$i18n.locale = localStorage.getItem('lang');
document.documentElement.lang = this.$i18n.locale; document.documentElement.lang = this.$i18n.locale;
} else {
let userLang = navigator.language || navigator.userLanguage;
if (['it', 'en'].indexOf(userLang) == -1)
userLang = 'en';
this.$i18n.locale = userLang.split('-')[0]
} }
this.detectColorScheme() this.detectColorScheme()
}, },

View File

@ -2,10 +2,11 @@
<div id="app" class="dark-mode"> <div id="app" class="dark-mode">
<div v-if="!isInLobby" id="logo" class="center-stuff" style="margin-bottom:10pt"> <div v-if="!isInLobby" id="logo" class="center-stuff" style="margin-bottom:10pt">
<h1 style="margin-bottom:0pt;">PewPew!</h1> <h1 style="margin-bottom:0pt;">PewPew!</h1>
<p id="tip" style="margin-top: auto; color:darkorange">{{$t(randomTip)}}</p>
<p style="transform: scale(0.7);margin-top: auto;">v-{{version}}</p> <p style="transform: scale(0.7);margin-top: auto;">v-{{version}}</p>
<div style="display:flex;justify-content: space-evenly;;min-height:140pt;"> <div style="display:flex;justify-content: space-evenly;;min-height:140pt;">
<span style="font-size:48pt;transform:scaleX(-1) translateY(25%);">🔫</span> <span style="font-size:48pt;transform:scaleX(-1) translateY(25%);">🔫</span>
<TinyHand :ncards="5" ismyturn="true" style="position:none;transform:scale(1);bottom:none;width:120pt;"/> <TinyHand :ncards="5" :ismyturn="true" style="position:none;transform:scale(1);bottom:none;width:120pt;"/>
<span style="font-size:48pt;transform:translateY(25%);">🔫</span> <span style="font-size:48pt;transform:translateY(25%);">🔫</span>
</div> </div>
<i style="font-size: x-small;">{{$t("trademark")}}</i> <i style="font-size: x-small;">{{$t("trademark")}}</i>
@ -69,6 +70,7 @@ export default {
lobbyName: '', lobbyName: '',
isInLobby: false, isInLobby: false,
onlinePlayers: 0, onlinePlayers: 0,
randomTip: '',
}), }),
computed: { computed: {
noLobbyAvailable() { noLobbyAvailable() {
@ -145,6 +147,7 @@ export default {
}, },
}, },
mounted() { mounted() {
this.randomTip = `tip_${1+Math.floor(Math.random() * 7)}`
if (localStorage.getItem('username')) if (localStorage.getItem('username'))
this.username = localStorage.getItem('username') this.username = localStorage.getItem('username')
else { else {
@ -168,4 +171,20 @@ export default {
font-size: 20pt; font-size: 20pt;
} }
} }
#tip {
animation-name: zoom;
animation-duration: 2s;
animation-iteration-count: infinite;
}
@keyframes zoom {
0% {
transform: scale(1);
}
50% {
transform: scale(0.95);
}
100% {
transform: scale(1);
}
}
</style> </style>

View File

@ -1,5 +1,12 @@
{ {
"trademark": "Bang! is a trademark owned by DVGiochi", "trademark": "Bang! is a trademark owned by DVGiochi",
"tip_1": "Better with friends!",
"tip_2": "The 🤖️ icon means that a player is a bot!",
"tip_3": "You can click on the cards of characters and equipments of the other players if you wish to know more!",
"tip_4": "Dodge City, High Noon, Fistful Of Cards included!",
"tip_5": "Found a bug? Message us on discord!",
"tip_6": "Now with a discord server!",
"tip_7": "If you want to help us translate the game in your language, ping us on discord!",
"online_players": "Online players: ", "online_players": "Online players: ",
"choose_username": "Pick an username:", "choose_username": "Pick an username:",
"available_lobbies": "Available Lobbies:", "available_lobbies": "Available Lobbies:",
@ -700,5 +707,11 @@
"gotoallcharacters": "Jump to all characters", "gotoallcharacters": "Jump to all characters",
"highnooncards": "High Noon - Event Cards", "highnooncards": "High Noon - Event Cards",
"foccards": "Fistful of Cards - Event Cards" "foccards": "Fistful of Cards - Event Cards"
},
"theme": {
"sepia": "Sepia",
"light": "Light",
"dark": "Dark",
"grayscale": "Grayscale"
} }
} }

View File

@ -1,5 +1,12 @@
{ {
"trademark": "Bang! è un marchio registrato DVGiochi", "trademark": "Bang! è un marchio registrato DVGiochi",
"tip_1": "Con gli amici è meglio!",
"tip_2": "Il simbolo 🤖️ vuol dire che il giocatore è un bot!",
"tip_3": "Puoi cliccare sulle carte dei personaggi o equipaggiamento degli altri per vedere cosa fanno!",
"tip_4": "Dodge City, High Noon, Fistful Of Cards inclusi!",
"tip_5": "Se trovi un bug comunicacelo su discord!",
"tip_6": "Adesso con un server discord!",
"tip_7": "Se vuoi aiutarci a tradurre il gioco nella tua lingua scrivicelo su discord!",
"online_players": "Giocatori online: ", "online_players": "Giocatori online: ",
"choose_username": "Scegli un username:", "choose_username": "Scegli un username:",
"available_lobbies": "Stanze disponibili:", "available_lobbies": "Stanze disponibili:",
@ -700,5 +707,11 @@
"allcharacters": "Tutti i personaggi", "allcharacters": "Tutti i personaggi",
"highnooncards": "Carte Evento High Noon", "highnooncards": "Carte Evento High Noon",
"foccards": "Carte Evento Fistful of Cards" "foccards": "Carte Evento Fistful of Cards"
},
"theme": {
"sepia": "Seppia",
"light": "Chiaro",
"dark": "Scuro",
"grayscale": "Scala di Grigi"
} }
} }