Added timer functionality
This commit is contained in:
parent
600c3a1836
commit
5e9bf4b31c
|
|
@ -452,6 +452,22 @@ exports.handleMessage = ( gameSocketList, socket, dataRaw ) => {
|
||||||
reject( new Error("No playerId found for connection") );
|
reject( new Error("No playerId found for connection") );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "startTimer":
|
||||||
|
if( socket.locals.isHost ){
|
||||||
|
sendAllPlayers( socket, gameSocketList, "timerStarted", "A timer has been started", { timerAmount: payload });
|
||||||
|
resolve();
|
||||||
|
} else {
|
||||||
|
reject( new Error("No playerId found for connection") );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "stopTimer":
|
||||||
|
if( socket.locals.isHost ){
|
||||||
|
sendAllPlayers( socket, gameSocketList, "timerStopped", "The timer has been stopped", {});
|
||||||
|
resolve();
|
||||||
|
} else {
|
||||||
|
reject( new Error("No playerId found for connection") );
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -205,3 +205,7 @@ $utilities: map-merge(
|
||||||
color: $gray-600;
|
color: $gray-600;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fs-sm {
|
||||||
|
font-size: .75em;
|
||||||
|
}
|
||||||
|
|
@ -44,7 +44,6 @@ let audioInstance = ref(null);
|
||||||
let showingAnswer = ref( false );
|
let showingAnswer = ref( false );
|
||||||
let showingQuestion = ref( false );
|
let showingQuestion = ref( false );
|
||||||
|
|
||||||
|
|
||||||
const isBoardSelected = computed( () => {
|
const isBoardSelected = computed( () => {
|
||||||
return selectedObject.value instanceof Board;
|
return selectedObject.value instanceof Board;
|
||||||
});
|
});
|
||||||
|
|
@ -153,9 +152,11 @@ function setUpListeners(){
|
||||||
});
|
});
|
||||||
gameStore.addSocketListener("questionLocked", ( _data ) => {
|
gameStore.addSocketListener("questionLocked", ( _data ) => {
|
||||||
gameStore.acceptAnswers = false;
|
gameStore.acceptAnswers = false;
|
||||||
|
if( isFreeTextAnswerType.value ){
|
||||||
for( let i in gameStore.players ){
|
for( let i in gameStore.players ){
|
||||||
gameStore.players[i].isAnswering = true;
|
gameStore.players[i].isAnswering = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
gameStore.addSocketListener("playerAnswersRevealed", ( data ) => {
|
gameStore.addSocketListener("playerAnswersRevealed", ( data ) => {
|
||||||
for( let playerAnswer of data.payload.revealedAnswers ){
|
for( let playerAnswer of data.payload.revealedAnswers ){
|
||||||
|
|
@ -206,10 +207,18 @@ function setUpListeners(){
|
||||||
gameStore.addSocketListener("questionLayerSelected", ( data ) => {
|
gameStore.addSocketListener("questionLayerSelected", ( data ) => {
|
||||||
questionIndex.value = Number( data.payload.questionIndex );
|
questionIndex.value = Number( data.payload.questionIndex );
|
||||||
});
|
});
|
||||||
|
gameStore.addSocketListener("timerStarted", ( data ) => {
|
||||||
|
gameStore.setUpTimer(Number( data.payload.timerAmount ));
|
||||||
|
});
|
||||||
|
gameStore.addSocketListener("timerStopped", ( data ) => {
|
||||||
|
gameStore.clearTimer();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function playerBuzzered( data ){
|
function playerBuzzered( data ){
|
||||||
gameStore.acceptAnswers = false;
|
gameStore.acceptAnswers = false;
|
||||||
|
gameStore.clearTimer();
|
||||||
|
|
||||||
if( gameStore.playerId === data.payload.playerId ){
|
if( gameStore.playerId === data.payload.playerId ){
|
||||||
buzzBuzz.play();
|
buzzBuzz.play();
|
||||||
}
|
}
|
||||||
|
|
@ -314,7 +323,8 @@ function questionAnsweredRevert( cIndex, bEIndex ){
|
||||||
gameStore.sendEvent("questionAnsweredRevert", payload );
|
gameStore.sendEvent("questionAnsweredRevert", payload );
|
||||||
}
|
}
|
||||||
|
|
||||||
function manualPointsAdjustment( playerId, playerName, points ){
|
function manualPointsAdjustment( playerId, playerName, arePointsAdded ){
|
||||||
|
let points = ( arePointsAdded ? gameStore.hostData.manualAdjustmentValue : -1 * gameStore.hostData.manualAdjustmentValue );
|
||||||
let payload = {
|
let payload = {
|
||||||
reopenQuestion: gameStore.acceptAnswers,
|
reopenQuestion: gameStore.acceptAnswers,
|
||||||
playerId: playerId,
|
playerId: playerId,
|
||||||
|
|
@ -369,6 +379,17 @@ function revealPlayerAnswers( playerIds ){
|
||||||
gameStore.sendEvent("revealPlayerAnswers", payload);
|
gameStore.sendEvent("revealPlayerAnswers", payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function startTimer( timerAmount ){
|
||||||
|
if( gameStore.isHost ){
|
||||||
|
gameStore.sendEvent("startTimer", timerAmount );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function stopTimer(){
|
||||||
|
if( gameStore.isHost ){
|
||||||
|
gameStore.sendEvent("stopTimer", {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gameStore.getBoardToGame( route.params.gameId )
|
gameStore.getBoardToGame( route.params.gameId )
|
||||||
.then( () => {
|
.then( () => {
|
||||||
selectedObject.value = gameStore.board;
|
selectedObject.value = gameStore.board;
|
||||||
|
|
@ -402,8 +423,11 @@ onBeforeRouteLeave((to, from) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const isFreeTextAnswerType = computed(() => {
|
||||||
|
return gameStore.board.categories[categoryIndex.value].boardEntries[boardEntryIndex.value].answer.answerInteraction === 'freeTextInteraction';
|
||||||
|
})
|
||||||
|
|
||||||
//TODO List:
|
//TODO List:
|
||||||
// -Profile Pic
|
|
||||||
// -More Question Types
|
// -More Question Types
|
||||||
// -Height of Category Headers (on Multiline)
|
// -Height of Category Headers (on Multiline)
|
||||||
|
|
||||||
|
|
@ -489,6 +513,8 @@ onBeforeRouteLeave((to, from) => {
|
||||||
@questionAnswered="questionAnswered"
|
@questionAnswered="questionAnswered"
|
||||||
@questionAnsweredRevert="questionAnsweredRevert"
|
@questionAnsweredRevert="questionAnsweredRevert"
|
||||||
@letNextPlayerChoose="letNextPlayerChoose"
|
@letNextPlayerChoose="letNextPlayerChoose"
|
||||||
|
@startTimer="startTimer"
|
||||||
|
@stopTimer="stopTimer"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed } from 'vue';
|
import { computed, ref, watch } from 'vue';
|
||||||
|
|
||||||
import QuestionView from "@/components/views/QuestionView.vue"
|
import QuestionView from "@/components/views/QuestionView.vue"
|
||||||
import AnswerView from "@/components/views/AnswerView.vue"
|
import AnswerView from "@/components/views/AnswerView.vue"
|
||||||
|
import { useGameStore } from '@/stores/GameStore';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
board: Object,
|
board: Object,
|
||||||
|
|
@ -34,12 +35,18 @@ const props = defineProps({
|
||||||
|
|
||||||
const emit = defineEmits(["specificQuestionLayerSelected", "backToBoard", "playerBuzzered", "playAudio", "stopAudio", "showQuestion", "showAnswer", "hideQuestion", "hideAnswer" ]);
|
const emit = defineEmits(["specificQuestionLayerSelected", "backToBoard", "playerBuzzered", "playAudio", "stopAudio", "showQuestion", "showAnswer", "hideQuestion", "hideAnswer" ]);
|
||||||
|
|
||||||
|
const gameStore = useGameStore();
|
||||||
|
|
||||||
let boardEntry = computed( () => {
|
let boardEntry = computed( () => {
|
||||||
return props.board.categories[props.cIndex].boardEntries[props.bEIndex];
|
return props.board.categories[props.cIndex].boardEntries[props.bEIndex];
|
||||||
})
|
})
|
||||||
|
|
||||||
const showingQuestion = computed( () => {
|
const showingQuestion = computed( () => {
|
||||||
return props.isAnswerRevealed || ( props.isQuestionRevealed && !props.anyPlayerIsAnswering );
|
return props.isAnswerRevealed || ( props.isQuestionRevealed && (isFreeTextAnswerType.value || !props.anyPlayerIsAnswering) );
|
||||||
|
});
|
||||||
|
|
||||||
|
const isFreeTextAnswerType = computed(() => {
|
||||||
|
return gameStore.board.categories[props.cIndex].boardEntries[props.bEIndex].answer.answerInteraction === 'freeTextInteraction';
|
||||||
});
|
});
|
||||||
|
|
||||||
function showQuestion(){
|
function showQuestion(){
|
||||||
|
|
@ -73,6 +80,34 @@ function stopAudio(){
|
||||||
emit( "stopAudio" );
|
emit( "stopAudio" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const progressRef = ref(null);
|
||||||
|
let timerAnimation = null;
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => gameStore.timer.amount,
|
||||||
|
(newVal) => {
|
||||||
|
if( newVal !== null ){
|
||||||
|
if( timerAnimation !== null ){
|
||||||
|
timerAnimation.cancel();
|
||||||
|
timerAnimation = null;
|
||||||
|
}
|
||||||
|
animateTimer(newVal);
|
||||||
|
} else if(timerAnimation !== null ){
|
||||||
|
timerAnimation.cancel();
|
||||||
|
timerAnimation = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
function animateTimer(timerAmountInS){
|
||||||
|
timerAnimation = progressRef.value.animate([
|
||||||
|
{ width: '100%' },
|
||||||
|
], {
|
||||||
|
duration: 1000 * timerAmountInS,
|
||||||
|
iterations: 1,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -140,8 +175,10 @@ function stopAudio(){
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div :class="[{'d-none': gameStore.timer.timeoutId === null}]" class="position-absolute bottom-0 start-0 w-100">
|
||||||
|
<div class="progress bg-primary" role="progressbar" aria-label="Basic example" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
|
||||||
|
<div ref="progressRef" class="progress-bar bg-pink-accent-primary" style="width: 0"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
</style>
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
|
||||||
|
import { useGameStore } from '@/stores/GameStore';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
objToDisplay: String,
|
objToDisplay: String,
|
||||||
board: Object,
|
board: Object,
|
||||||
|
|
@ -12,7 +14,9 @@ const props = defineProps({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits( "lockQuestion", "revealPlayerAnswers", "letNextPlayerChoose" );
|
const emit = defineEmits( "lockQuestion", "revealPlayerAnswers", "letNextPlayerChoose", "stopTimer", "startTimer" );
|
||||||
|
|
||||||
|
const gameStore = useGameStore();
|
||||||
|
|
||||||
let boardEntry = computed( () => {
|
let boardEntry = computed( () => {
|
||||||
if( props.objToDisplay === "BoardEntry" ){
|
if( props.objToDisplay === "BoardEntry" ){
|
||||||
|
|
@ -33,14 +37,41 @@ function letNextPlayerChoose(){
|
||||||
emit("letNextPlayerChoose");
|
emit("letNextPlayerChoose");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function startTimer(){
|
||||||
|
emit("startTimer", gameStore.hostData.timerAmount);
|
||||||
|
}
|
||||||
|
function stopTimer(){
|
||||||
|
emit("stopTimer");
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
v-if="boardEntry !== undefined"
|
v-if="boardEntry !== undefined"
|
||||||
class="d-flex flex-column justify-content-center border-top border-pink-accent-primary interaction-size"
|
class="d-flex flex-column justify-content-center border-top border-pink-accent-primary py-2 interaction-size"
|
||||||
>
|
>
|
||||||
|
<div class="row mx-1 mb-0">
|
||||||
|
<div class="col">
|
||||||
|
<label for="manual-adjustment-value">Point Adjustment Value</label>
|
||||||
|
<input v-model="gameStore.hostData.manualAdjustmentValue" id="manual-adjustment-value" type="text" name="manual-adjustment-value" class="form-control form-control-sm border-pink-accent-primary">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mx-1 mb-3">
|
||||||
|
<div class="col">
|
||||||
|
<label for="timer-value">Timer Length <span class="fs-sm">(in seconds)</span></label>
|
||||||
|
<div class="d-flex gap-1">
|
||||||
|
<input v-model="gameStore.hostData.timerAmount" id="timer-value" type="number" min="1" class="form-control form-control-sm border-pink-accent-primary" :disabled="gameStore.timer.timeoutId !== null">
|
||||||
|
<button v-if="gameStore.timer.timeoutId === null" class="btn btn-sm btn-pink-accent-primary text-nowrap" @click="startTimer">
|
||||||
|
Start Timer
|
||||||
|
<font-awesome-icon icon="fa-solid fa-play"/>
|
||||||
|
</button>
|
||||||
|
<button v-else class="btn btn-sm btn-pink-accent-primary text-nowrap" @click="stopTimer">
|
||||||
|
Stop Timer
|
||||||
|
<font-awesome-icon icon="fa-solid fa-stop"/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row mx-2">
|
<div class="row mx-2">
|
||||||
<div class="col-12 text-center text-truncate">
|
<div class="col-12 text-center text-truncate">
|
||||||
Answer: {{ boardEntry.answer.answerText }}
|
Answer: {{ boardEntry.answer.answerText }}
|
||||||
|
|
@ -69,7 +100,7 @@ function letNextPlayerChoose(){
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.interaction-size{
|
.interaction-size{
|
||||||
height: 6rem;
|
min-height: 6rem;
|
||||||
}
|
}
|
||||||
.no-resize{
|
.no-resize{
|
||||||
resize: none;
|
resize: none;
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,9 @@ const emit = defineEmits( "manualPointsAdjustment", "answerRuled", "revealPlayer
|
||||||
|
|
||||||
let buttonDivHeight = ref("3rem");
|
let buttonDivHeight = ref("3rem");
|
||||||
let navbarHeight = ref("4rem");
|
let navbarHeight = ref("4rem");
|
||||||
let manualAdjustmentValue = ref( 100 );
|
|
||||||
|
|
||||||
function manualPointsAdjustment( playerId, playerName, arePointsAdded ) {
|
function manualPointsAdjustment( playerId, playerName, arePointsAdded ) {
|
||||||
let points = ( arePointsAdded ? manualAdjustmentValue.value : -1 * manualAdjustmentValue.value );
|
emit("manualPointsAdjustment", playerId, playerName, arePointsAdded );
|
||||||
emit("manualPointsAdjustment", playerId, playerName, points );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function answerRuled( playerId, playerName, isAnswerCorrect ){
|
function answerRuled( playerId, playerName, isAnswerCorrect ){
|
||||||
|
|
@ -73,12 +71,6 @@ function letPlayerChoose( playerId ){
|
||||||
<div class="d-flex flex-column px-3" :style="[{'height': 'calc( 100vh - ' + (navbarHeight - buttonDivHeight) + 'px)' }]">
|
<div class="d-flex flex-column px-3" :style="[{'height': 'calc( 100vh - ' + (navbarHeight - buttonDivHeight) + 'px)' }]">
|
||||||
<div class="my-3">
|
<div class="my-3">
|
||||||
<h3 class="border-bottom border-3 border-pink-accent-primary fw-bold">Players</h3>
|
<h3 class="border-bottom border-3 border-pink-accent-primary fw-bold">Players</h3>
|
||||||
<div v-if="props.isHost" class="row mb-3">
|
|
||||||
<div class="col">
|
|
||||||
<label for="manual-adjustment-value">Manual Adjustment Value</label>
|
|
||||||
<input v-model="manualAdjustmentValue" id="manual-adjustment-value" type="text" name="manual-adjustment-value" class="form-control form-control-sm border-pink-accent-primary">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<template v-for="(player) in props.players" :key="player._id">
|
<template v-for="(player) in props.players" :key="player._id">
|
||||||
<PlayerListEntry
|
<PlayerListEntry
|
||||||
:player="player"
|
:player="player"
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import { FontAwesomeIcon, FontAwesomeLayers } from "@fortawesome/vue-fontawesome
|
||||||
import { library } from "@fortawesome/fontawesome-svg-core";
|
import { library } from "@fortawesome/fontawesome-svg-core";
|
||||||
import { faDragon, faRightToBracket, faUsers, faUserPlus, faSpinner, faPlusSquare, faBorderAll, faPen, faTrash, faAngleDown, faAngleUp,
|
import { faDragon, faRightToBracket, faUsers, faUserPlus, faSpinner, faPlusSquare, faBorderAll, faPen, faTrash, faAngleDown, faAngleUp,
|
||||||
faPlus, faMinus, faAngleRight, faSquare, faPlay, faCircleExclamation, faSquareCheck, faSquareMinus, faHandPointer, faFloppyDisk,
|
faPlus, faMinus, faAngleRight, faSquare, faPlay, faCircleExclamation, faSquareCheck, faSquareMinus, faHandPointer, faFloppyDisk,
|
||||||
faEye, faRotateLeft } from "@fortawesome/free-solid-svg-icons";
|
faEye, faRotateLeft, faStop } from "@fortawesome/free-solid-svg-icons";
|
||||||
import { faCircleUser, faSquarePlus } from "@fortawesome/free-regular-svg-icons";
|
import { faCircleUser, faSquarePlus } from "@fortawesome/free-regular-svg-icons";
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -44,6 +44,7 @@ library.add({
|
||||||
faFloppyDisk,
|
faFloppyDisk,
|
||||||
faEye,
|
faEye,
|
||||||
faRotateLeft,
|
faRotateLeft,
|
||||||
|
faStop,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { useUserStore } from "@/stores/UserStore";
|
||||||
import { GAME_STATES } from "@/services/GameService";
|
import { GAME_STATES } from "@/services/GameService";
|
||||||
import Board from "@/models/Board";
|
import Board from "@/models/Board";
|
||||||
import { boardResponseToBoardModel } from "@/services/util";
|
import { boardResponseToBoardModel } from "@/services/util";
|
||||||
|
import { nextTick } from 'vue';
|
||||||
|
|
||||||
const gService = new GameService();
|
const gService = new GameService();
|
||||||
|
|
||||||
|
|
@ -26,6 +27,11 @@ export const useGameStore = defineStore('game', {
|
||||||
isPlayerChoosing: false,
|
isPlayerChoosing: false,
|
||||||
chosenEntry: undefined,
|
chosenEntry: undefined,
|
||||||
keepAliveInterval: undefined,
|
keepAliveInterval: undefined,
|
||||||
|
timer: {
|
||||||
|
timeoutId: null, //null | timeoutId
|
||||||
|
amount: null,
|
||||||
|
},
|
||||||
|
hostData: {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|
@ -63,6 +69,12 @@ export const useGameStore = defineStore('game', {
|
||||||
isHost: res.data.isHost,
|
isHost: res.data.isHost,
|
||||||
gameState: res.data.gameState,
|
gameState: res.data.gameState,
|
||||||
}
|
}
|
||||||
|
if(isHost){
|
||||||
|
this.hostData = {
|
||||||
|
manualAdjustmentValue: 100,
|
||||||
|
timerAmount: 15,
|
||||||
|
}
|
||||||
|
}
|
||||||
this.gameCode = res.data.gameCode;
|
this.gameCode = res.data.gameCode;
|
||||||
resolve( data );
|
resolve( data );
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -83,6 +95,10 @@ export const useGameStore = defineStore('game', {
|
||||||
this.gameState = GAME_STATES.INIT;
|
this.gameState = GAME_STATES.INIT;
|
||||||
this.gameCode = res.data.code;
|
this.gameCode = res.data.code;
|
||||||
this.isHost = true;
|
this.isHost = true;
|
||||||
|
this.hostData = {
|
||||||
|
manualAdjustmentValue: 100,
|
||||||
|
timerAmount: 15,
|
||||||
|
}
|
||||||
resolve();
|
resolve();
|
||||||
} else {
|
} else {
|
||||||
reject( res.data.error );
|
reject( res.data.error );
|
||||||
|
|
@ -182,6 +198,10 @@ export const useGameStore = defineStore('game', {
|
||||||
this.removeSocketListener("noUser");
|
this.removeSocketListener("noUser");
|
||||||
this.players = data.payload.players;
|
this.players = data.payload.players;
|
||||||
this.isHost = true;
|
this.isHost = true;
|
||||||
|
this.hostData = {
|
||||||
|
manualAdjustmentValue: 100,
|
||||||
|
timerAmount: 15,
|
||||||
|
}
|
||||||
resolve( data.payload.gameId );
|
resolve( data.payload.gameId );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -321,6 +341,27 @@ export const useGameStore = defineStore('game', {
|
||||||
this.addSocketListener("payloadIncomplete", ( _data ) => {
|
this.addSocketListener("payloadIncomplete", ( _data ) => {
|
||||||
console.error("Invalid or Incomplete Payload!");
|
console.error("Invalid or Incomplete Payload!");
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
setUpTimer(timerAmountInS){
|
||||||
|
this.timer.timeoutId = setTimeout(() => {
|
||||||
|
this.acceptAnswers = false;
|
||||||
|
clearTimeout(this.timer);
|
||||||
|
this.timer.timeoutId = null;
|
||||||
|
nextTick(() => {
|
||||||
|
this.timer.amount = null;
|
||||||
|
});
|
||||||
|
if(this.isHost){
|
||||||
|
this.sendEvent("lockQuestion", {});
|
||||||
|
}
|
||||||
|
}, timerAmountInS * 1000);
|
||||||
|
this.timer.amount = timerAmountInS;
|
||||||
|
},
|
||||||
|
clearTimer(){
|
||||||
|
if(this.timer.timeoutId){
|
||||||
|
clearTimeout(this.timer.timeoutId);
|
||||||
|
this.timer.timeoutId = null;
|
||||||
|
this.timer.amount = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue