|
|
|
|
@ -30,6 +30,7 @@ import visualiser.model.VisualiserRaceState;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.net.Socket;
|
|
|
|
|
import java.net.URL;
|
|
|
|
|
import java.time.temporal.ChronoUnit;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.logging.Level;
|
|
|
|
|
import java.util.logging.Logger;
|
|
|
|
|
@ -69,6 +70,12 @@ public class InGameLobbyController extends Controller {
|
|
|
|
|
@FXML
|
|
|
|
|
private Label countdownLabel;
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
private AnchorPane countdownTenPane;
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
private Label countdownTenText;
|
|
|
|
|
|
|
|
|
|
private Event game;
|
|
|
|
|
|
|
|
|
|
private View3D playerBoat;
|
|
|
|
|
@ -197,7 +204,6 @@ public class InGameLobbyController extends Controller {
|
|
|
|
|
private void initialiseRaceClock(VisualiserRaceState visualiserRace) {
|
|
|
|
|
//Remaining time.
|
|
|
|
|
initialiseRaceClockDuration(visualiserRace);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -225,6 +231,18 @@ public class InGameLobbyController extends Controller {
|
|
|
|
|
//Get the current race status.
|
|
|
|
|
RaceStatusEnum raceStatus = visualiserRaceEvent.getVisualiserRaceState().getRaceStatusEnum();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
long interval = ChronoUnit.MILLIS.between(visualiserRaceEvent.getVisualiserRaceState().getRaceClock().getCurrentTime(), visualiserRaceEvent.getVisualiserRaceState().getRaceClock().getStartingTime());
|
|
|
|
|
if(interval<=10000){
|
|
|
|
|
countdownLabel.setVisible(false);
|
|
|
|
|
countdownTenPane.setVisible(true);
|
|
|
|
|
countdownTenText.setVisible(true);
|
|
|
|
|
}
|
|
|
|
|
countdownText(interval);
|
|
|
|
|
} catch (Exception e){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//If the race has reached the preparatory phase, or has started...
|
|
|
|
|
if (raceStatus == RaceStatusEnum.PREPARATORY || raceStatus == RaceStatusEnum.STARTED) {
|
|
|
|
|
@ -234,6 +252,8 @@ public class InGameLobbyController extends Controller {
|
|
|
|
|
//Hide this, and display the race controller.
|
|
|
|
|
gameLobbyWrapper.setVisible(false);
|
|
|
|
|
visualiserRaceEvent.getVisualiserRaceState().getBoats().removeListener(lobbyUpdateListener);
|
|
|
|
|
countdownTenPane.setVisible(false);
|
|
|
|
|
countdownLabel.setVisible(true);
|
|
|
|
|
parent.beginRace(visualiserRaceEvent, controllerClient, isHost);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -294,4 +314,33 @@ public class InGameLobbyController extends Controller {
|
|
|
|
|
System.out.println("Empty race user pane pressed. Joining racers");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void countdownText(long interval){
|
|
|
|
|
|
|
|
|
|
if (interval <=5000){
|
|
|
|
|
countdownTenText.setText("5");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (interval <=6000){
|
|
|
|
|
countdownTenText.setText("6");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (interval <=7000){
|
|
|
|
|
countdownTenText.setText("7");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (interval <=8000){
|
|
|
|
|
countdownTenText.setText("8");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (interval <=9000){
|
|
|
|
|
countdownTenText.setText("9");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (interval <=10000){
|
|
|
|
|
countdownTenText.setText("10");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|