mirror of https://github.com/bra1n/townsquare.git
fixed travelers, added zoom
This commit is contained in:
parent
b7d8023137
commit
7bdba2b5d3
10
src/App.vue
10
src/App.vue
|
@ -5,6 +5,7 @@
|
||||||
:is-public="isPublic"
|
:is-public="isPublic"
|
||||||
:players="players"
|
:players="players"
|
||||||
:roles="roles"
|
:roles="roles"
|
||||||
|
:zoom="zoom"
|
||||||
></TownSquare>
|
></TownSquare>
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
|
@ -37,6 +38,12 @@
|
||||||
<font-awesome-icon icon="cogs" @click="isControlOpen = !isControlOpen" />
|
<font-awesome-icon icon="cogs" @click="isControlOpen = !isControlOpen" />
|
||||||
<ul v-if="isControlOpen">
|
<ul v-if="isControlOpen">
|
||||||
<li @click="togglePublic">Toggle <em>G</em>rimoire</li>
|
<li @click="togglePublic">Toggle <em>G</em>rimoire</li>
|
||||||
|
<li>
|
||||||
|
Size
|
||||||
|
<font-awesome-icon @click="zoom -= 0.1" icon="search-minus" />
|
||||||
|
{{ Math.round(zoom * 100) }}%
|
||||||
|
<font-awesome-icon @click="zoom += 0.1" icon="search-plus" />
|
||||||
|
</li>
|
||||||
<li @click="addPlayer" v-if="players.length < 20">
|
<li @click="addPlayer" v-if="players.length < 20">
|
||||||
<em>A</em>dd Player
|
<em>A</em>dd Player
|
||||||
</li>
|
</li>
|
||||||
|
@ -84,7 +91,8 @@ export default {
|
||||||
isRoleModalOpen: false,
|
isRoleModalOpen: false,
|
||||||
players: [],
|
players: [],
|
||||||
roles: this.getRolesByEdition(),
|
roles: this.getRolesByEdition(),
|
||||||
edition: "tb"
|
edition: "tb",
|
||||||
|
zoom: 1
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -169,10 +169,6 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
&.dead {
|
&.dead {
|
||||||
&.traveler {
|
|
||||||
filter: grayscale(100%);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.no-vote .life:after {
|
&.no-vote .life:after {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
@ -193,6 +189,10 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.traveler .life {
|
||||||
|
filter: grayscale(100%);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#townsquare.public .player {
|
#townsquare.public .player {
|
||||||
|
|
|
@ -61,8 +61,10 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
nontravelerPlayers: function() {
|
nontravelerPlayers: function() {
|
||||||
return this.players.filter(({ role }) => role && role.team !== "traveler")
|
return Math.min(
|
||||||
.length;
|
this.players.filter(({ role }) => role && role.team !== "traveler").length,
|
||||||
|
15
|
||||||
|
);
|
||||||
},
|
},
|
||||||
selectedRoles: function() {
|
selectedRoles: function() {
|
||||||
return Object.values(this.roleSelection)
|
return Object.values(this.roleSelection)
|
||||||
|
|
|
@ -52,9 +52,10 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
teams: function() {
|
teams: function() {
|
||||||
const nontravelers = this.players.filter(
|
const nontravelers = Math.min(
|
||||||
player => player.role.team !== "traveler"
|
this.players.filter(player => player.role.team !== "traveler").length,
|
||||||
).length;
|
15
|
||||||
|
);
|
||||||
const alive = this.players.filter(player => player.hasDied !== true)
|
const alive = this.players.filter(player => player.hasDied !== true)
|
||||||
.length;
|
.length;
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div id="townsquare" class="square" v-bind:class="{ public: isPublic }">
|
<div id="townsquare" class="square" v-bind:class="{ public: isPublic }" v-bind:style="{ zoom: zoom }">
|
||||||
<ul class="circle" v-bind:class="['size-' + players.length]">
|
<ul class="circle" v-bind:class="['size-' + players.length]">
|
||||||
<Player
|
<Player
|
||||||
v-for="(player, index) in players"
|
v-for="(player, index) in players"
|
||||||
|
@ -64,6 +64,10 @@ export default {
|
||||||
roles: {
|
roles: {
|
||||||
type: Map,
|
type: Map,
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
zoom: {
|
||||||
|
type: Number,
|
||||||
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
|
@ -8,7 +8,9 @@ import {
|
||||||
faUserFriends,
|
faUserFriends,
|
||||||
faUser,
|
faUser,
|
||||||
faTimesCircle,
|
faTimesCircle,
|
||||||
faCogs
|
faCogs,
|
||||||
|
faSearchMinus,
|
||||||
|
faSearchPlus
|
||||||
} from "@fortawesome/free-solid-svg-icons";
|
} from "@fortawesome/free-solid-svg-icons";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
||||||
|
|
||||||
|
@ -19,7 +21,9 @@ library.add(
|
||||||
faUserFriends,
|
faUserFriends,
|
||||||
faUser,
|
faUser,
|
||||||
faTimesCircle,
|
faTimesCircle,
|
||||||
faCogs
|
faCogs,
|
||||||
|
faSearchMinus,
|
||||||
|
faSearchPlus
|
||||||
);
|
);
|
||||||
|
|
||||||
Vue.component("font-awesome-icon", FontAwesomeIcon);
|
Vue.component("font-awesome-icon", FontAwesomeIcon);
|
||||||
|
|
Loading…
Reference in New Issue