Timer :)
This commit is contained in:
parent
0b6afd2ef2
commit
08c842e90e
|
|
@ -229,7 +229,12 @@ public class MyInterface extends JFrame {
|
||||||
|
|
||||||
panelDraw.setGame(game);
|
panelDraw.setGame(game);
|
||||||
int depth = askDifficulty();
|
int depth = askDifficulty();
|
||||||
|
int time = askTime();
|
||||||
game.setAutoPlayerDepth(depth);
|
game.setAutoPlayerDepth(depth);
|
||||||
|
if (timerManager == null)
|
||||||
|
timerManager = new TimerManager(whiteTimerLabel, blackTimerLabel, () -> gameOverByTimeout(), time);
|
||||||
|
timerManager.reset();
|
||||||
|
timerManager.start(game.getTurnColor());
|
||||||
game.start();
|
game.start();
|
||||||
// this.repaint();
|
// this.repaint();
|
||||||
// update(game.getTurnNumber(), game.getTurnColor());
|
// update(game.getTurnNumber(), game.getTurnColor());
|
||||||
|
|
@ -339,6 +344,6 @@ public class MyInterface extends JFrame {
|
||||||
|
|
||||||
public void gameOverByTimeout() {
|
public void gameOverByTimeout() {
|
||||||
// disable board input, show message
|
// 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