replace restart with return to lobby, add mockup player options button

This commit is contained in:
AlecM33
2023-08-02 18:44:33 -04:00
parent 61275dd3e5
commit d00f3d630a
9 changed files with 89 additions and 28 deletions

View File

@@ -215,7 +215,7 @@ class GameManager {
}
};
restartGame = async (game, namespace) => {
restartGame = async (game, namespace, status = globals.STATUS.IN_PROGRESS) => {
// kill any outstanding timer threads
const subProcess = this.timerManager.timerThreads[game.accessCode];
if (subProcess) {
@@ -260,15 +260,19 @@ class GameManager {
}
}
// start the new game
game.status = globals.STATUS.IN_PROGRESS;
if (game.hasTimer) {
game.timerParams.paused = true;
game.timerParams.timeRemaining = convertFromHoursToMilliseconds(game.timerParams.hours) +
convertFromMinutesToMilliseconds(game.timerParams.minutes);
await this.timerManager.runTimer(game, namespace, this.eventManager, this);
if (status === globals.STATUS.IN_PROGRESS) {
game.status = globals.STATUS.IN_PROGRESS;
if (game.hasTimer) {
game.timerParams.paused = true;
game.timerParams.timeRemaining = convertFromHoursToMilliseconds(game.timerParams.hours) +
convertFromMinutesToMilliseconds(game.timerParams.minutes);
await this.timerManager.runTimer(game, namespace, this.eventManager, this);
}
} else {
game.status = globals.STATUS.LOBBY;
}
await this.refreshGame(game);
await this.eventManager.publisher?.publish(
globals.REDIS_CHANNELS.ACTIVE_GAME_STREAM,