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

@ -119,6 +119,7 @@ public abstract class PlayerImpl implements Player, Serializable {
protected int turns;
protected int storedBookmark = -1;
protected int priorityTimeLeft = Integer.MAX_VALUE;
protected int bufferTimeLeft = 0;
// conceded or connection lost game
protected boolean left;
@ -275,6 +276,7 @@ public abstract class PlayerImpl implements Player, Serializable {
this.justActivatedType = player.justActivatedType;
this.priorityTimeLeft = player.getPriorityTimeLeft();
this.bufferTimeLeft = player.getBufferTimeLeft();
this.reachedNextTurnAfterLeaving = player.reachedNextTurnAfterLeaving;
this.castSourceIdWithAlternateMana.addAll(player.getCastSourceIdWithAlternateMana());
@ -4454,6 +4456,16 @@ public abstract class PlayerImpl implements Player, Serializable {
return priorityTimeLeft;
}
@Override
public void setBufferTimeLeft(int timeLeft) {
bufferTimeLeft = timeLeft;
}
@Override
public int getBufferTimeLeft() {
return bufferTimeLeft;
}
@Override
public boolean hasQuit() {
return quit;