added night order

This commit is contained in:
Steffen 2020-04-22 23:07:25 +02:00
parent b6b33c10e9
commit 2df32af266
No known key found for this signature in database
GPG Key ID: 764D74E98267DFC6
6 changed files with 668 additions and 250 deletions

View File

@ -52,7 +52,7 @@
@click="takeScreenshot()" @click="takeScreenshot()"
v-bind:class="{ success: isScreenshotSuccess }" v-bind:class="{ success: isScreenshotSuccess }"
/> />
<font-awesome-icon icon="cogs" @click="isControlOpen = !isControlOpen" /> <font-awesome-icon icon="cog" @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> <li>
@ -223,6 +223,22 @@ export default {
watch: { watch: {
players: { players: {
handler(newPlayers) { handler(newPlayers) {
const firstNight = [0];
const otherNight = [0];
newPlayers.forEach(({ role }) => {
if (role.firstNight && !firstNight.includes(role.firstNight)) {
firstNight.push(role.firstNight);
}
if (role.otherNight && !otherNight.includes(role.otherNight)) {
otherNight.push(role.otherNight);
}
});
firstNight.sort();
otherNight.sort();
newPlayers.forEach(player => {
player.firstNight = Math.max(firstNight.indexOf(player.role.firstNight), 0);
player.otherNight = Math.max(otherNight.indexOf(player.role.otherNight), 0);
});
localStorage.players = JSON.stringify( localStorage.players = JSON.stringify(
newPlayers.map(player => ({ newPlayers.map(player => ({
...player, ...player,

View File

@ -11,6 +11,16 @@
> >
<div class="shroud" @click="toggleStatus()"></div> <div class="shroud" @click="toggleStatus()"></div>
<div class="life" @click="toggleStatus()"></div> <div class="life" @click="toggleStatus()"></div>
<div class="night first" v-if="player.firstNight">
<em>{{ player.firstNight }}.</em>
<span>{{ player.role.firstNightReminder }}</span>
</div>
<div class="night other" v-if="player.otherNight">
<em>{{ player.otherNight }}.</em>
<span>{{ player.role.otherNightReminder }}</span>
</div>
<Token :role="player.role" @set-role="setRole" /> <Token :role="player.role" @set-role="setRole" />
<div class="name" @click="changeName"> <div class="name" @click="changeName">
@ -283,6 +293,68 @@ export default {
opacity: 1; opacity: 1;
} }
/**** Night reminders ****/
.player .night {
position: absolute;
top: 40%;
width: 100%;
z-index: 2;
cursor: pointer;
opacity: 1;
transition: opacity 200ms;
#townsquare.public & {
opacity: 0;
pointer-events: none;
}
&:hover ~ .token .ability {
opacity: 0;
}
&.first em {
left: -15px;
background: linear-gradient(
180deg,
rgba(0, 0, 0, 1) 0%,
rgba(147, 0, 0, 1) 100%
);
}
&.other em {
right: -15px;
background: linear-gradient(
180deg,
rgba(0, 0, 0, 1) 0%,
rgba(7, 0, 147, 1) 100%
);
}
em {
font-style: normal;
position: absolute;
width: 40px;
height: 40px;
text-align: center;
line-height: 37px;
top: -20px;
border-radius: 50%;
border: 3px solid black;
filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.5));
font-weight: bold;
opacity: 1;
transition: opacity 200ms;
}
#app.screenshot & {
display: none;
}
}
.player.dead .night em {
opacity: 0;
}
/***** Reminder token *****/ /***** Reminder token *****/
.circle .reminder { .circle .reminder {
background: url("../assets/reminder.png") center center; background: url("../assets/reminder.png") center center;

View File

@ -45,6 +45,8 @@ export default {
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;
display: flex;
align-items: center;
&:before { &:before {
content: " "; content: " ";
@ -102,8 +104,7 @@ export default {
display: flex; display: flex;
position: absolute; position: absolute;
padding: 5px 10px; padding: 5px 10px;
top: 20px; left: 120%;
left: 110%;
width: 250px; width: 250px;
z-index: 25; z-index: 25;
font-size: 80%; font-size: 80%;

View File

@ -213,8 +213,9 @@ export default {
z-index: $item-count - $i + 1; z-index: $item-count - $i + 1;
} @else { } @else {
z-index: $i - 1; z-index: $i - 1;
.ability { .ability,
right: 110%; .night span {
right: 120%;
left: auto; left: auto;
&:before { &:before {
border-right-color: transparent; border-right-color: transparent;
@ -229,7 +230,8 @@ export default {
} }
.life, .life,
.token, .token,
.shroud { .shroud,
.night {
transition-delay: ($i - 1) * 50ms; transition-delay: ($i - 1) * 50ms;
} }

View File

@ -8,7 +8,7 @@ import {
faUserFriends, faUserFriends,
faUser, faUser,
faTimesCircle, faTimesCircle,
faCogs, faCog,
faSearchMinus, faSearchMinus,
faSearchPlus, faSearchPlus,
faCamera faCamera
@ -22,7 +22,7 @@ library.add(
faUserFriends, faUserFriends,
faUser, faUser,
faTimesCircle, faTimesCircle,
faCogs, faCog,
faSearchMinus, faSearchMinus,
faSearchPlus, faSearchPlus,
faCamera faCamera

File diff suppressed because it is too large Load Diff