Added a check if race started, then start screen switches to race view automatically.

#story[572]
This commit is contained in:
Zhi You Tan
2017-05-04 14:32:06 +12:00
parent 3080c1bf27
commit ac3f3bfd55
2 changed files with 4 additions and 1 deletions
@@ -89,6 +89,10 @@ public class Controller implements Initializable {
@Override @Override
public void run() { public void run() {
Platform.runLater(() -> { Platform.runLater(() -> {
if (StreamParser.isRaceStarted()) {
switchToRaceView();
timer.cancel();
}
if (StreamParser.isRaceFinished()) { if (StreamParser.isRaceFinished()) {
realTime.setText(StreamParser.getCurrentTimeString()); realTime.setText(StreamParser.getCurrentTimeString());
timeTillLive.setTextFill(Color.RED); timeTillLive.setTextFill(Color.RED);
@@ -309,7 +309,6 @@ public class RaceViewController extends Thread{
// } // }
for (Yacht boat : StreamParser.getBoatsPos().values()) { for (Yacht boat : StreamParser.getBoatsPos().values()) {
System.out.println(boat.getBoatStatus());
if (boat.getBoatStatus() == 3) { // 3 is finish status if (boat.getBoatStatus() == 3) { // 3 is finish status
positionVbox.getChildren().add(new Text(boat.getPosition() + ". " + positionVbox.getChildren().add(new Text(boat.getPosition() + ". " +
boat.getShortName() + " (Finished)")); boat.getShortName() + " (Finished)"));