mirror of
https://github.com/randyjc/Rahoot.git
synced 2026-03-13 20:15:35 +01:00
adding skip in cooldown and probing for media files
This commit is contained in:
@@ -171,6 +171,10 @@ io.on("connection", (socket) => {
|
||||
withGame(gameId, socket, (game) => game.nextRound(socket))
|
||||
)
|
||||
|
||||
socket.on("manager:skipQuestionIntro", ({ gameId }) =>
|
||||
withGame(gameId, socket, (game) => game.skipQuestionIntro(socket))
|
||||
)
|
||||
|
||||
socket.on("manager:showLeaderboard", ({ gameId }) =>
|
||||
withGame(gameId, socket, (game) => game.showLeaderboard())
|
||||
)
|
||||
|
||||
@@ -293,6 +293,18 @@ class Game {
|
||||
this.cooldown.active &&= false
|
||||
}
|
||||
|
||||
skipQuestionIntro(socket: Socket) {
|
||||
if (this.manager.id !== socket.id) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!this.started) {
|
||||
return
|
||||
}
|
||||
|
||||
this.abortCooldown()
|
||||
}
|
||||
|
||||
async start(socket: Socket) {
|
||||
if (this.manager.id !== socket.id) {
|
||||
return
|
||||
@@ -346,11 +358,11 @@ class Game {
|
||||
this.broadcastStatus(STATUS.SHOW_QUESTION, {
|
||||
question: question.question,
|
||||
image: question.image,
|
||||
media: question.media,
|
||||
media: question.media,
|
||||
cooldown: question.cooldown,
|
||||
})
|
||||
|
||||
await sleep(question.cooldown)
|
||||
await this.startCooldown(question.cooldown)
|
||||
|
||||
if (!this.started) {
|
||||
return
|
||||
@@ -362,7 +374,7 @@ class Game {
|
||||
question: question.question,
|
||||
answers: question.answers,
|
||||
image: question.image,
|
||||
media: question.media,
|
||||
media: question.media,
|
||||
time: question.time,
|
||||
totalPlayer: this.players.length,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user