Timer :)
This commit is contained in:
parent
0b6afd2ef2
commit
08c842e90e
|
|
@ -229,7 +229,12 @@ public class MyInterface extends JFrame {
|
|||
|
||||
panelDraw.setGame(game);
|
||||
int depth = askDifficulty();
|
||||
int time = askTime();
|
||||
game.setAutoPlayerDepth(depth);
|
||||
if (timerManager == null)
|
||||
timerManager = new TimerManager(whiteTimerLabel, blackTimerLabel, () -> gameOverByTimeout(), time);
|
||||
timerManager.reset();
|
||||
timerManager.start(game.getTurnColor());
|
||||
game.start();
|
||||
// this.repaint();
|
||||
// update(game.getTurnNumber(), game.getTurnColor());
|
||||
|
|
@ -339,6 +344,6 @@ public class MyInterface extends JFrame {
|
|||
|
||||
public void gameOverByTimeout() {
|
||||
// disable board input, show message
|
||||
JOptionPane.showMessageDialog(this, "Time's up! The game is over.");
|
||||
// JOptionPane.showMessageDialog(this, "Time's up! The game is over.");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue