mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
implemented race finish functionality, finish screen not loading properly yet #story[1124]
This commit is contained in:
@@ -155,6 +155,17 @@ public class GameClient {
|
||||
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() {
|
||||
while (socketThread.getPacketQueue().peek() != null) {
|
||||
StreamPacket packet = socketThread.getPacketQueue().poll();
|
||||
@@ -257,6 +268,17 @@ public class GameClient {
|
||||
private void processRaceStatusUpdate(RaceStatusData data) {
|
||||
if (allXMLReceived()) {
|
||||
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()) {
|
||||
ClientYacht clientYacht = allBoatsMap.get((int) boatData[0]);
|
||||
clientYacht.setEstimateTimeTillNextMark(raceState.getRaceTime() - boatData[1]);
|
||||
|
||||
Reference in New Issue
Block a user