Skip to content

Commit

Permalink
Disable 'Ready' button when the client detects all players ready.
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-bstein committed Dec 13, 2023
1 parent 869850b commit bb9fdf2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ <h3><strong>Are you ready?</strong></h3>
<div class="d-flex align-items-center justify-content-center" *ngIf="!isDoubleChecking">
<ng-container *ngIf="ctx.game.requireSynchronizedStart">
<button *ngIf="isConnectedToGameHub; else connectingToHub" btnCheckbox class="btn btn-lg mr-4"
[disabled]="isReadyingUp || !isConnectedToGameHub || playerReadyPct == 100"
[class.btn-outline-success]="!ctx.player.isReady" [class.btn-danger]="ctx.player.isReady"
[class.btn-secondary]="isReadyingUp" [(ngModel)]="ctx.player.isReady"
(click)="handleReadyUpdated(ctx.player)" [disabled]="isReadyingUp">
[class.btn-secondary]="isReadyingUp" (click)="handleReadyUpdated(ctx.player)">
<span>{{ ctx.player.isReady ? "Cancel - I'm not ready" : "I'm ready!" }}</span>
</button>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export class SessionStartControlsComponent implements OnInit {

protected async handleReadyUpdated(player: Player) {
this.isReadyingUp = true;
player.isReady = !player.isReady;
this.logService.logInfo(`Player ${player.id} (user ${player.userId}) updating ready (${player.isReady})...`);
await firstValueFrom(this.syncStartService.updatePlayerReadyState(player.id, { isReady: player.isReady }));
this.logService.logInfo(`Player ${player.id} (user ${player.userId}) is now ${player.isReady ? "" : "NOT "}ready.`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { AuthService, AuthTokenState } from '../utility/auth.service';
import { UserService } from '../api/user.service';
import { HubPlayer, Player, TimeWindow } from '../api/player-models';
import { LogService } from './log.service';
import { LocalStorageService } from './local-storage.service';
import { ExternalGameService } from './external-game.service';

@Injectable({ providedIn: 'root' })
Expand Down

0 comments on commit bb9fdf2

Please sign in to comment.