added ability tooltips

fixed role selection modal buttons
added role selection modal randomizer
This commit is contained in:
Steffen 2020-04-18 20:05:45 +02:00
parent dc417698fd
commit 30caa1a627
No known key found for this signature in database
GPG Key ID: 764D74E98267DFC6
6 changed files with 115 additions and 82 deletions

View File

@ -312,6 +312,24 @@ ul.editions .edition {
} }
// Buttons // Buttons
.button-group {
display: flex;
align-items: center;
justify-content: center;
align-content: center;
.button {
margin: 5px 0;
border-radius: 0;
&:first-child {
border-top-left-radius: 15px;
border-bottom-left-radius: 15px;
}
&:last-child {
border-top-right-radius: 15px;
border-bottom-right-radius: 15px;
}
}
}
.button { .button {
padding: 0; padding: 0;
border: solid 0.125em transparent; border: solid 0.125em transparent;
@ -336,8 +354,9 @@ ul.editions .edition {
&:hover { &:hover {
color: red; color: red;
} }
&:disabled { &.disabled {
color: gray; color: gray;
cursor: default;
} }
&:before, &:before,
&:after { &:after {

View File

@ -44,7 +44,6 @@ export default {
padding: 10px 20px; padding: 10px 20px;
border-radius: 10px; border-radius: 10px;
box-shadow: 2px 2px 20px 1px #000; box-shadow: 2px 2px 20px 1px #000;
overflow-x: auto;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
max-width: 60%; max-width: 60%;
@ -62,7 +61,6 @@ export default {
flex-wrap: wrap; flex-wrap: wrap;
align-content: center; align-content: center;
align-items: center; align-items: center;
overflow: hidden;
justify-content: center; justify-content: center;
font-size: 75%; font-size: 75%;
line-height: 100%; line-height: 100%;

View File

@ -11,9 +11,7 @@
<div class="shroud" @click="toggleStatus()"></div> <div class="shroud" @click="toggleStatus()"></div>
<div class="life" @click="toggleStatus()"></div> <div class="life" @click="toggleStatus()"></div>
<Token :role="player.role" @set-role="setRole" /> <Token :role="player.role" @set-role="setRole" />
<div class="ability" v-if="player.role.ability">
{{ player.role.ability }}
</div>
<div class="name" @click="changeName"> <div class="name" @click="changeName">
{{ player.name }} {{ player.name }}
<span class="remove" @click.stop="$emit('remove-player', player)"> <span class="remove" @click.stop="$emit('remove-player', player)">
@ -220,7 +218,7 @@ export default {
} }
/***** Player name *****/ /***** Player name *****/
.name { .player > .name {
font-size: 120%; font-size: 120%;
line-height: 120%; line-height: 120%;
filter: drop-shadow(0 0 1px rgba(0, 0, 0, 1)) filter: drop-shadow(0 0 1px rgba(0, 0, 0, 1))
@ -241,33 +239,7 @@ export default {
#townsquare.public .ability { #townsquare.public .ability {
display: none; display: none;
} }
.circle .ability { .circle .player:hover .ability {
position: absolute;
padding: 5px 10px;
top: 20px;
right: 100%;
width: 250px;
z-index: 25;
font-size: 80%;
background: rgba(0, 0, 0, 0.7);
border-radius: 10px;
border: 3px solid black;
text-align: left;
display: none;
&:after {
content: " ";
border: 10px solid transparent;
position: absolute;
left: 100%;
width: 0;
height: 0;
border-left-color: black;
top: 20px;
margin: 0 2px;
}
}
.player:hover .ability {
display: block; display: block;
} }

View File

@ -19,11 +19,19 @@
<Token :role="role" /> <Token :role="role" />
</li> </li>
</ul> </ul>
<div class="button" <div class="button-group">
@click="assignRoles()" <div
v-bind:disabled="selectedRoles > nontravelerPlayers || !selectedRoles" class="button"
> @click="assignRoles"
Assign {{ selectedRoles }} roles randomly v-bind:class="{
disabled: selectedRoles > nontravelerPlayers || !selectedRoles
}"
>
Assign {{ selectedRoles }} roles randomly
</div>
<div class="button" @click="selectRandomRoles">
Randomize roles
</div>
</div> </div>
</Modal> </Modal>
</template> </template>
@ -78,7 +86,7 @@ export default {
close() { close() {
this.$emit("close"); this.$emit("close");
}, },
showRoleSelectionModal() { selectRandomRoles() {
this.roleSelection = {}; this.roleSelection = {};
this.roles.forEach(role => { this.roles.forEach(role => {
if (!this.roleSelection[role.team]) { if (!this.roleSelection[role.team]) {
@ -102,26 +110,26 @@ export default {
}); });
}, },
assignRoles() { assignRoles() {
// generate list of selected roles and randomize it if (this.selectedRoles <= this.nontravelerPlayers && this.selectedRoles) {
const roles = Object.values(this.roleSelection) // generate list of selected roles and randomize it
.map(roles => roles.filter(role => role.selected)) const roles = Object.values(this.roleSelection)
.reduce((a, b) => [...a, ...b], []) .map(roles => roles.filter(role => role.selected))
.map(a => [Math.random(), a]) .reduce((a, b) => [...a, ...b], [])
.sort((a, b) => a[0] - b[0]) .map(a => [Math.random(), a])
.map(a => a[1]); .sort((a, b) => a[0] - b[0])
this.players.forEach(player => { .map(a => a[1]);
if (player.role.team !== "traveler" && roles.length) { this.players.forEach(player => {
player.role = roles.pop(); if (player.role.team !== "traveler" && roles.length) {
} player.role = roles.pop();
}); }
this.close(); });
this.close();
}
} }
}, },
watch: { mounted: function() {
isOpen(newIsOpen) { if (!Object.keys(this.roleSelection).length) {
if (newIsOpen) { this.selectRandomRoles();
this.showRoleSelectionModal();
}
} }
} }
}; };

View File

@ -7,7 +7,10 @@
v-bind:class="['leaf-top' + role.reminders.length]" v-bind:class="['leaf-top' + role.reminders.length]"
></span> ></span>
<span class="leaf-orange" v-if="role.setup"></span> <span class="leaf-orange" v-if="role.setup"></span>
<div>{{ role.name }}</div> <div class="name">{{ role.name }}</div>
<div class="ability" v-if="role.ability">
{{ role.ability }}
</div>
</div> </div>
</template> </template>
@ -39,11 +42,6 @@ export default {
background: url("../assets/token.png") center center; background: url("../assets/token.png") center center;
background-size: 100%; background-size: 100%;
text-align: center; text-align: center;
color: black;
font-weight: 600;
text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff,
1px 1px 0 #fff, 0 0 5px rgba(0, 0, 0, 0.75);
font-family: "Papyrus", serif;
border: 3px solid black; border: 3px solid black;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
cursor: pointer; cursor: pointer;
@ -58,13 +56,6 @@ export default {
top: 0; top: 0;
} }
div {
position: absolute;
top: 73%;
width: 100%;
line-height: 100%;
}
span { span {
position: absolute; position: absolute;
width: 100%; width: 100%;
@ -106,5 +97,47 @@ export default {
background-image: url("../assets/leaf-top5.png"); background-image: url("../assets/leaf-top5.png");
} }
} }
.name {
color: black;
font-weight: 600;
text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff,
1px 1px 0 #fff, 0 0 5px rgba(0, 0, 0, 0.75);
font-family: "Papyrus", serif;
position: absolute;
top: 73%;
width: 100%;
line-height: 100%;
}
.ability {
position: absolute;
padding: 5px 10px;
top: 20px;
left: 110%;
width: 250px;
z-index: 25;
font-size: 80%;
background: rgba(0, 0, 0, 0.7);
border-radius: 10px;
border: 3px solid black;
text-align: left;
display: none;
&:after {
content: " ";
border: 10px solid transparent;
position: absolute;
right: 100%;
width: 0;
height: 0;
border-right-color: black;
top: 10px;
margin: 0 2px;
}
}
&:hover .ability {
display: block;
}
} }
</style> </style>

View File

@ -138,7 +138,9 @@ export default {
&:before { &:before {
background-image: url("../assets/icons/#{$img}.png"); background-image: url("../assets/icons/#{$img}.png");
} }
font-size: $fontsize; .name {
font-size: $fontsize;
}
} }
.reminder.#{$img}:before { .reminder.#{$img}:before {
@ -181,18 +183,18 @@ export default {
transform: rotate($rot * 1deg); transform: rotate($rot * 1deg);
@if $i - 1 <= $item-count / 2 { @if $i - 1 <= $item-count / 2 {
z-index: $item-count - $i + 1; z-index: $item-count - $i + 1;
.ability {
left: 100%;
right: auto;
&:after {
border-left-color: transparent;
border-right-color: black;
left: auto;
right: 100%;
}
}
} @else { } @else {
z-index: $i - 1; z-index: $i - 1;
.ability {
right: 110%;
left: auto;
&:after {
border-right-color: transparent;
border-left-color: black;
right: auto;
left: 100%;
}
}
} }
> * { > * {
transform: rotate($rot * -1deg); transform: rotate($rot * -1deg);
@ -245,6 +247,7 @@ ul.tokens li {
} }
&:hover { &:hover {
transform: scale(1.2); transform: scale(1.2);
z-index: 10;
} }
} }