implement safety in timedgame to make sure that game is lost when the time is up, even if sub class calls end(true)
This commit is contained in:
parent
4ffe8a162b
commit
cedafd5e10
5 changed files with 16 additions and 12 deletions
8
notes.md
8
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
|
||||
|
|
|
|||
|
|
@ -83,10 +83,6 @@ export class CleanupHS extends TimedGame {
|
|||
}
|
||||
}
|
||||
|
||||
end() {
|
||||
super.end();
|
||||
}
|
||||
|
||||
_onItemDrop(item) {
|
||||
console.log("dropped", item.type);
|
||||
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
*/
|
||||
})();
|
||||
|
|
|
|||
2
todo.md
2
todo.md
|
|
@ -1,4 +1,2 @@
|
|||
- game cycle -> launch a game handle end and launch next
|
||||
|
||||
- diplay info
|
||||
- game result
|
||||
|
|
|
|||
Loading…
Reference in a new issue