mirror of https://github.com/bra1n/townsquare.git
requested changes
This commit is contained in:
parent
e762e89485
commit
b9b9e59b53
|
@ -110,7 +110,7 @@ export default {
|
||||||
this.$store.commit("toggleModal", "roles");
|
this.$store.commit("toggleModal", "roles");
|
||||||
break;
|
break;
|
||||||
case "v":
|
case "v":
|
||||||
if (this.session.voteHistory.length) {
|
if (this.session.voteHistory.length || !this.session.isSpectator) {
|
||||||
this.$store.commit("toggleModal", "voteHistory");
|
this.$store.commit("toggleModal", "voteHistory");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -132,26 +132,11 @@
|
||||||
<em><font-awesome-icon icon="theater-masks"/></em>
|
<em><font-awesome-icon icon="theater-masks"/></em>
|
||||||
</li>
|
</li>
|
||||||
<li
|
<li
|
||||||
v-if="session.voteHistory.length"
|
v-if="session.voteHistory.length || !session.isSpectator"
|
||||||
@click="toggleModal('voteHistory')"
|
@click="toggleModal('voteHistory')"
|
||||||
>
|
>
|
||||||
Vote history<em>[V]</em>
|
Vote history<em>[V]</em>
|
||||||
</li>
|
</li>
|
||||||
<li @click="toggleRecordVoteHistory" v-if="!session.isSpectator">
|
|
||||||
Permit vote history
|
|
||||||
<em>
|
|
||||||
<font-awesome-icon
|
|
||||||
:icon="[
|
|
||||||
'fas',
|
|
||||||
session.recordVoteHistory ? 'check-square' : 'square'
|
|
||||||
]"
|
|
||||||
/>
|
|
||||||
</em>
|
|
||||||
</li>
|
|
||||||
<li @click="clearVoteHistory" v-if="!session.isSpectator">
|
|
||||||
Clear vote history
|
|
||||||
<em><font-awesome-icon icon="trash-alt"/></em>
|
|
||||||
</li>
|
|
||||||
<li @click="leaveSession">
|
<li @click="leaveSession">
|
||||||
Leave Session
|
Leave Session
|
||||||
<em>{{ session.sessionId }}</em>
|
<em>{{ session.sessionId }}</em>
|
||||||
|
@ -343,12 +328,6 @@ export default {
|
||||||
this.$store.dispatch("players/clearRoles");
|
this.$store.dispatch("players/clearRoles");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
clearVoteHistory() {
|
|
||||||
this.$store.commit("session/clearVoteHistory");
|
|
||||||
},
|
|
||||||
toggleRecordVoteHistory() {
|
|
||||||
this.$store.commit("session/toggleRecordVoteHistory");
|
|
||||||
},
|
|
||||||
...mapMutations([
|
...mapMutations([
|
||||||
"toggleGrimoire",
|
"toggleGrimoire",
|
||||||
"toggleMenu",
|
"toggleMenu",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<Modal
|
<Modal
|
||||||
class="vote-history"
|
class="vote-history"
|
||||||
v-if="modals.voteHistory && session.voteHistory"
|
v-if="modals.voteHistory && (session.voteHistory || !session.isSpectator)"
|
||||||
@close="toggleModal('voteHistory')"
|
@close="toggleModal('voteHistory')"
|
||||||
>
|
>
|
||||||
<font-awesome-icon
|
<font-awesome-icon
|
||||||
|
@ -9,9 +9,35 @@
|
||||||
icon="trash-alt"
|
icon="trash-alt"
|
||||||
class="clear"
|
class="clear"
|
||||||
title="Clear history"
|
title="Clear history"
|
||||||
|
v-if="session.isSpectator"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<h3>Nomination history</h3>
|
<h3>Nomination history</h3>
|
||||||
|
|
||||||
|
<template v-if="!session.isSpectator">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td class="option">
|
||||||
|
<div class="option" @click="setRecordVoteHistory">
|
||||||
|
<font-awesome-icon
|
||||||
|
:icon="[
|
||||||
|
'fas',
|
||||||
|
session.isVoteHistoryAllowed ? 'check-square' : 'square'
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
Allow players to view this?
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
<td>
|
||||||
|
<div class="option" @click="clearVoteHistory">
|
||||||
|
<font-awesome-icon icon="trash-alt" />
|
||||||
|
Clear players vote histories
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</template>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -79,6 +105,15 @@ export default {
|
||||||
...mapState(["session", "modals"])
|
...mapState(["session", "modals"])
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
clearVoteHistory() {
|
||||||
|
this.$store.commit("session/clearVoteHistory");
|
||||||
|
},
|
||||||
|
setRecordVoteHistory() {
|
||||||
|
this.$store.commit(
|
||||||
|
"session/setVoteHistoryAllowed",
|
||||||
|
!this.session.isVoteHistoryAllowed
|
||||||
|
);
|
||||||
|
},
|
||||||
...mapMutations(["toggleModal"]),
|
...mapMutations(["toggleModal"]),
|
||||||
...mapMutations("session", ["clearVoteHistory"])
|
...mapMutations("session", ["clearVoteHistory"])
|
||||||
}
|
}
|
||||||
|
@ -98,6 +133,14 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.option {
|
||||||
|
color: white;
|
||||||
|
text-decoration: none;
|
||||||
|
&:hover {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
h3 {
|
h3 {
|
||||||
margin: 0 40px 0 10px;
|
margin: 0 40px 0 10px;
|
||||||
svg {
|
svg {
|
||||||
|
|
|
@ -22,10 +22,10 @@ const state = () => ({
|
||||||
nomination: false,
|
nomination: false,
|
||||||
votes: [],
|
votes: [],
|
||||||
lockedVote: 0,
|
lockedVote: 0,
|
||||||
votingSpeed: 1000,
|
votingSpeed: 3000,
|
||||||
isVoteInProgress: false,
|
isVoteInProgress: false,
|
||||||
voteHistory: [],
|
voteHistory: [],
|
||||||
recordVoteHistory: true,
|
isVoteHistoryAllowed: true,
|
||||||
isRolesDistributed: false
|
isRolesDistributed: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -38,14 +38,6 @@ const set = key => (state, val) => {
|
||||||
state[key] = val;
|
state[key] = val;
|
||||||
};
|
};
|
||||||
|
|
||||||
const toggle = key => (state, val) => {
|
|
||||||
if (val === true || val === false) {
|
|
||||||
state[key] = val;
|
|
||||||
} else {
|
|
||||||
state[key] = !state[key];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const mutations = {
|
const mutations = {
|
||||||
setPlayerId: set("playerId"),
|
setPlayerId: set("playerId"),
|
||||||
setSpectator: set("isSpectator"),
|
setSpectator: set("isSpectator"),
|
||||||
|
@ -54,7 +46,7 @@ const mutations = {
|
||||||
setPing: set("ping"),
|
setPing: set("ping"),
|
||||||
setVotingSpeed: set("votingSpeed"),
|
setVotingSpeed: set("votingSpeed"),
|
||||||
setVoteInProgress: set("isVoteInProgress"),
|
setVoteInProgress: set("isVoteInProgress"),
|
||||||
toggleRecordVoteHistory: toggle("recordVoteHistory"),
|
setVoteHistoryAllowed: set("isVoteHistoryAllowed"),
|
||||||
claimSeat: set("claimedSeat"),
|
claimSeat: set("claimedSeat"),
|
||||||
distributeRoles: set("isRolesDistributed"),
|
distributeRoles: set("isRolesDistributed"),
|
||||||
setSessionId(state, sessionId) {
|
setSessionId(state, sessionId) {
|
||||||
|
@ -80,7 +72,7 @@ const mutations = {
|
||||||
* @param players
|
* @param players
|
||||||
*/
|
*/
|
||||||
addHistory(state, players) {
|
addHistory(state, players) {
|
||||||
if (!state.recordVoteHistory && state.isSpectator) return;
|
if (!state.isVoteHistoryAllowed && state.isSpectator) return;
|
||||||
if (!state.nomination || state.lockedVote <= players.length) return;
|
if (!state.nomination || state.lockedVote <= players.length) return;
|
||||||
const isBanishment = players[state.nomination[1]].role.team === "traveler";
|
const isBanishment = players[state.nomination[1]].role.team === "traveler";
|
||||||
state.voteHistory.push({
|
state.voteHistory.push({
|
||||||
|
|
|
@ -172,9 +172,9 @@ class LiveSession {
|
||||||
if (!this._isSpectator) return;
|
if (!this._isSpectator) return;
|
||||||
this._store.commit("toggleNight", params);
|
this._store.commit("toggleNight", params);
|
||||||
break;
|
break;
|
||||||
case "recordVoteHistory":
|
case "isVoteHistoryAllowed":
|
||||||
if (!this._isSpectator) return;
|
if (!this._isSpectator) return;
|
||||||
this._store.commit("session/toggleRecordVoteHistory", params);
|
this._store.commit("session/setVoteHistoryAllowed", params);
|
||||||
break;
|
break;
|
||||||
case "votingSpeed":
|
case "votingSpeed":
|
||||||
if (!this._isSpectator) return;
|
if (!this._isSpectator) return;
|
||||||
|
@ -272,7 +272,7 @@ class LiveSession {
|
||||||
this._sendDirect(playerId, "gs", {
|
this._sendDirect(playerId, "gs", {
|
||||||
gamestate: this._gamestate,
|
gamestate: this._gamestate,
|
||||||
isNight: grimoire.isNight,
|
isNight: grimoire.isNight,
|
||||||
recordVoteHistory: session.recordVoteHistory,
|
isVoteHistoryAllowed: session.isVoteHistoryAllowed,
|
||||||
nomination: session.nomination,
|
nomination: session.nomination,
|
||||||
votingSpeed: session.votingSpeed,
|
votingSpeed: session.votingSpeed,
|
||||||
lockedVote: session.lockedVote,
|
lockedVote: session.lockedVote,
|
||||||
|
@ -294,7 +294,7 @@ class LiveSession {
|
||||||
gamestate,
|
gamestate,
|
||||||
isLightweight,
|
isLightweight,
|
||||||
isNight,
|
isNight,
|
||||||
recordVoteHistory,
|
isVoteHistoryAllowed,
|
||||||
nomination,
|
nomination,
|
||||||
votingSpeed,
|
votingSpeed,
|
||||||
votes,
|
votes,
|
||||||
|
@ -346,7 +346,10 @@ class LiveSession {
|
||||||
});
|
});
|
||||||
if (!isLightweight) {
|
if (!isLightweight) {
|
||||||
this._store.commit("toggleNight", !!isNight);
|
this._store.commit("toggleNight", !!isNight);
|
||||||
this._store.commit("session/toggleRecordVoteHistory", recordVoteHistory);
|
this._store.commit(
|
||||||
|
"session/toggleRecordVoteHistory",
|
||||||
|
isVoteHistoryAllowed
|
||||||
|
);
|
||||||
this._store.commit("session/nomination", {
|
this._store.commit("session/nomination", {
|
||||||
nomination,
|
nomination,
|
||||||
votes,
|
votes,
|
||||||
|
@ -694,13 +697,13 @@ class LiveSession {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send the recordVoteHistory state. ST only
|
* Send the isVoteHistoryAllowed state. ST only
|
||||||
*/
|
*/
|
||||||
setRecordVoteHistory() {
|
setVoteHistoryAllowed() {
|
||||||
if (this._isSpectator) return;
|
if (this._isSpectator) return;
|
||||||
this._send(
|
this._send(
|
||||||
"recordVoteHistory",
|
"isVoteHistoryAllowed",
|
||||||
this._store.state.session.recordVoteHistory
|
this._store.state.session.isVoteHistoryAllowed
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -858,8 +861,8 @@ export default store => {
|
||||||
case "session/clearVoteHistory":
|
case "session/clearVoteHistory":
|
||||||
session.clearVoteHistory();
|
session.clearVoteHistory();
|
||||||
break;
|
break;
|
||||||
case "session/toggleRecordVoteHistory":
|
case "session/setVoteHistoryAllowed":
|
||||||
session.setRecordVoteHistory();
|
session.setVoteHistoryAllowed();
|
||||||
break;
|
break;
|
||||||
case "toggleNight":
|
case "toggleNight":
|
||||||
session.setIsNight();
|
session.setIsNight();
|
||||||
|
|
Loading…
Reference in New Issue