added skip timeout
This commit is contained in:
parent
f0d6fa758d
commit
4e52512c7d
@ -79,6 +79,7 @@ module.exports = (io, socket) => {
|
||||
}
|
||||
// Updating timer
|
||||
room.nextMoveTime = Date.now() + 15000;
|
||||
setTimeout(skip, 15000);
|
||||
// Pushing above data to database
|
||||
RoomModel.findOneAndUpdate({ _id: req.session.roomId }, room, err => {
|
||||
if (err) return err;
|
||||
@ -110,6 +111,7 @@ module.exports = (io, socket) => {
|
||||
}
|
||||
// Updating timer
|
||||
room.nextMoveTime = Date.now() + 15000;
|
||||
setTimeout(skip, 15000);
|
||||
// Pushing above data to database
|
||||
RoomModel.findOneAndUpdate({ _id: req.session.roomId }, room, (err, updatedRoom) => {
|
||||
if (!updatedRoom) return err;
|
||||
|
||||
@ -2,7 +2,6 @@ import React, { useState, useEffect, useContext, useCallback } from 'react';
|
||||
import ReactLoading from 'react-loading';
|
||||
import { PlayerDataContext, SocketContext } from '../App';
|
||||
import Map from './game-board-components/Map';
|
||||
import Dice from './game-board-components/Dice';
|
||||
import Navbar from './Navbar';
|
||||
|
||||
const Gameboard = () => {
|
||||
@ -96,10 +95,3 @@ const Gameboard = () => {
|
||||
};
|
||||
|
||||
export default Gameboard;
|
||||
/*
|
||||
<Dice
|
||||
rolledNumber={rolledNumber}
|
||||
nowMoving={nowMoving}
|
||||
color={movingPlayer}
|
||||
rolledNumberCallback={rolledNumberCallback}
|
||||
/>*/
|
||||
|
||||
@ -26,10 +26,6 @@ const NameContainer = ({ player, time }) => {
|
||||
|
||||
// Function responsible for counting down to the end of time every second
|
||||
const countdown = () => {
|
||||
// If the time if over emit information to server
|
||||
if (remainingTime <= 0) {
|
||||
return socket.emit('game:skip');
|
||||
}
|
||||
setRemainingTime(Math.ceil((time - Date.now()) / 1000));
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user