mirror of
https://github.com/bra1n/townsquare.git
synced 2025-04-04 22:24:36 +00:00
add ST character reveal for player tokens
This commit is contained in:
parent
3ae36e2f0f
commit
0c3cf1bf95
6 changed files with 44 additions and 2 deletions
|
@ -1,5 +1,7 @@
|
||||||
# Release Notes
|
# Release Notes
|
||||||
|
|
||||||
|
- add ST character reveal, per player
|
||||||
|
|
||||||
### Version 2.12.0
|
### Version 2.12.0
|
||||||
- tweak reference sheet to better fit screen in single column layout
|
- tweak reference sheet to better fit screen in single column layout
|
||||||
- add warning icon overlay for setup roles on character assignment modal
|
- add warning icon overlay for setup roles on character assignment modal
|
||||||
|
|
|
@ -128,6 +128,10 @@
|
||||||
<font-awesome-icon icon="hand-point-right" />
|
<font-awesome-icon icon="hand-point-right" />
|
||||||
Nomination
|
Nomination
|
||||||
</li>
|
</li>
|
||||||
|
<li @click="revealPlayer(player)">
|
||||||
|
<font-awesome-icon icon="satellite-dish" />
|
||||||
|
Reveal role to all
|
||||||
|
</li>
|
||||||
<li @click="movePlayer()">
|
<li @click="movePlayer()">
|
||||||
<font-awesome-icon icon="redo-alt" />
|
<font-awesome-icon icon="redo-alt" />
|
||||||
Move player
|
Move player
|
||||||
|
@ -296,6 +300,9 @@ export default {
|
||||||
this.isMenuOpen = false;
|
this.isMenuOpen = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
revealPlayer() {
|
||||||
|
this.$emit("trigger", ["revealPlayer"]);
|
||||||
|
},
|
||||||
removePlayer() {
|
removePlayer() {
|
||||||
this.isMenuOpen = false;
|
this.isMenuOpen = false;
|
||||||
this.$emit("trigger", ["removePlayer"]);
|
this.$emit("trigger", ["removePlayer"]);
|
||||||
|
|
|
@ -161,6 +161,17 @@ export default {
|
||||||
this.$store.commit("players/remove", playerIndex);
|
this.$store.commit("players/remove", playerIndex);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
revealPlayer(playerIndex) {
|
||||||
|
if (!this.session.isRevealPlayerOK) {
|
||||||
|
if (
|
||||||
|
!confirm(
|
||||||
|
`Do you really want to reveal this players role to ALL other players?\n\nYou won't be asked to confirm again this game.`
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$store.commit("session/revealPlayer", playerIndex);
|
||||||
|
},
|
||||||
swapPlayer(from, to) {
|
swapPlayer(from, to) {
|
||||||
if (to === undefined) {
|
if (to === undefined) {
|
||||||
this.cancel();
|
this.cancel();
|
||||||
|
|
|
@ -33,6 +33,7 @@ const faIcons = [
|
||||||
"Question",
|
"Question",
|
||||||
"Random",
|
"Random",
|
||||||
"RedoAlt",
|
"RedoAlt",
|
||||||
|
"SatelliteDish",
|
||||||
"SearchMinus",
|
"SearchMinus",
|
||||||
"SearchPlus",
|
"SearchPlus",
|
||||||
"Square",
|
"Square",
|
||||||
|
|
|
@ -25,7 +25,8 @@ const state = () => ({
|
||||||
votingSpeed: 3000,
|
votingSpeed: 3000,
|
||||||
isVoteInProgress: false,
|
isVoteInProgress: false,
|
||||||
voteHistory: [],
|
voteHistory: [],
|
||||||
isRolesDistributed: false
|
isRolesDistributed: false,
|
||||||
|
isRevealPlayerOK: false
|
||||||
});
|
});
|
||||||
|
|
||||||
const getters = {};
|
const getters = {};
|
||||||
|
@ -47,6 +48,9 @@ const mutations = {
|
||||||
setVoteInProgress: set("isVoteInProgress"),
|
setVoteInProgress: set("isVoteInProgress"),
|
||||||
claimSeat: set("claimedSeat"),
|
claimSeat: set("claimedSeat"),
|
||||||
distributeRoles: set("isRolesDistributed"),
|
distributeRoles: set("isRolesDistributed"),
|
||||||
|
revealPlayer(state) {
|
||||||
|
state.isRevealPlayerOK = true;
|
||||||
|
},
|
||||||
setSessionId(state, sessionId) {
|
setSessionId(state, sessionId) {
|
||||||
state.sessionId = sessionId
|
state.sessionId = sessionId
|
||||||
.toLocaleLowerCase()
|
.toLocaleLowerCase()
|
||||||
|
|
|
@ -634,11 +634,12 @@ class LiveSession {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Distribute player roles to all seated players in a direct message.
|
* Distribute player roles to all seated players in a direct message. ST only
|
||||||
* This will be split server side so that each player only receives their own (sub)message.
|
* This will be split server side so that each player only receives their own (sub)message.
|
||||||
*/
|
*/
|
||||||
distributeRoles() {
|
distributeRoles() {
|
||||||
if (this._isSpectator) return;
|
if (this._isSpectator) return;
|
||||||
|
this._store.state.session.isRevealPlayerOK = false;
|
||||||
const message = {};
|
const message = {};
|
||||||
this._store.state.players.players.forEach((player, index) => {
|
this._store.state.players.players.forEach((player, index) => {
|
||||||
if (player.id && player.role) {
|
if (player.id && player.role) {
|
||||||
|
@ -653,6 +654,19 @@ class LiveSession {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Announce a single players role to all other players. ST only
|
||||||
|
* @param playerIndex
|
||||||
|
*/
|
||||||
|
revealPlayer(index) {
|
||||||
|
if (this._isSpectator) return;
|
||||||
|
const player = this._store.state.players.players[index];
|
||||||
|
if (player && player.role) {
|
||||||
|
const message = { index, property: "role", value: player.role.id };
|
||||||
|
this._send("player", message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A player nomination. ST only
|
* A player nomination. ST only
|
||||||
* This also syncs the voting speed to the players.
|
* This also syncs the voting speed to the players.
|
||||||
|
@ -822,6 +836,9 @@ export default store => {
|
||||||
session.distributeRoles();
|
session.distributeRoles();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "session/revealPlayer":
|
||||||
|
session.revealPlayer(payload);
|
||||||
|
break;
|
||||||
case "session/nomination":
|
case "session/nomination":
|
||||||
session.nomination(payload);
|
session.nomination(payload);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue