|
|
|
|
@ -59,7 +59,7 @@ public class StartController extends Controller implements Observer {
|
|
|
|
|
public void startRaceNoScaling() {
|
|
|
|
|
//startRace(1);
|
|
|
|
|
while(visualiserInput.getRaceStatus() == null);
|
|
|
|
|
countdownTimer(1);
|
|
|
|
|
countdownTimer();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void startRace(int raceScale){
|
|
|
|
|
@ -99,13 +99,12 @@ public class StartController extends Controller implements Observer {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Countdown timer until race starts. Use PRERACE_TIME to set countdown duration.
|
|
|
|
|
* @param scaleFactor factor to scale by
|
|
|
|
|
* Countdown timer until race starts.
|
|
|
|
|
*/
|
|
|
|
|
protected void countdownTimer(int scaleFactor) {
|
|
|
|
|
protected void countdownTimer() {
|
|
|
|
|
new AnimationTimer() {
|
|
|
|
|
long currentTime = System.currentTimeMillis();
|
|
|
|
|
long startTime = currentTime + (PRERACE_TIME/scaleFactor);
|
|
|
|
|
long startTime = currentTime + PRERACE_TIME;
|
|
|
|
|
DateFormat timerFormat = new SimpleDateFormat("'Race Clock:' -HH:mm:ss");
|
|
|
|
|
@Override
|
|
|
|
|
public void handle(long arg0) {
|
|
|
|
|
@ -121,7 +120,6 @@ public class StartController extends Controller implements Observer {
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
updateTime(timerFormat.format(currentTime));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
currentTime = System.currentTimeMillis();
|
|
|
|
|
}
|
|
|
|
|
@ -135,11 +133,7 @@ public class StartController extends Controller implements Observer {
|
|
|
|
|
new AnimationTimer() {
|
|
|
|
|
@Override
|
|
|
|
|
public void handle(long arg0) {
|
|
|
|
|
if (timeLeft > 0) {
|
|
|
|
|
raceClock.updateTime();
|
|
|
|
|
} else {
|
|
|
|
|
stop();
|
|
|
|
|
}
|
|
|
|
|
raceClock.updateTime();
|
|
|
|
|
}
|
|
|
|
|
}.start();
|
|
|
|
|
}
|
|
|
|
|
@ -169,8 +163,8 @@ public class StartController extends Controller implements Observer {
|
|
|
|
|
}
|
|
|
|
|
if (((StreamedCourse) o).hasReadCourse()) {
|
|
|
|
|
Platform.runLater(() -> {
|
|
|
|
|
setRaceClock();
|
|
|
|
|
while(visualiserInput.getRaceStatus() == null);
|
|
|
|
|
setRaceClock();
|
|
|
|
|
setStartingTime();
|
|
|
|
|
setCurrentTime();
|
|
|
|
|
});
|
|
|
|
|
|