|
|
@ -23,7 +23,7 @@ module.exports = class Lobby { |
|
|
|
this.name = name; |
|
|
|
this.name = name; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
run(ioLobby) { |
|
|
|
run(io) { |
|
|
|
this.running = true; |
|
|
|
this.running = true; |
|
|
|
this.startTime = Date.now(); |
|
|
|
this.startTime = Date.now(); |
|
|
|
|
|
|
|
|
|
|
@ -33,13 +33,12 @@ module.exports = class Lobby { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const timestamp = timeline.getIndex(this.timelineIndex); |
|
|
|
const timestamp = timeline.getIndex(this.timelineIndex); |
|
|
|
const nextShot = timeline.getNextShot(this.timelineIndex); |
|
|
|
const nextShot = timeline.getNextShot(this.timelineIndex); |
|
|
|
|
|
|
|
|
|
|
|
if (!timestamp) { |
|
|
|
if (!timestamp) { |
|
|
|
// We are done.
|
|
|
|
// We are done.
|
|
|
|
ioLobby.emit('tick_event', { |
|
|
|
io.to(this.name + "").emit('tick_event', { |
|
|
|
current: this.currentSeconds |
|
|
|
current: this.currentSeconds |
|
|
|
}); |
|
|
|
}); |
|
|
|
console.log("Done"); |
|
|
|
console.log("Done"); |
|
|
@ -49,7 +48,7 @@ module.exports = class Lobby { |
|
|
|
|
|
|
|
|
|
|
|
console.log("ticking", this.currentSeconds); |
|
|
|
console.log("ticking", this.currentSeconds); |
|
|
|
|
|
|
|
|
|
|
|
ioLobby.emit('tick_event', { |
|
|
|
io.to(this.name + "").emit('tick_event', { |
|
|
|
current: this.currentSeconds, |
|
|
|
current: this.currentSeconds, |
|
|
|
next: timestamp, |
|
|
|
next: timestamp, |
|
|
|
nextShot: nextShot |
|
|
|
nextShot: nextShot |
|
|
@ -72,14 +71,14 @@ module.exports = class Lobby { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* |
|
|
|
* |
|
|
|
* @param ioLobby |
|
|
|
* @param io |
|
|
|
* @param {number} time |
|
|
|
* @param {number} time |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
seek(ioLobby, time) { |
|
|
|
seek(io, time) { |
|
|
|
this.currentSeconds = time; |
|
|
|
this.currentSeconds = time; |
|
|
|
this.startTime = Date.now() - time * 1000; |
|
|
|
this.startTime = Date.now() - time * 1000; |
|
|
|
this.timelineIndex = timeline.indexForTime(this.currentSeconds); |
|
|
|
this.timelineIndex = timeline.indexForTime(this.currentSeconds); |
|
|
|
ioLobby.emit('seek', time); |
|
|
|
io.to(this.name + "").emit('seek', time); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|