mirror of
https://github.com/OpenLiberty/liberty-bikes.git
synced 2025-01-30 10:40:13 +08:00
Prevent host countdown from going negative
This commit is contained in:
parent
186e2e8b59
commit
30c210d1f5
@ -455,8 +455,12 @@ export class GameComponent implements OnInit, OnDestroy {
|
||||
this.waitingTimer = timer(0, 1000);
|
||||
this.waitingSub = this.waitingTimer.subscribe((t) => {
|
||||
if (this.waitCard) {
|
||||
this.verifyOpen();
|
||||
this.waitCard.bodyString = `${seconds - t}`;
|
||||
// If we have gotten down to -2, a connection was probably interrupted
|
||||
if (-1 > (seconds - t)) {
|
||||
this.waitingSub.unsubscribe();
|
||||
this.connectionInterrupted();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -485,15 +489,18 @@ export class GameComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
verifyOpen() {
|
||||
console.log('@AGG verify open');
|
||||
if (!this.gameService.isOpen()) {
|
||||
console.log('GameService socket not open');
|
||||
this.ngZone.run(() => {
|
||||
this.router.navigate(['/login']);
|
||||
});
|
||||
this.connectionInterrupted();
|
||||
}
|
||||
}
|
||||
|
||||
connectionInterrupted() {
|
||||
alert('Connection to game-service interrrupted. Re-directing to login page.');
|
||||
this.ngZone.run(() => {
|
||||
this.router.navigate(['/login']);
|
||||
});
|
||||
}
|
||||
|
||||
addBorder(x, y, w, h) {
|
||||
let shape: Shape = new Shape();
|
||||
shape.shadow = new Shadow(Obstacle.COLOR, 0, 0, 20);
|
||||
|
@ -67,7 +67,6 @@ public class PartyQueue {
|
||||
}
|
||||
|
||||
public int queuePosition() {
|
||||
int i = 0;
|
||||
int position = 1;
|
||||
for (QueuedClient c : PartyQueue.this.waitingPlayers) {
|
||||
if (this.equals(c))
|
||||
|
Loading…
Reference in New Issue
Block a user