forked from External/mage
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:
parent
b7543af939
commit
519b3988be
24 changed files with 273 additions and 16 deletions
|
|
@ -103,10 +103,14 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
});
|
||||
final PriorityTimer pt = timer;
|
||||
timer.setTaskOnTick(() -> {
|
||||
int priorityTimeValue = pt.getCount();
|
||||
int priorityTimeValue = pt.getCount() + pt.getBufferCount();
|
||||
String text = getPriorityTimeLeftString(priorityTimeValue);
|
||||
|
||||
PlayerPanelExt.this.avatar.setTopText(text);
|
||||
PlayerPanelExt.this.avatar.setTopTextColor(pt.getBufferCount() > 0 ? Color.GREEN : null);
|
||||
PlayerPanelExt.this.timerLabel.setText(text);
|
||||
PlayerPanelExt.this.timerLabel
|
||||
.setForeground(pt.getBufferCount() > 0 ? Color.GREEN.darker().darker() : Color.BLACK);
|
||||
PlayerPanelExt.this.avatar.repaint();
|
||||
});
|
||||
timer.init(gameId);
|
||||
|
|
@ -304,8 +308,13 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
if (player.getPriorityTimeLeft() != Integer.MAX_VALUE) {
|
||||
String priorityTimeValue = getPriorityTimeLeftString(player);
|
||||
this.timer.setCount(player.getPriorityTimeLeft());
|
||||
this.timer.setBufferCount(player.getBufferTimeLeft());
|
||||
this.avatar.setTopText(priorityTimeValue);
|
||||
this.timerLabel.setText(priorityTimeValue);
|
||||
|
||||
this.avatar.setTopTextColor(player.getBufferTimeLeft() > 0 ? Color.GREEN : null);
|
||||
this.timerLabel
|
||||
.setForeground(player.getBufferTimeLeft() > 0 ? Color.GREEN.darker().darker() : Color.BLACK);
|
||||
}
|
||||
if (player.isTimerActive()) {
|
||||
this.timer.resume();
|
||||
|
|
@ -396,7 +405,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
private String getPriorityTimeLeftString(PlayerView player) {
|
||||
int priorityTimeLeft = player.getPriorityTimeLeft();
|
||||
int priorityTimeLeft = player.getPriorityTimeLeft() + player.getBufferTimeLeft();
|
||||
return getPriorityTimeLeftString(priorityTimeLeft);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue