fix small quirks

This commit is contained in:
Alberto Xamin 2021-02-01 16:58:33 +01:00
parent b90749ebf6
commit e6f3440298
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2
9 changed files with 49 additions and 18 deletions

View File

@ -104,9 +104,9 @@ class Game:
for k in range(self.players[i].max_lives):
self.players[i].hand.append(self.deck.draw())
self.players[i].notify_self()
current_roles = [type(x.role).__name__ for x in self.players]
current_roles = [x.role.name for x in self.players]
random.shuffle(current_roles)
current_roles = str({x:current_roles.count(x) for x in current_roles}).replace('{','').replace('}','')
current_roles = '|'.join([x + '|' + str(current_roles.count(x)) for x in current_roles])
self.sio.emit('chat_message', room=self.name, data=f'_allroles|{current_roles}')
self.play_turn()

View File

@ -12,12 +12,13 @@
export default {
name: 'Card',
props: {
card: Object
card: Object,
donotlocalize: Boolean
},
computed: {
cardName(){
// console.log(this.$t(`cards.${this.card.name}.name`))
if (this.$t(`cards.${this.card.name}.name`) !== `cards.${this.card.name}.name`) {
if (!this.donotlocalize && this.$t(`cards.${this.card.name}.name`) !== `cards.${this.card.name}.name`) {
return this.$t(`cards.${this.card.name}.name`)
}
return this.card.name

View File

@ -5,7 +5,7 @@
<transition-group name="message" tag="div" id="chatbox">
<!-- <div id="chatbox"> -->
<p style="margin:1pt;" class="chat-message selectable" v-for="(msg, i) in messages" v-bind:key="`${i}-c`" :style="`color:${msg.color}`">{{msg.text}}</p>
<p class="end">.</p>
<p class="end" key="end" style="color:#0000">.</p>
<!-- </div> -->
</transition-group>
<form @submit="sendChatMessage" id="msg-form">
@ -34,7 +34,7 @@ export default {
}),
sockets: {
chat_message(msg) {
console.log(msg)
// console.log(msg)
if ((typeof msg === "string") && msg.indexOf('_') === 0) {
let params = msg.split('|')
let type = params.shift().substring(1)
@ -42,6 +42,12 @@ export default {
params[1] = this.$t(`cards.${params[1]}.name`)
} else if (type === "choose_character"){
params.push(this.$t(`cards.${params[1]}.desc`))
} else if (type === "allroles") {
params.forEach((p,i)=>{
if (i%2 === 0) {
params[i] = this.$t(`cards.${params[i]}.name`)
}
})
}
this.messages.push({text:this.$t(`chat.${type}`, params)});
if (type == 'turn' && params[0] == this.username) {

View File

@ -1,7 +1,7 @@
<template>
<div>
<div class="deck">
<card v-if="endTurnAction && isPlaying" v-show="pending_action == 2" :card="endTurnCard" class="end-turn" @click.native="endTurnAction"/>
<card v-if="endTurnAction && isPlaying" :donotlocalize="true" v-show="pending_action == 2" :card="endTurnCard" class="end-turn" @click.native="endTurnAction"/>
<div v-if="eventCard" style="position:relative">
<div class="card fistful-of-cards" style="position:relative; bottom:-3pt;right:-3pt;"/>
<div class="card fistful-of-cards" style="position:absolute; bottom:-1.5pt;right:-1.5pt;"/>
@ -10,7 +10,7 @@
<div style="position:relative">
<div class="card back" style="position:absolute; bottom:-3pt;right:-3pt;"/>
<div class="card back" style="position:absolute; bottom:-1.5pt;right:-1.5pt;"/>
<card :card="card" :class="{back:true, pick:pending_action === 0, draw:pending_action === 1}" @click.native="action"/>
<card :card="card" :donotlocalize="true" :class="{back:true, pick:pending_action === 0, draw:pending_action === 1}" @click.native="action"/>
</div>
<div style="position:relative;">
<card v-if="previousScrap" :card="previousScrap" style="top: 1.5pt;right: -1.5pt;"/>
@ -88,7 +88,7 @@ export default {
methods: {
action(pile) {
if (this.pending_action !== false && this.pending_action < 2) {
console.log('action')
// console.log('action')
if (this.pending_action == 0)
this.$socket.emit('pick')
else if (this.pending_action == 1)

View File

@ -13,7 +13,7 @@
</div>
<div class="players-table">
<Card v-if="startGameCard" :card="startGameCard" @click.native="startGame"/>
<Card v-if="startGameCard" :donotlocalize="true" :card="startGameCard" @click.native="startGame"/>
<!-- <div style="position: relative;width:260pt;height:400pt;"> -->
<div v-for="p in playersTable" v-bind:key="p.card.name" style="position:relative;">
<transition-group v-if="p.max_lives && !p.is_ghost" name="list" tag="div" class="tiny-health">
@ -23,7 +23,7 @@
<div v-else-if="p.is_ghost" class="tiny-health">
<span>👻</span>
</div>
<Card :card="p.card" :class="{is_my_turn:p.is_my_turn}"/>
<Card :card="p.card" :donotlocalize="true" :class="{is_my_turn:p.is_my_turn}"/>
<Card v-if="p.character" :card="p.character" class="character tiny-character" @click.native="selectedInfo = [p.character]"/>
<Card v-if="p.character && p.character.name !== p.real_character.name" style="transform:scale(0.5) translate(-90px, -50px);" :card="p.character" class="character tiny-character" @click.native="selectedInfo = [p.character]"/>
<tiny-hand :ncards="p.ncards" @click.native="drawFromPlayer(p.name)" :ismyturn="p.pending_action === 2"/>

View File

@ -16,7 +16,7 @@
<div v-else>
<div v-if="!isInLobby" >
<p>{{$t("online_players")}}{{onlinePlayers}}</p>
<Card :card="getSelfCard" style="position:absolute; top:10pt; left: 10pt;"/>
<Card :card="getSelfCard" :donotlocalize="true" style="position:absolute; top:10pt; left: 10pt;"/>
<form @submit="createLobby">
<h2>{{$t("create_lobby")}}</h2>
<p>{{$t("lobby_name")}}</p>
@ -91,7 +91,7 @@ export default {
},
players(num) {
this.onlinePlayers = num;
console.log('PLAYERS:' + num)
// console.log('PLAYERS:' + num)
}
},
methods: {

View File

@ -306,7 +306,7 @@ export default {
this.$socket.emit('chuck_lose_hp_draw')
},
end_turn(){
console.log('ending turn')
// console.log('ending turn')
this.cancelEndingTurn()
this.$socket.emit('end_turn')
},
@ -379,7 +379,7 @@ export default {
with: this.handComputed.indexOf(this.card_with) > -1 ? this.handComputed.indexOf(this.card_with):null,
}
this.card_with = null
console.log(card_data)
// console.log(card_data)
this.$socket.emit('play_card', card_data)
},
choose(card) {

View File

@ -71,7 +71,7 @@
"died": "{0} died",
"died_role": "{0} was a {1}!",
"won": "{0} won!",
"choose_character": "{0} has {1} as character, his special ability is: {3}!",
"choose_character": "{0} has {1} as character, his special ability is: {2}!",
"starting": "The game is starting!",
"sheriff": "{0} is the sheriff!",
"did_choose_character": "{0} did choose the character.",
@ -91,7 +91,7 @@
"special_bart_cassidy": "{0} received a compensation because he was injured.",
"special_el_gringo": "{0} stole a card from {1} when he was was injured.",
"special_calamity": "{0} played {1} as Bang! against {2}.",
"allroles": "In the game there are: {0}.",
"allroles": "In the game there are: {1} {0}, {3} {2}, {5} {4}, {7} {6}.",
"guess": "{0} guesses {1}.",
"guess_right": "{0} was right.",
"guess_wrong": "{0} was wrong.",
@ -416,6 +416,18 @@
"Doc Holyday": {
"name": "Doc Holyday",
"desc": "He can discard 2 cards to play a bang."
},
"Fuorilegge": {
"name": "Outlaw"
},
"Rinnegato": {
"name": "Renegade"
},
"Sceriffo": {
"name": "Sheriff"
},
"Vice": {
"name": "Deputy"
}
},
"help": {

View File

@ -91,7 +91,7 @@
"special_bart_cassidy": "{0} ha ricevuto un risarcimento perchè è stato ferito.",
"special_el_gringo": "{0} rubato una carta a {1} mentre veniva colpito.",
"special_calamity": "{0} ha giocato {1} come un Bang! contro {2}.",
"allroles": "Nella partita ci sono: {0}.",
"allroles": "Nella partita ci sono: {1} {0}, {3} {2}, {5} {4}, {7} {6}.",
"guess": "{0} pensa sia {1}.",
"guess_right": "{0} ha indovinato.",
"guess_wrong": "{0} ha sbagliato.",
@ -416,6 +416,18 @@
"Doc Holyday": {
"name": "Doc Holyday",
"desc": "Nel suo turno può scartare 2 carte per fare un bang."
},
"Sceriffo": {
"name": "Sceriffo"
},
"Fuorilegge": {
"name": "Fuorilegge"
},
"Rinnegato": {
"name": "Rinnegato"
},
"Vice": {
"name": "Vice"
}
},
"help": {