mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
implemented race finish functionality, finish screen not loading properly yet #story[1124]
This commit is contained in:
@@ -70,6 +70,7 @@ public class ClientYacht extends Observable {
|
|||||||
this.location = new GeoPoint(57.670341, 11.826856);
|
this.location = new GeoPoint(57.670341, 11.826856);
|
||||||
this.heading = 120.0; //In degrees
|
this.heading = 120.0; //In degrees
|
||||||
this.currentVelocity = 0d;
|
this.currentVelocity = 0d;
|
||||||
|
this.boatStatus = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -155,6 +155,17 @@ public class GameClient {
|
|||||||
raceView.loadRace(allBoatsMap, courseData, raceState, player);
|
raceView.loadRace(allBoatsMap, courseData, raceState, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadFinishScreenView() {
|
||||||
|
FXMLLoader fxmlLoader = new FXMLLoader(
|
||||||
|
getClass().getResource("/views/FinishScreenView.fxml"));
|
||||||
|
try {
|
||||||
|
holderPane.getChildren().clear();
|
||||||
|
holderPane.getChildren().add(fxmlLoader.load());
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void parsePackets() {
|
private void parsePackets() {
|
||||||
while (socketThread.getPacketQueue().peek() != null) {
|
while (socketThread.getPacketQueue().peek() != null) {
|
||||||
StreamPacket packet = socketThread.getPacketQueue().poll();
|
StreamPacket packet = socketThread.getPacketQueue().poll();
|
||||||
@@ -257,6 +268,17 @@ public class GameClient {
|
|||||||
private void processRaceStatusUpdate(RaceStatusData data) {
|
private void processRaceStatusUpdate(RaceStatusData data) {
|
||||||
if (allXMLReceived()) {
|
if (allXMLReceived()) {
|
||||||
raceState.updateState(data);
|
raceState.updateState(data);
|
||||||
|
|
||||||
|
boolean raceFinished = true;
|
||||||
|
for (ClientYacht yacht : allBoatsMap.values()) {
|
||||||
|
if (yacht.getBoatStatus() != 3) {
|
||||||
|
raceFinished = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (raceFinished == true) {
|
||||||
|
loadFinishScreenView();
|
||||||
|
}
|
||||||
|
|
||||||
for (long[] boatData : data.getBoatData()) {
|
for (long[] boatData : data.getBoatData()) {
|
||||||
ClientYacht clientYacht = allBoatsMap.get((int) boatData[0]);
|
ClientYacht clientYacht = allBoatsMap.get((int) boatData[0]);
|
||||||
clientYacht.setEstimateTimeTillNextMark(raceState.getRaceTime() - boatData[1]);
|
clientYacht.setEstimateTimeTillNextMark(raceState.getRaceTime() - boatData[1]);
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
private GameView gameView;
|
private GameView gameView;
|
||||||
private RaceState raceState;
|
private RaceState raceState;
|
||||||
|
|
||||||
private Timeline timerTimeline;
|
|
||||||
private Timer timer = new Timer();
|
private Timer timer = new Timer();
|
||||||
private List<Series<String, Double>> sparkLineData = new ArrayList<>();
|
private List<Series<String, Double>> sparkLineData = new ArrayList<>();
|
||||||
private ImportantAnnotationsState importantAnnotations;
|
private ImportantAnnotationsState importantAnnotations;
|
||||||
@@ -396,7 +395,6 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
textToAdd.setStyle("");
|
textToAdd.setStyle("");
|
||||||
vboxEntries.add(textToAdd);
|
vboxEntries.add(textToAdd);
|
||||||
}
|
}
|
||||||
// System.out.println("finished a loop :))))))))))))");
|
|
||||||
}
|
}
|
||||||
Platform.runLater(() ->
|
Platform.runLater(() ->
|
||||||
positionVbox.getChildren().setAll(vboxEntries)
|
positionVbox.getChildren().setAll(vboxEntries)
|
||||||
|
|||||||
Reference in New Issue
Block a user