game timer: Add chess-style buffer time option (#10598)

* UI Changes

* Add new buffer time options

* Main functionality

* Final implementation

Also added player UI for when they are using their buffer time (timer turns green)
This commit is contained in:
Alexander Novotny 2023-07-28 22:05:21 -04:00 committed by GitHub
parent b7543af939
commit 519b3988be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 273 additions and 16 deletions

View file

@ -47,6 +47,7 @@ public class PlayerView implements Serializable {
private final List<UUID> attachments = new ArrayList<>();
private final int statesSavedSize;
private final int priorityTimeLeft;
private final int bufferTimeLeft;
private final boolean passedTurn; // F4
private final boolean passedUntilEndOfTurn; // F5
private final boolean passedUntilNextMain; // F6
@ -74,6 +75,7 @@ public class PlayerView implements Serializable {
this.isActive = (player.getId().equals(state.getActivePlayerId()));
this.hasPriority = player.getId().equals(state.getPriorityPlayerId());
this.priorityTimeLeft = player.getPriorityTimeLeft();
this.bufferTimeLeft = player.getBufferTimeLeft();
this.timerActive = (this.hasPriority && player.isGameUnderControl())
|| (player.getPlayersUnderYourControl().contains(state.getPriorityPlayerId()))
|| player.getId().equals(game.getState().getChoosingPlayerId());
@ -275,6 +277,10 @@ public class PlayerView implements Serializable {
return priorityTimeLeft;
}
public int getBufferTimeLeft() {
return bufferTimeLeft;
}
public boolean hasPriority() {
return hasPriority;
}