From 30caa1a627a0eb1e0debe599f642eb6ab53c37bf Mon Sep 17 00:00:00 2001 From: Steffen Date: Sat, 18 Apr 2020 20:05:45 +0200 Subject: [PATCH] added ability tooltips fixed role selection modal buttons added role selection modal randomizer --- src/App.vue | 21 +++++++++- src/components/Modal.vue | 2 - src/components/Player.vue | 34 ++------------- src/components/RoleSelectionModal.vue | 56 ++++++++++++++----------- src/components/Token.vue | 59 +++++++++++++++++++++------ src/components/TownSquare.vue | 25 +++++++----- 6 files changed, 115 insertions(+), 82 deletions(-) diff --git a/src/App.vue b/src/App.vue index 3ef08a5..47bdd77 100644 --- a/src/App.vue +++ b/src/App.vue @@ -312,6 +312,24 @@ ul.editions .edition { } // 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 { padding: 0; border: solid 0.125em transparent; @@ -336,8 +354,9 @@ ul.editions .edition { &:hover { color: red; } - &:disabled { + &.disabled { color: gray; + cursor: default; } &:before, &:after { diff --git a/src/components/Modal.vue b/src/components/Modal.vue index 1989a7f..d0cc7e8 100644 --- a/src/components/Modal.vue +++ b/src/components/Modal.vue @@ -44,7 +44,6 @@ export default { padding: 10px 20px; border-radius: 10px; box-shadow: 2px 2px 20px 1px #000; - overflow-x: auto; display: flex; flex-direction: column; max-width: 60%; @@ -62,7 +61,6 @@ export default { flex-wrap: wrap; align-content: center; align-items: center; - overflow: hidden; justify-content: center; font-size: 75%; line-height: 100%; diff --git a/src/components/Player.vue b/src/components/Player.vue index 336639c..0ef56d2 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -11,9 +11,7 @@
-
- {{ player.role.ability }} -
+
{{ player.name }} @@ -220,7 +218,7 @@ export default { } /***** Player name *****/ -.name { +.player > .name { font-size: 120%; line-height: 120%; filter: drop-shadow(0 0 1px rgba(0, 0, 0, 1)) @@ -241,33 +239,7 @@ export default { #townsquare.public .ability { display: none; } -.circle .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 { +.circle .player:hover .ability { display: block; } diff --git a/src/components/RoleSelectionModal.vue b/src/components/RoleSelectionModal.vue index 97e236c..b5ef46a 100644 --- a/src/components/RoleSelectionModal.vue +++ b/src/components/RoleSelectionModal.vue @@ -19,11 +19,19 @@ -
- Assign {{ selectedRoles }} roles randomly +
+
+ Assign {{ selectedRoles }} roles randomly +
+
+ Randomize roles +
@@ -78,7 +86,7 @@ export default { close() { this.$emit("close"); }, - showRoleSelectionModal() { + selectRandomRoles() { this.roleSelection = {}; this.roles.forEach(role => { if (!this.roleSelection[role.team]) { @@ -102,26 +110,26 @@ export default { }); }, assignRoles() { - // generate list of selected roles and randomize it - const roles = Object.values(this.roleSelection) - .map(roles => roles.filter(role => role.selected)) - .reduce((a, b) => [...a, ...b], []) - .map(a => [Math.random(), a]) - .sort((a, b) => a[0] - b[0]) - .map(a => a[1]); - this.players.forEach(player => { - if (player.role.team !== "traveler" && roles.length) { - player.role = roles.pop(); - } - }); - this.close(); + if (this.selectedRoles <= this.nontravelerPlayers && this.selectedRoles) { + // generate list of selected roles and randomize it + const roles = Object.values(this.roleSelection) + .map(roles => roles.filter(role => role.selected)) + .reduce((a, b) => [...a, ...b], []) + .map(a => [Math.random(), a]) + .sort((a, b) => a[0] - b[0]) + .map(a => a[1]); + this.players.forEach(player => { + if (player.role.team !== "traveler" && roles.length) { + player.role = roles.pop(); + } + }); + this.close(); + } } }, - watch: { - isOpen(newIsOpen) { - if (newIsOpen) { - this.showRoleSelectionModal(); - } + mounted: function() { + if (!Object.keys(this.roleSelection).length) { + this.selectRandomRoles(); } } }; diff --git a/src/components/Token.vue b/src/components/Token.vue index 8a0a9aa..812960b 100644 --- a/src/components/Token.vue +++ b/src/components/Token.vue @@ -7,7 +7,10 @@ v-bind:class="['leaf-top' + role.reminders.length]" > -
{{ role.name }}
+
{{ role.name }}
+
+ {{ role.ability }} +
@@ -39,11 +42,6 @@ export default { background: url("../assets/token.png") center center; background-size: 100%; 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; box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); cursor: pointer; @@ -58,13 +56,6 @@ export default { top: 0; } - div { - position: absolute; - top: 73%; - width: 100%; - line-height: 100%; - } - span { position: absolute; width: 100%; @@ -106,5 +97,47 @@ export default { 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; + } } diff --git a/src/components/TownSquare.vue b/src/components/TownSquare.vue index 720aa3b..2b3b503 100644 --- a/src/components/TownSquare.vue +++ b/src/components/TownSquare.vue @@ -138,7 +138,9 @@ export default { &:before { background-image: url("../assets/icons/#{$img}.png"); } - font-size: $fontsize; + .name { + font-size: $fontsize; + } } .reminder.#{$img}:before { @@ -181,18 +183,18 @@ export default { transform: rotate($rot * 1deg); @if $i - 1 <= $item-count / 2 { 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 { 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); @@ -245,6 +247,7 @@ ul.tokens li { } &:hover { transform: scale(1.2); + z-index: 10; } }