diff --git a/OOP_2B1_Project/src/windowInterface/MyInterface.java b/OOP_2B1_Project/src/windowInterface/MyInterface.java index f7185c0..0ffcd00 100644 --- a/OOP_2B1_Project/src/windowInterface/MyInterface.java +++ b/OOP_2B1_Project/src/windowInterface/MyInterface.java @@ -180,7 +180,7 @@ public class MyInterface extends JFrame { game.setDefaultSetup(); if (timerManager == null) timerManager = new TimerManager(whiteTimerLabel, blackTimerLabel, () -> gameOverByTimeout(), time); - timerManager.reset(); + timerManager.reset(time); timerManager.start(true); // white starts } public void clickButtonAdder() { @@ -236,7 +236,7 @@ public class MyInterface extends JFrame { game.setAutoPlayerDepth(depth); if (timerManager == null) timerManager = new TimerManager(whiteTimerLabel, blackTimerLabel, () -> gameOverByTimeout(), time); - timerManager.reset(); + timerManager.reset(time); timerManager.start(game.getTurnColor()); game.start(); // this.repaint(); diff --git a/OOP_2B1_Project/src/windowInterface/TimerManager.java b/OOP_2B1_Project/src/windowInterface/TimerManager.java index bd2cab6..de66404 100644 --- a/OOP_2B1_Project/src/windowInterface/TimerManager.java +++ b/OOP_2B1_Project/src/windowInterface/TimerManager.java @@ -60,7 +60,9 @@ public class TimerManager { timer.stop(); } -public void reset() { +public void reset(int time) { + whiteSeconds = time; + blackSeconds = time; updateLabel(whiteLabel, whiteSeconds); updateLabel(blackLabel, blackSeconds); }