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