Everything works, don't ask questions
#story[782]
This commit is contained in:
@@ -59,7 +59,7 @@ public class StartController extends Controller implements Observer {
|
|||||||
public void startRaceNoScaling() {
|
public void startRaceNoScaling() {
|
||||||
//startRace(1);
|
//startRace(1);
|
||||||
while(visualiserInput.getRaceStatus() == null);
|
while(visualiserInput.getRaceStatus() == null);
|
||||||
countdownTimer(1);
|
countdownTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startRace(int raceScale){
|
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.
|
* Countdown timer until race starts.
|
||||||
* @param scaleFactor factor to scale by
|
|
||||||
*/
|
*/
|
||||||
protected void countdownTimer(int scaleFactor) {
|
protected void countdownTimer() {
|
||||||
new AnimationTimer() {
|
new AnimationTimer() {
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
long startTime = currentTime + (PRERACE_TIME/scaleFactor);
|
long startTime = currentTime + PRERACE_TIME;
|
||||||
DateFormat timerFormat = new SimpleDateFormat("'Race Clock:' -HH:mm:ss");
|
DateFormat timerFormat = new SimpleDateFormat("'Race Clock:' -HH:mm:ss");
|
||||||
@Override
|
@Override
|
||||||
public void handle(long arg0) {
|
public void handle(long arg0) {
|
||||||
@@ -121,7 +120,6 @@ public class StartController extends Controller implements Observer {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
updateTime(timerFormat.format(currentTime));
|
updateTime(timerFormat.format(currentTime));
|
||||||
|
|
||||||
}
|
}
|
||||||
currentTime = System.currentTimeMillis();
|
currentTime = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
@@ -135,11 +133,7 @@ public class StartController extends Controller implements Observer {
|
|||||||
new AnimationTimer() {
|
new AnimationTimer() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(long arg0) {
|
public void handle(long arg0) {
|
||||||
if (timeLeft > 0) {
|
|
||||||
raceClock.updateTime();
|
raceClock.updateTime();
|
||||||
} else {
|
|
||||||
stop();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
@@ -169,8 +163,8 @@ public class StartController extends Controller implements Observer {
|
|||||||
}
|
}
|
||||||
if (((StreamedCourse) o).hasReadCourse()) {
|
if (((StreamedCourse) o).hasReadCourse()) {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
setRaceClock();
|
|
||||||
while(visualiserInput.getRaceStatus() == null);
|
while(visualiserInput.getRaceStatus() == null);
|
||||||
|
setRaceClock();
|
||||||
setStartingTime();
|
setStartingTime();
|
||||||
setCurrentTime();
|
setCurrentTime();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user