Skip to content

Commit e9c6486

Browse files
committed
fix(game/mp/slime): hide timer when disconnected
1 parent e341e64 commit e9c6486

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

‎scripts/game/mp/slime/SlimeGame.svelte.ts‎

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -437,17 +437,20 @@ export class GameDrawer {
437437
let status: string | undefined
438438
if (!this.game.room) {
439439
status = 'Disconnected'
440-
} else if (!this.game.localClient.active) {
441-
status = !this.game.status
442-
? 'Spectating'
443-
: `${this.game.status === GameStatus.WIN !== this.game.flipP1 ? 'Left' : 'Right'} wins the round!`
444-
} else if (this.game.status === GameStatus.WIN) {
445-
status = 'You won the round!'
446-
} else if (this.game.status === GameStatus.LOSS) {
447-
status = 'You lost the round!'
440+
} else {
441+
if (!this.game.localClient.active) {
442+
status = !this.game.status
443+
? 'Spectating'
444+
: `${this.game.status === GameStatus.WIN !== this.game.flipP1 ? 'Left' : 'Right'} wins the round!`
445+
} else if (this.game.status === GameStatus.WIN) {
446+
status = 'You won the round!'
447+
} else if (this.game.status === GameStatus.LOSS) {
448+
status = 'You lost the round!'
449+
}
450+
const statusTime = `${this.game.roundPlayers.length && !this.game.status ? ((Date.now() - this.game.roundStart) / 1000).toFixed(1) + '/' : ''}${((Date.now() - this.game.gameStart) / 1000).toFixed(1)}`
451+
status = status ? `${status} (${statusTime})` : statusTime
448452
}
449-
const statusTime = `${this.game.roundPlayers.length && !this.game.status ? ((Date.now() - this.game.roundStart) / 1000).toFixed(1) + '/' : ''}${((Date.now() - this.game.gameStart) / 1000).toFixed(1)}`
450-
this.drawStatus(ctx, W, H, status ? `${status} (${statusTime})` : statusTime)
453+
this.drawStatus(ctx, W, H, status)
451454
this.drawFPS(ctx, W, H)
452455
}
453456

0 commit comments

Comments
 (0)