Add pack count and make player list prettier
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
Hamcha 2019-09-15 12:59:51 +02:00
parent ae9c46c969
commit 33cf37cbf0
Signed by: hamcha
GPG key ID: 41467804B19A3315
2 changed files with 58 additions and 10 deletions

View file

@ -78,7 +78,7 @@
font-weight: bold; font-weight: bold;
font-size: 13pt; font-size: 13pt;
&:after { &:after {
content: " ×"; content: "×";
font-weight: 300; font-weight: 300;
} }
} }

View file

@ -6,8 +6,8 @@
</header> </header>
<section class="players"> <section class="players">
<article <article
v-for="player in playerStatus" v-for="(player, i) in playerStatus"
:key="player.name" :key="player.name + i"
:class="playerClass(player)" :class="playerClass(player)"
> >
<div class="icon"> <div class="icon">
@ -20,7 +20,12 @@
</section> </section>
<section class="pool"> <section class="pool">
<header> <header>
<h2>Available picks</h2> <h2>
Available picks (Pack
<span class="pack-number">{{ packNumber }}</span> of
<span class="pack-count">{{ packCount }}</span
>)
</h2>
</header> </header>
<CardPicker <CardPicker
@picked="cardPicked" @picked="cardPicked"
@ -34,6 +39,7 @@
<header> <header>
<h2>Cards</h2> <h2>Cards</h2>
</header> </header>
<DeckList :cards="pickedCards" />
</section> </section>
</section> </section>
</template> </template>
@ -41,6 +47,11 @@
<style lang="scss" scoped> <style lang="scss" scoped>
@import "@/assets/scss/_variables.scss"; @import "@/assets/scss/_variables.scss";
$player-not-picked: $red;
$player-picked: $green;
$player-me: $purple;
$border-opacity: 0.6;
.draftview { .draftview {
background: url("../assets/images/backgrounds/draftbg.webp") center; background: url("../assets/images/backgrounds/draftbg.webp") center;
display: grid; display: grid;
@ -67,18 +78,27 @@
max-height: 100%; max-height: 100%;
} }
.player { .player {
border-radius: 3px;
margin: 2px;
padding: 2px;
border: 2px solid rgba($player-not-picked, $border-opacity);
display: flex; display: flex;
color: $red; color: $red;
align-items: center; align-items: center;
user-select: all;
&.picked, &.picked,
&.bot { &.bot {
color: $green; color: $player-picked;
border-color: rgba($player-picked, $border-opacity);
}
&.me {
border-color: rgba($player-me, $border-opacity);
} }
&.me::after { &.me::after {
content: " (me)"; content: " (me)";
font-size: 10pt; font-size: 10pt;
margin-left: 5px; margin-left: 5px;
color: $purple; color: $player-me;
} }
} }
} }
@ -91,6 +111,10 @@
} }
} }
.pack-number {
color: $primary;
}
@media (max-width: 800px) { @media (max-width: 800px) {
.draftview { .draftview {
grid-template-columns: 2fr 250px; grid-template-columns: 2fr 250px;
@ -125,8 +149,9 @@
<script lang="ts"> <script lang="ts">
import { Component, Vue } from "vue-property-decorator"; import { Component, Vue } from "vue-property-decorator";
import { getCards, CardSlot } from "@/mlpccg"; import { getCards, CardSlot, cardLimit, Card } from "@/mlpccg";
import CardPicker from "@/components/DeckBuilder/CardPicker.vue"; import CardPicker from "@/components/DeckBuilder/CardPicker.vue";
import DeckList from "@/components/DeckBuilder/DeckList.vue";
interface PlayerStatus { interface PlayerStatus {
name: string; name: string;
@ -137,7 +162,8 @@ interface PlayerStatus {
@Component({ @Component({
components: { components: {
CardPicker CardPicker,
DeckList
} }
}) })
export default class DraftView extends Vue { export default class DraftView extends Vue {
@ -146,13 +172,19 @@ export default class DraftView extends Vue {
private columns!: number; private columns!: number;
// Draft data // Draft data
private packNumber!: number;
private packCount!: number;
private currentPicks!: CardSlot[]; private currentPicks!: CardSlot[];
private pickedCards!: CardSlot[];
private data() { private data() {
return { return {
packNumber: 1,
packCount: 4,
rows: 3, rows: 3,
columns: 4, columns: 4,
currentPicks: [] currentPicks: [],
pickedCards: []
}; };
} }
@ -169,7 +201,23 @@ export default class DraftView extends Vue {
})); }));
} }
private cardPicked() {} private cardPicked(card: Card) {
// Check if card is already in
const idx = this.pickedCards.findIndex(c => c.data.ID == card.ID);
if (idx >= 0) {
const deckitem = this.pickedCards[idx];
deckitem.howmany += 1;
Vue.set(this.pickedCards, idx, deckitem);
} else {
this.pickedCards.push({
data: card,
limit: cardLimit(card.Type),
howmany: 1
});
}
const origIdx = this.currentPicks.findIndex(c => c.data.ID == card.ID);
this.currentPicks.splice(origIdx, 1);
}
private get playerStatus(): PlayerStatus[] { private get playerStatus(): PlayerStatus[] {
return [ return [