Compare commits
No commits in common. "feat/timer" and "master" have entirely different histories.
feat/timer
...
master
|
|
@ -452,22 +452,6 @@ 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,7 +205,3 @@ $utilities: map-merge(
|
||||||
color: $gray-600;
|
color: $gray-600;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fs-sm {
|
|
||||||
font-size: .75em;
|
|
||||||
}
|
|
||||||
|
|
@ -44,6 +44,7 @@ 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;
|
||||||
});
|
});
|
||||||
|
|
@ -152,11 +153,9 @@ 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 ){
|
||||||
|
|
@ -207,18 +206,10 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
@ -323,8 +314,7 @@ function questionAnsweredRevert( cIndex, bEIndex ){
|
||||||
gameStore.sendEvent("questionAnsweredRevert", payload );
|
gameStore.sendEvent("questionAnsweredRevert", payload );
|
||||||
}
|
}
|
||||||
|
|
||||||
function manualPointsAdjustment( playerId, playerName, arePointsAdded ){
|
function manualPointsAdjustment( playerId, playerName, points ){
|
||||||
let points = ( arePointsAdded ? gameStore.hostData.manualAdjustmentValue : -1 * gameStore.hostData.manualAdjustmentValue );
|
|
||||||
let payload = {
|
let payload = {
|
||||||
reopenQuestion: gameStore.acceptAnswers,
|
reopenQuestion: gameStore.acceptAnswers,
|
||||||
playerId: playerId,
|
playerId: playerId,
|
||||||
|
|
@ -379,17 +369,6 @@ 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;
|
||||||
|
|
@ -423,11 +402,8 @@ 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)
|
||||||
|
|
||||||
|
|
@ -513,8 +489,6 @@ const isFreeTextAnswerType = computed(() => {
|
||||||
@questionAnswered="questionAnswered"
|
@questionAnswered="questionAnswered"
|
||||||
@questionAnsweredRevert="questionAnsweredRevert"
|
@questionAnsweredRevert="questionAnsweredRevert"
|
||||||
@letNextPlayerChoose="letNextPlayerChoose"
|
@letNextPlayerChoose="letNextPlayerChoose"
|
||||||
@startTimer="startTimer"
|
|
||||||
@stopTimer="stopTimer"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref, watch } from 'vue';
|
import { computed } 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,
|
||||||
|
|
@ -35,18 +34,12 @@ 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 && (isFreeTextAnswerType.value || !props.anyPlayerIsAnswering) );
|
return props.isAnswerRevealed || ( props.isQuestionRevealed && !props.anyPlayerIsAnswering );
|
||||||
});
|
|
||||||
|
|
||||||
const isFreeTextAnswerType = computed(() => {
|
|
||||||
return gameStore.board.categories[props.cIndex].boardEntries[props.bEIndex].answer.answerInteraction === 'freeTextInteraction';
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function showQuestion(){
|
function showQuestion(){
|
||||||
|
|
@ -80,34 +73,6 @@ 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>
|
||||||
|
|
@ -175,10 +140,8 @@ function animateTimer(timerAmountInS){
|
||||||
</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,8 +1,6 @@
|
||||||
<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,
|
||||||
|
|
@ -14,9 +12,7 @@ const props = defineProps({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits( "lockQuestion", "revealPlayerAnswers", "letNextPlayerChoose", "stopTimer", "startTimer" );
|
const emit = defineEmits( "lockQuestion", "revealPlayerAnswers", "letNextPlayerChoose" );
|
||||||
|
|
||||||
const gameStore = useGameStore();
|
|
||||||
|
|
||||||
let boardEntry = computed( () => {
|
let boardEntry = computed( () => {
|
||||||
if( props.objToDisplay === "BoardEntry" ){
|
if( props.objToDisplay === "BoardEntry" ){
|
||||||
|
|
@ -37,41 +33,14 @@ 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 py-2 interaction-size"
|
class="d-flex flex-column justify-content-center border-top border-pink-accent-primary 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 }}
|
||||||
|
|
@ -100,7 +69,7 @@ function stopTimer(){
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.interaction-size{
|
.interaction-size{
|
||||||
min-height: 6rem;
|
height: 6rem;
|
||||||
}
|
}
|
||||||
.no-resize{
|
.no-resize{
|
||||||
resize: none;
|
resize: none;
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,11 @@ 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 ) {
|
||||||
emit("manualPointsAdjustment", playerId, playerName, arePointsAdded );
|
let points = ( arePointsAdded ? manualAdjustmentValue.value : -1 * manualAdjustmentValue.value );
|
||||||
|
emit("manualPointsAdjustment", playerId, playerName, points );
|
||||||
}
|
}
|
||||||
|
|
||||||
function answerRuled( playerId, playerName, isAnswerCorrect ){
|
function answerRuled( playerId, playerName, isAnswerCorrect ){
|
||||||
|
|
@ -71,6 +73,12 @@ 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, faStop } from "@fortawesome/free-solid-svg-icons";
|
faEye, faRotateLeft } 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,7 +44,6 @@ library.add({
|
||||||
faFloppyDisk,
|
faFloppyDisk,
|
||||||
faEye,
|
faEye,
|
||||||
faRotateLeft,
|
faRotateLeft,
|
||||||
faStop,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ 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();
|
||||||
|
|
||||||
|
|
@ -27,11 +26,6 @@ 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: {
|
||||||
|
|
@ -69,12 +63,6 @@ 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 {
|
||||||
|
|
@ -95,10 +83,6 @@ 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 );
|
||||||
|
|
@ -198,10 +182,6 @@ 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 );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -341,27 +321,6 @@ 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