diff --git a/src/main/java/seng302/model/ClientYacht.java b/src/main/java/seng302/model/ClientYacht.java index d70ff09e..3251862e 100644 --- a/src/main/java/seng302/model/ClientYacht.java +++ b/src/main/java/seng302/model/ClientYacht.java @@ -253,7 +253,7 @@ public class ClientYacht extends Observable { public void updateLocation(double lat, double lng, double heading, double velocity) { setLocation(lat, lng); this.heading = heading; -// this.currentVelocity = velocity; + this.currentVelocity = velocity; updateVelocityProperty(velocity); for (YachtLocationListener yll : locationListeners) { yll.notifyLocation(this, lat, lng, heading, sailIn, velocity); diff --git a/src/main/java/seng302/visualiser/GameView3D.java b/src/main/java/seng302/visualiser/GameView3D.java index cdcefafb..b3ba9e93 100644 --- a/src/main/java/seng302/visualiser/GameView3D.java +++ b/src/main/java/seng302/visualiser/GameView3D.java @@ -150,7 +150,7 @@ public class GameView3D { System.out.println(camera.getTranslateY()); System.out.println(camera.getTranslateZ()); camera.setTranslateZ(-80); - camera.setTranslateY(150); + camera.setTranslateY(170); Sphere red = new Sphere(1); red.setMaterial(new PhongMaterial(Color.RED)); red.setLayoutX(0); diff --git a/src/main/java/seng302/visualiser/controllers/RaceViewController.java b/src/main/java/seng302/visualiser/controllers/RaceViewController.java index 452b5823..f1a11f62 100644 --- a/src/main/java/seng302/visualiser/controllers/RaceViewController.java +++ b/src/main/java/seng302/visualiser/controllers/RaceViewController.java @@ -103,6 +103,8 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel private Label windDirectionLabel; @FXML private Label windSpeedLabel; + @FXML + private Label positionLabel, boatSpeedLabel, boatHeadingLabel; //Race Data private Map participants; @@ -119,6 +121,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel private ImportantAnnotationsState importantAnnotations; private Polyline windArrow = new WindArrow(Color.LIGHTGRAY); private ObservableList selectionComboBoxList = FXCollections.observableArrayList(); + private ClientYacht player; public void initialize() { Sounds.stopMusic(); @@ -181,6 +184,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel this.courseData = raceData; this.markers = raceData.getCompoundMarks(); this.raceState = raceState; + this.player = player; raceState.getPlayerPositions().addListener((ListChangeListener) c -> { while (c.next()) { @@ -434,6 +438,9 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel timer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { + Platform.runLater(() -> updatePosition()); + Platform.runLater(() -> updateBoatSpeed()); + Platform.runLater(() -> updateBoatHeading()); Platform.runLater(() -> updateRaceTime()); } }, 0, 1000); @@ -497,6 +504,43 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel } } + private void updatePosition() { + if (player.getPosition() == null) { + positionLabel.setText("Position:\n0"); + } else { + switch (player.getPosition()) { + case 1: + positionLabel.setText("Position:\n1st"); + break; + case 2: + positionLabel.setText("Position:\n2nd"); + break; + case 3: + positionLabel.setText("Position:\n3rd"); + break; + case 21: + positionLabel.setText("Position:\n21st"); + break; + case 22: + positionLabel.setText("Position:\n22nd"); + break; + case 23: + positionLabel.setText("Position:\n23rd"); + break; + default: + positionLabel.setText("Position:\n" + player.getPosition() + "th"); + } + } + } + + private void updateBoatSpeed() { + boatSpeedLabel.setText("Boat Speed:\n" + String.valueOf(player.getVelocityProperty().toString())); + } + + private void updateBoatHeading() { + boatHeadingLabel.setText("Boat Heading:\n" + String.valueOf(player.getHeading())); + } + /** * Updates the order of the yachts as from the StreamParser and sets them in the yacht order * section diff --git a/src/main/resources/css/RaceView.css b/src/main/resources/css/RaceView.css index f0f89d17..e135ba2d 100644 --- a/src/main/resources/css/RaceView.css +++ b/src/main/resources/css/RaceView.css @@ -26,6 +26,14 @@ } +#windGridPane { + -fx-background-color: rgba(255, 255, 255, 0.6); +} + +#windHolder { + +} + #chatSend { -fx-background-color: -fx-pp-front-color; -fx-text-fill: -fx-pp-theme-color; diff --git a/src/main/resources/views/RaceView.fxml b/src/main/resources/views/RaceView.fxml index b8767c03..159b8e48 100644 --- a/src/main/resources/views/RaceView.fxml +++ b/src/main/resources/views/RaceView.fxml @@ -104,32 +104,61 @@ - + - - + - - - + + + + + + + + + + + + + + + + + - +