add better info screen
This commit is contained in:
parent
7dab001bb0
commit
bae85b7508
@ -9,11 +9,61 @@ class DodgeCity():
|
|||||||
from bang.expansions.dodge_city import cards
|
from bang.expansions.dodge_city import cards
|
||||||
return cards.get_starting_deck()
|
return cards.get_starting_deck()
|
||||||
|
|
||||||
|
def get_expansion_info(self):
|
||||||
|
return {
|
||||||
|
"id": "dodge_city",
|
||||||
|
"name": "Dodge City",
|
||||||
|
"cards": [
|
||||||
|
{"type": "characters", "cards": DodgeCity.get_characters()},
|
||||||
|
{"type": "cards", "cards": DodgeCity.get_cards()}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
class HighNoon():
|
||||||
|
def get_events():
|
||||||
|
from bang.expansions.high_noon import card_events
|
||||||
|
return card_events.get_all_events() + [card_events.get_endgame_card()]
|
||||||
|
|
||||||
|
def get_expansion_info(self):
|
||||||
|
return {
|
||||||
|
"id": "high_noon",
|
||||||
|
"name": "High Noon",
|
||||||
|
"cards": [
|
||||||
|
{"type": "events", "cards": HighNoon.get_events()}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
class FistfulOfCards():
|
||||||
|
def get_events():
|
||||||
|
from bang.expansions.fistful_of_cards import card_events
|
||||||
|
return card_events.get_all_events() + [card_events.get_endgame_card()]
|
||||||
|
|
||||||
|
def get_expansion_info(self):
|
||||||
|
return {
|
||||||
|
"id": "fistful_of_cards",
|
||||||
|
"name": "Fistful of Cards",
|
||||||
|
"cards": [
|
||||||
|
{"type": "events", "cards": FistfulOfCards.get_events()}
|
||||||
|
]
|
||||||
|
}
|
||||||
class GoldRush():
|
class GoldRush():
|
||||||
def get_characters():
|
def get_characters():
|
||||||
from bang.expansions.gold_rush import characters
|
from bang.expansions.gold_rush import characters
|
||||||
return characters.all_characters()
|
return characters.all_characters()
|
||||||
|
|
||||||
|
def get_shop_cards():
|
||||||
|
from bang.expansions.gold_rush import shop_cards
|
||||||
|
return shop_cards.get_cards()
|
||||||
|
|
||||||
|
def get_expansion_info(self):
|
||||||
|
return {
|
||||||
|
"id": "gold_rush",
|
||||||
|
"name": "Gold Rush",
|
||||||
|
"cards": [
|
||||||
|
{"type": "characters", "cards": GoldRush.get_characters()},
|
||||||
|
{"type": "cards", "cards": GoldRush.get_shop_cards()}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
class TheValleyOfShadows():
|
class TheValleyOfShadows():
|
||||||
def get_characters():
|
def get_characters():
|
||||||
from bang.expansions.the_valley_of_shadows import characters
|
from bang.expansions.the_valley_of_shadows import characters
|
||||||
@ -23,7 +73,74 @@ class TheValleyOfShadows():
|
|||||||
from bang.expansions.the_valley_of_shadows import cards
|
from bang.expansions.the_valley_of_shadows import cards
|
||||||
return cards.get_starting_deck()
|
return cards.get_starting_deck()
|
||||||
|
|
||||||
|
def get_expansion_info(self):
|
||||||
|
return {
|
||||||
|
"id": "the_valley_of_shadows",
|
||||||
|
"name": "The Valley of Shadows",
|
||||||
|
"cards": [
|
||||||
|
{"type": "characters", "cards": TheValleyOfShadows.get_characters()},
|
||||||
|
{"type": "cards", "cards": TheValleyOfShadows.get_cards()}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
class WildWestShow():
|
class WildWestShow():
|
||||||
def get_characters():
|
def get_characters():
|
||||||
from bang.expansions.wild_west_show import characters
|
from bang.expansions.wild_west_show import characters
|
||||||
return characters.all_characters()
|
return characters.all_characters()
|
||||||
|
|
||||||
|
def get_events():
|
||||||
|
from bang.expansions.wild_west_show import card_events
|
||||||
|
return card_events.get_all_events() + [card_events.get_endgame_card()]
|
||||||
|
|
||||||
|
def get_expansion_info(self):
|
||||||
|
return {
|
||||||
|
"id": "wild_west_show",
|
||||||
|
"name": "Wild West Show",
|
||||||
|
"cards": [
|
||||||
|
{"type": "characters", "cards": WildWestShow.get_characters()},
|
||||||
|
{"type": "events", "cards": WildWestShow.get_events()}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
class TrainRobbery():
|
||||||
|
def get_stations():
|
||||||
|
from bang.expansions.train_robbery import stations
|
||||||
|
return stations.get_all_stations()
|
||||||
|
|
||||||
|
def get_trains():
|
||||||
|
from bang.expansions.train_robbery import trains
|
||||||
|
return trains.get_all_cards() + trains.get_locomotives()
|
||||||
|
|
||||||
|
def get_expansion_info(self):
|
||||||
|
return {
|
||||||
|
"id": "train_robbery",
|
||||||
|
"name": "Train Robbery",
|
||||||
|
"cards": [
|
||||||
|
{"type": "stations", "cards": TrainRobbery.get_stations()},
|
||||||
|
{"type": "trains", "cards": TrainRobbery.get_trains()}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
def get_expansion_info(expansion_id):
|
||||||
|
expansion_map = {
|
||||||
|
"dodge_city": DodgeCity(),
|
||||||
|
"high_noon": HighNoon(),
|
||||||
|
"fistful_of_cards": FistfulOfCards(),
|
||||||
|
"gold_rush": GoldRush(),
|
||||||
|
"the_valley_of_shadows": TheValleyOfShadows(),
|
||||||
|
"wild_west_show": WildWestShow(),
|
||||||
|
"train_robbery": TrainRobbery()
|
||||||
|
}
|
||||||
|
|
||||||
|
expansion_info = expansion_map[expansion_id].get_expansion_info()
|
||||||
|
|
||||||
|
for section in expansion_info["cards"]:
|
||||||
|
unique_cards = []
|
||||||
|
seen_card = set()
|
||||||
|
for card in section["cards"]:
|
||||||
|
if card.name not in seen_card:
|
||||||
|
unique_cards.append(card)
|
||||||
|
seen_card.add(card.name)
|
||||||
|
section["cards"] = unique_cards
|
||||||
|
|
||||||
|
return expansion_info
|
@ -1326,6 +1326,12 @@ def get_trainrobberycards(sid):
|
|||||||
}, default=lambda o: o.__dict__)
|
}, default=lambda o: o.__dict__)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@sio.event
|
||||||
|
@bang_handler
|
||||||
|
def get_expansion_info(sid, id):
|
||||||
|
from bang.expansions import get_expansion_info
|
||||||
|
sio.emit("expansion_info", room=sid, data=json.dumps(get_expansion_info(id), default=lambda o: o.__dict__))
|
||||||
|
|
||||||
@sio.event
|
@sio.event
|
||||||
@bang_handler
|
@bang_handler
|
||||||
def discord_auth(sid, data):
|
def discord_auth(sid, data):
|
||||||
|
117
frontend/src/components/ExpansionPopup.vue
Normal file
117
frontend/src/components/ExpansionPopup.vue
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<template>
|
||||||
|
<div class="popup-overlay" v-if="show" @click="handleOverlayClick">
|
||||||
|
<div class="popup-content" @click.stop>
|
||||||
|
<button class="close-button" @click="close">×</button>
|
||||||
|
<h2>{{ expansion.name }}</h2>
|
||||||
|
<div v-for="section in expansion.cards" :key="section.type" class="section">
|
||||||
|
<h3>{{ section.type }}</h3>
|
||||||
|
<div class="cards-container flexy-cards-wrapper">
|
||||||
|
<div v-for="card in section.cards" :key="card.name" class="flexy-cards">
|
||||||
|
<Card :card="card" v-if="section.type !== 'stations'" :class="getClass(expansion, section)"/>
|
||||||
|
<StationCard :card="card" :price="card.price" v-else-if="section.type === 'stations'"/>
|
||||||
|
<div style="margin-left:6pt;">
|
||||||
|
<p>{{$t(`cards.${card.name}.desc`)}}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Card from '@/components/Card.vue';
|
||||||
|
import StationCard from './StationCard.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
show: Boolean,
|
||||||
|
expansion: Object, // Expecting an object with id, name, and cards
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
Card,
|
||||||
|
StationCard,
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
close() {
|
||||||
|
this.$emit('close');
|
||||||
|
},
|
||||||
|
handleOverlayClick() {
|
||||||
|
this.close();
|
||||||
|
},
|
||||||
|
getClass(expansion, section) {
|
||||||
|
let classes = ''
|
||||||
|
if (section.type == 'events') {
|
||||||
|
classes += 'last-event';
|
||||||
|
}
|
||||||
|
if (expansion.id == 'fistful_of_cards') {
|
||||||
|
classes += ' fistful-of-cards';
|
||||||
|
} else if (expansion.id == 'high_noon') {
|
||||||
|
classes += ' high-noon';
|
||||||
|
} else if (expansion.id == 'gold_rush') {
|
||||||
|
classes += ' gold-rush';
|
||||||
|
} else if (expansion.id == 'train_robbery') {
|
||||||
|
classes += ' train-robbery';
|
||||||
|
} else if (expansion.id == 'the_valley_of_shadows') {
|
||||||
|
classes += ' valley-of-shadows';
|
||||||
|
} else if (expansion.id == 'wild_west_show') {
|
||||||
|
classes += ' wild-west-show';
|
||||||
|
}
|
||||||
|
console.log(classes);
|
||||||
|
return classes;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.popup-overlay {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.popup-content {
|
||||||
|
position: relative;
|
||||||
|
background: white;
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 5px;
|
||||||
|
max-width: 80%;
|
||||||
|
max-height: 80%;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
.close-button {
|
||||||
|
position: absolute;
|
||||||
|
top: 10px;
|
||||||
|
right: 10px;
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
font-size: 24px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.section {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
.cards-container {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
.card {
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
.flexy-cards-wrapper {
|
||||||
|
display: flex;
|
||||||
|
flex-flow: wrap;
|
||||||
|
}
|
||||||
|
.flexy-cards {
|
||||||
|
flex: 30%;
|
||||||
|
display:flex;
|
||||||
|
}
|
||||||
|
</style>
|
@ -195,9 +195,8 @@
|
|||||||
<p v-else style="min-height: 19px"></p>
|
<p v-else style="min-height: 19px"></p>
|
||||||
<h3>{{ $t("expansions") }}</h3>
|
<h3>{{ $t("expansions") }}</h3>
|
||||||
<div class="players-table" style="justify-content: flex-start">
|
<div class="players-table" style="justify-content: flex-start">
|
||||||
|
<div v-for="ex in expansionsStatus" :key="ex.id" class="expansion-card" style="position: relative">
|
||||||
<card
|
<card
|
||||||
v-for="ex in expansionsStatus"
|
|
||||||
v-bind:key="ex.id"
|
|
||||||
:id="ex.id"
|
:id="ex.id"
|
||||||
:card="ex.card"
|
:card="ex.card"
|
||||||
:class="{
|
:class="{
|
||||||
@ -207,6 +206,8 @@
|
|||||||
:donotlocalize="true"
|
:donotlocalize="true"
|
||||||
@click.native="toggleExpansions(ex.id)"
|
@click.native="toggleExpansions(ex.id)"
|
||||||
/>
|
/>
|
||||||
|
<button class="info-button" @click="showExpansionInfo(ex.id)">?</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p v-if="isRoomOwner">{{ $t("click_to_toggle") }}</p>
|
<p v-if="isRoomOwner">{{ $t("click_to_toggle") }}</p>
|
||||||
<h3>{{ $t("mods") }}</h3>
|
<h3>{{ $t("mods") }}</h3>
|
||||||
@ -391,6 +392,13 @@
|
|||||||
:playerRole="deadRoleData.role"
|
:playerRole="deadRoleData.role"
|
||||||
/>
|
/>
|
||||||
</transition>
|
</transition>
|
||||||
|
<transition name="bounce">
|
||||||
|
<ExpansionPopup
|
||||||
|
:show="showPopup"
|
||||||
|
:expansion="selectedExpansionInfo"
|
||||||
|
@close="closePopup"
|
||||||
|
/>
|
||||||
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -410,6 +418,7 @@ import AnimatedCard from "./AnimatedCard.vue";
|
|||||||
import { emojiMap } from "@/utils/emoji-map.js";
|
import { emojiMap } from "@/utils/emoji-map.js";
|
||||||
import { expansionsMap } from "@/utils/expansions-map.js";
|
import { expansionsMap } from "@/utils/expansions-map.js";
|
||||||
import AnimatedEffect from './AnimatedEffect.vue';
|
import AnimatedEffect from './AnimatedEffect.vue';
|
||||||
|
import ExpansionPopup from '@/components/ExpansionPopup.vue';
|
||||||
|
|
||||||
const cumulativeOffset = function (element) {
|
const cumulativeOffset = function (element) {
|
||||||
var top = 0,
|
var top = 0,
|
||||||
@ -440,6 +449,7 @@ export default {
|
|||||||
DeadRoleNotification,
|
DeadRoleNotification,
|
||||||
AnimatedCard,
|
AnimatedCard,
|
||||||
AnimatedEffect,
|
AnimatedEffect,
|
||||||
|
ExpansionPopup,
|
||||||
},
|
},
|
||||||
data: () => ({
|
data: () => ({
|
||||||
username: "",
|
username: "",
|
||||||
@ -470,8 +480,13 @@ export default {
|
|||||||
cardsToAnimate: [],
|
cardsToAnimate: [],
|
||||||
characters_to_distribute: 2,
|
characters_to_distribute: 2,
|
||||||
fullScreenEffects: [],
|
fullScreenEffects: [],
|
||||||
|
showPopup: false,
|
||||||
|
selectedExpansionInfo: {},
|
||||||
}),
|
}),
|
||||||
sockets: {
|
sockets: {
|
||||||
|
expansion_info(data) {
|
||||||
|
this.selectedExpansionInfo = JSON.parse(data);
|
||||||
|
},
|
||||||
room(data) {
|
room(data) {
|
||||||
this.lobbyName = data.name;
|
this.lobbyName = data.name;
|
||||||
if (!data.started) {
|
if (!data.started) {
|
||||||
@ -755,6 +770,14 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
showExpansionInfo(id) {
|
||||||
|
this.showPopup = true;
|
||||||
|
this.$socket.emit("get_expansion_info", id);
|
||||||
|
},
|
||||||
|
closePopup() {
|
||||||
|
this.showPopup = false;
|
||||||
|
this.selectedExpansionCards = [];
|
||||||
|
},
|
||||||
getExpansionCard(id) {
|
getExpansionCard(id) {
|
||||||
let ex = expansionsMap[id];
|
let ex = expansionsMap[id];
|
||||||
ex.classes = {
|
ex.classes = {
|
||||||
@ -1050,4 +1073,24 @@ export default {
|
|||||||
border-bottom: dashed #ccc2;
|
border-bottom: dashed #ccc2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.info-button {
|
||||||
|
position: absolute;
|
||||||
|
top: 5px;
|
||||||
|
right: 5px;
|
||||||
|
background-color: #007bff;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-button:hover {
|
||||||
|
background-color: #0056b3;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user