diff --git a/notes.md b/notes.md index ca6b216..8ec80b1 100644 --- a/notes.md +++ b/notes.md @@ -32,3 +32,11 @@ mash le clavier pour écrire des message aux participants - moins de temps - ajout de plusieurs zone de text correspondant aux different participants - ajout d'un boutton "rappel" pour chaque participant avec un cool down à clique jusque à ce que tous les participants soit ok + + +#### jsp +jeu de rythme + + +#### livraison +les caisses de club mate tombent du ciel et il faut le attraper diff --git a/src/games/cleanupHS.js b/src/games/cleanupHS.js index 65de506..54c8f32 100644 --- a/src/games/cleanupHS.js +++ b/src/games/cleanupHS.js @@ -83,10 +83,6 @@ export class CleanupHS extends TimedGame { } } - end() { - super.end(); - } - _onItemDrop(item) { console.log("dropped", item.type); diff --git a/src/games/timedGame.js b/src/games/timedGame.js index 293d747..21f80a3 100644 --- a/src/games/timedGame.js +++ b/src/games/timedGame.js @@ -49,14 +49,18 @@ export class TimedGame extends Game { } end(status) { - super.end(status); - this.timerDisplay.stop(); clearTimeout(this._timeoutId); + super.end(this.getRemainingTime() > 0 ? status : false); // even if for some reason sub class tries to end after timeout, the game is still lost + this.timerDisplay.stop(); this._timeoutId = undefined; } getRemainingTime() { - return this.currentTimeout - (Date.now() - this._timeoutStartTime); + if (this._timeoutStartTime && this.currentTimeout) { + return this.currentTimeout - (Date.now() - this._timeoutStartTime); + } else { + return -1; + } } _onTimeout() { diff --git a/src/main.js b/src/main.js index 6e7a433..b8a7596 100644 --- a/src/main.js +++ b/src/main.js @@ -100,9 +100,8 @@ function switchToGame(gameContainer, newGame) { root.addChild(gameContainter); const manager = new GameManager(app, gameContainter); - manager.start(); + //manager.start(); - /* const opinator = new Opinator(app.ticker); const fridge = new Fridge(app.ticker); const smartMonday = new SmartMonday(app.ticker); @@ -111,5 +110,4 @@ function switchToGame(gameContainer, newGame) { gameContainter.addChild(currentGame.gameContainer); currentGame.start(); - */ })(); diff --git a/todo.md b/todo.md index 4acc5ad..474af3a 100644 --- a/todo.md +++ b/todo.md @@ -1,4 +1,2 @@ -- game cycle -> launch a game handle end and launch next - - diplay info - game result