|
|
|
|
@ -20,6 +20,8 @@ import seng302.VisualiserInput;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.net.Socket;
|
|
|
|
|
import java.net.URL;
|
|
|
|
|
import java.text.DateFormat;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Observable;
|
|
|
|
|
import java.util.Observer;
|
|
|
|
|
@ -38,10 +40,8 @@ public class StartController extends Controller implements Observer {
|
|
|
|
|
@FXML private TableColumn<Boat, String> boatCodeColumn;
|
|
|
|
|
@FXML private Label timeZoneTime;
|
|
|
|
|
@FXML private Label timer;
|
|
|
|
|
@FXML private int PRERACE_TIME = 15000;
|
|
|
|
|
@FXML private int PRERACE_TIME = 10;
|
|
|
|
|
|
|
|
|
|
@FXML Button oneMinButton;
|
|
|
|
|
@FXML Button fiveMinButton;
|
|
|
|
|
@FXML Button fifteenMinButton;
|
|
|
|
|
|
|
|
|
|
private RaceClock raceClock;
|
|
|
|
|
@ -51,20 +51,6 @@ public class StartController extends Controller implements Observer {
|
|
|
|
|
|
|
|
|
|
private VisualiserInput visualiserInput;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Begins the race with a scale factor of 15
|
|
|
|
|
*/
|
|
|
|
|
public void startRace1Min() {
|
|
|
|
|
startRace(15);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Begins the race with a scale factor of 3
|
|
|
|
|
*/
|
|
|
|
|
public void startRace5Min() {
|
|
|
|
|
startRace(3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Begins the race with a scale factor of 1
|
|
|
|
|
*/
|
|
|
|
|
@ -73,9 +59,6 @@ public class StartController extends Controller implements Observer {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void startRace(int raceScale){
|
|
|
|
|
|
|
|
|
|
oneMinButton.setDisable(true);
|
|
|
|
|
fiveMinButton.setDisable(true);
|
|
|
|
|
fifteenMinButton.setDisable(true);
|
|
|
|
|
countdownTimer(raceScale);
|
|
|
|
|
}
|
|
|
|
|
@ -118,10 +101,7 @@ public class StartController extends Controller implements Observer {
|
|
|
|
|
new AnimationTimer() {
|
|
|
|
|
long currentTime = System.currentTimeMillis();
|
|
|
|
|
long startTime = currentTime + (PRERACE_TIME/scaleFactor);
|
|
|
|
|
long minutes;
|
|
|
|
|
long currentTimeInSeconds;
|
|
|
|
|
long remainingSeconds;
|
|
|
|
|
long hours;
|
|
|
|
|
DateFormat timerFormat = new SimpleDateFormat("'Race Clock:' -HH:mm:ss");
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void handle(long arg0) {
|
|
|
|
|
@ -133,12 +113,7 @@ public class StartController extends Controller implements Observer {
|
|
|
|
|
startWrapper.setVisible(false);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
currentTimeInSeconds = (timeLeft*scaleFactor) / 1000;
|
|
|
|
|
minutes = currentTimeInSeconds / 60;
|
|
|
|
|
remainingSeconds = currentTimeInSeconds % 60;
|
|
|
|
|
hours = minutes / 60;
|
|
|
|
|
minutes = minutes % 60;
|
|
|
|
|
updateTime(String.format("Race Clock: -%02d:%02d:%02d", hours, minutes, remainingSeconds));
|
|
|
|
|
updateTime(timerFormat.format(currentTime));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
currentTime = System.currentTimeMillis();
|
|
|
|
|
|