Added initial selection of player who chooses a BoardEntry in BE
This commit is contained in:
1 parent
a4b0db9118
commit
70d9786ef2
9 files changed
+93
-6
No files matched your search
@@ -12,6 +12,10 @@ const props = defineProps({
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
isPlayerChoosing: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(["boardEntryCardClicked", "boardEntryAnsweredClicked", "boardEntryAnsweredRevertClicked" ]);
|
||||
@@ -42,7 +46,7 @@ function boardEntryAnsweredRevertClicked(){
|
||||
{ 'border-pink-accent-primary-disabled' : props.boardEntry.isAnswered },
|
||||
{ 'border-pink-accent-primary' : !props.boardEntry.isAnswered },
|
||||
{ 'bg-dark-primary': props.boardEntry.isAnswered },
|
||||
{ 'pointer': !props.boardEntry.isAnswered && props.isHost },
|
||||
{ 'pointer': !props.boardEntry.isAnswered && ( props.isHost || props.isPlayerChoosing ) },
|
||||
]"
|
||||
@click="questionCardClicked"
|
||||
>
|
||||
|
||||
@@ -226,6 +226,8 @@ function showBoard(){
|
||||
function boardEntryClicked( cIndex, entryIndex ){
|
||||
if( gameStore.isHost ){
|
||||
gameStore.sendEvent( "selectBoardEntry", { categoryIndex: cIndex, boardEntryIndex: entryIndex } );
|
||||
} else if( gameStore.isPlayerChoosing ){
|
||||
gameStore.sendEvent( "playerChooseBoardEntry", { categoryIndex: cIndex, boardEntryIndex: entryIndex } );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,6 +392,7 @@ onBeforeRouteLeave((to, from) => {
|
||||
:bEIndex="boardEntryIndex"
|
||||
:showingBottomView="true"
|
||||
:isHost="gameStore.isHost"
|
||||
:isPlayerChoosing="gameStore.isPlayerChoosing"
|
||||
:anyPlayerIsAnswering="anyPlayerIsAnswering"
|
||||
:isBeingPlayed="isBeingPlayed"
|
||||
@showBoard="showBoard"
|
||||
|
||||
@@ -29,6 +29,9 @@ function boardSelected( id ){
|
||||
|
||||
onMounted( () => {
|
||||
gameStore.addSocketListener("gameStarted", ( data ) => {
|
||||
if( !gameStore.isHost ){
|
||||
gameStore.isPlayerChoosing = data.payload.choosingPlayer === gameStore.playerId;
|
||||
}
|
||||
router.push( { name: "gameWithGameId", params: { gameId: route.params.gameId } } );
|
||||
});
|
||||
|
||||
|
||||
@@ -12,12 +12,16 @@ const props = defineProps({
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
isPlayerChoosing: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(["boardEntryClicked", "questionAnswered", "questionAnsweredRevert" ])
|
||||
|
||||
function boardEntryCardClicked( categoryIndex, boardEntryIndex ){
|
||||
if( props.isHost ){
|
||||
if( props.isHost || props.isPlayerChoosing ){
|
||||
emit("boardEntryClicked", categoryIndex, boardEntryIndex);
|
||||
}
|
||||
}
|
||||
@@ -41,7 +45,8 @@ function boardEntryCardClicked( categoryIndex, boardEntryIndex ){
|
||||
/>
|
||||
<template v-for="( boardEntry, boardEntryIndex ) of category.boardEntries" :key="boardEntryIndex">
|
||||
<BoardEntryCard
|
||||
:isHost="isHost"
|
||||
:isHost="props.isHost"
|
||||
:isPlayerChoosing="props.isPlayerChoosing"
|
||||
:isBeingPlayed="props.isBeingPlayed"
|
||||
:boardEntry="boardEntry"
|
||||
@boardEntryCardClicked="boardEntryCardClicked( categoryIndex, boardEntryIndex )"
|
||||
|
||||
@@ -29,7 +29,11 @@ const props = defineProps({
|
||||
isBeingPlayed: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
}
|
||||
},
|
||||
isPlayerChoosing: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(["boardEntryClicked", "specificQuestionLayerSelected", "showBoard", "playerBuzzered", "playAudio", "stopAudio",
|
||||
@@ -119,6 +123,7 @@ watch(
|
||||
:board="props.board"
|
||||
:isHost="props.isHost"
|
||||
:isBeingPlayed="props.isBeingPlayed"
|
||||
:isPlayerChoosing="props.isPlayerChoosing"
|
||||
@boardEntryClicked="boardEntryClicked"
|
||||
@questionAnswered="questionAnswered"
|
||||
@questionAnsweredRevert="questionAnsweredRevert"
|
||||
|
||||
@@ -23,6 +23,7 @@ export const useGameStore = defineStore('game', {
|
||||
currentQuestion: {},
|
||||
board: new Board( undefined, "New Board", []),
|
||||
acceptAnswers: false,
|
||||
isPlayerChoosing: false,
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
||||
Reference in new issue
Block a user