added animated move timer
This commit is contained in:
@@ -115,6 +115,7 @@ module.exports = (io, socket) => {
|
||||
socket.join(room._id.toString());
|
||||
// Sending data to the user, after which player will be redirected to the game
|
||||
socket.emit('player:data', JSON.stringify(req.session));
|
||||
socket.emit('room:data', JSON.stringify(updatedRoom));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ module.exports = (io, socket) => {
|
||||
room.players[index + 1].nowMoving = true;
|
||||
}
|
||||
room.nextMoveTime = Date.now() + 15000;
|
||||
if (this.timeoutID) clearTimeout(this.timeoutID);
|
||||
this.timeoutID = null;
|
||||
RoomModel.findOneAndUpdate({ _id: req.session.roomId }, room, function (err, updatedRoom) {
|
||||
io.to(req.session.roomId).emit('room:data', JSON.stringify(updatedRoom));
|
||||
});
|
||||
|
||||
@@ -36,6 +36,7 @@ RoomSchema.methods.changeMovingPlayer = function () {
|
||||
this.nextMoveTime = Date.now() + 15000;
|
||||
this.rolledNumber = null;
|
||||
if (this.timeoutID) clearTimeout(this.timeoutID);
|
||||
this.timeoutID = null;
|
||||
};
|
||||
|
||||
RoomSchema.methods.movePawn = function (pawn) {
|
||||
|
||||
Reference in New Issue
Block a user