mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Merge remote-tracking branch 'origin/develop' into issue47_disconnect_crash_rebranch
# Conflicts: # src/main/java/seng302/gameServer/ServerToClientThread.java # src/main/java/seng302/visualiser/controllers/RaceViewController.java
This commit is contained in:
@@ -290,7 +290,7 @@ public class ClientYacht extends Observable {
|
|||||||
this.markRoundTime = markRoundTime;
|
this.markRoundTime = markRoundTime;
|
||||||
timeSinceLastMarkProperty.set(timeSinceLastMark);
|
timeSinceLastMarkProperty.set(timeSinceLastMark);
|
||||||
lastMarkRounded = mark;
|
lastMarkRounded = mark;
|
||||||
legNumber += 1;
|
legNumber++;
|
||||||
for (MarkRoundingListener listener : markRoundingListeners) {
|
for (MarkRoundingListener listener : markRoundingListeners) {
|
||||||
listener.notifyRounding(this, lastMarkRounded, legNumber);
|
listener.notifyRounding(this, lastMarkRounded, legNumber);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -338,7 +338,7 @@ public class ClientToServerThread implements Runnable {
|
|||||||
closeSocket();
|
closeSocket();
|
||||||
}
|
}
|
||||||
if (currentByte == -1) {
|
if (currentByte == -1) {
|
||||||
throw new ByteReadException("InputStream reach end of stream");
|
clientLog("InputStream reach end of stream", 1);
|
||||||
}
|
}
|
||||||
return currentByte;
|
return currentByte;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -325,6 +325,7 @@ public class GameClient {
|
|||||||
raceState.getRaceTime() - roundingData.getTimeStamp()
|
raceState.getRaceTime() - roundingData.getTimeStamp()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
updatePlayerPositions();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processRaceStatusUpdate(RaceStatusData data) {
|
private void processRaceStatusUpdate(RaceStatusData data) {
|
||||||
@@ -341,12 +342,11 @@ public class GameClient {
|
|||||||
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]);
|
||||||
clientYacht.setEstimateTimeAtFinish(boatData[2]);
|
clientYacht.setEstimateTimeAtFinish(boatData[2]);
|
||||||
int legNumber = (int) boatData[3];
|
// int legNumber = (int) boatData[3];
|
||||||
clientYacht.setBoatStatus((int) boatData[4]);
|
clientYacht.setBoatStatus((int) boatData[4]);
|
||||||
if (legNumber != clientYacht.getLegNumber()) {
|
// if (legNumber != clientYacht.getLegNumber()) {
|
||||||
clientYacht.setLegNumber(legNumber);
|
// clientYacht.setLegNumber(legNumber);
|
||||||
updatePlayerPositions();
|
// }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (raceFinished) {
|
if (raceFinished) {
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import javafx.scene.text.Text;
|
|||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import javafx.stage.StageStyle;
|
import javafx.stage.StageStyle;
|
||||||
import javafx.util.StringConverter;
|
import javafx.util.StringConverter;
|
||||||
|
import seng302.gameServer.messages.BoatStatus;
|
||||||
import seng302.model.ClientYacht;
|
import seng302.model.ClientYacht;
|
||||||
import seng302.model.RaceState;
|
import seng302.model.RaceState;
|
||||||
import seng302.model.mark.CompoundMark;
|
import seng302.model.mark.CompoundMark;
|
||||||
@@ -94,9 +95,10 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
importantAnnotations = new ImportantAnnotationsState();
|
importantAnnotations = new ImportantAnnotationsState();
|
||||||
|
|
||||||
//Formatting the y axis of the sparkline
|
//Formatting the y axis of the sparkline
|
||||||
raceSparkLine.getYAxis().setRotate(180);
|
// raceSparkLine.getYAxis().setRotate(180);
|
||||||
raceSparkLine.getYAxis().setTickLabelRotation(180);
|
// raceSparkLine.getYAxis().setTickLabelRotation(180);
|
||||||
raceSparkLine.getYAxis().setTranslateX(-5);
|
// raceSparkLine.getYAxis().setTranslateX(-5);
|
||||||
|
raceSparkLine.visibleProperty().setValue(false);
|
||||||
raceSparkLine.getYAxis().setAutoRanging(false);
|
raceSparkLine.getYAxis().setAutoRanging(false);
|
||||||
sparklineYAxis.setTickMarkVisible(false);
|
sparklineYAxis.setTickMarkVisible(false);
|
||||||
|
|
||||||
@@ -124,6 +126,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
while (c.next()) {
|
while (c.next()) {
|
||||||
if (c.wasPermutated()) {
|
if (c.wasPermutated()) {
|
||||||
updateOrder(raceState.getPlayerPositions());
|
updateOrder(raceState.getPlayerPositions());
|
||||||
|
updateSparkLine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -247,14 +250,14 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
// Create a new data series for new yachts
|
// Create a new data series for new yachts
|
||||||
sparkLineCandidates
|
sparkLineCandidates
|
||||||
.stream()
|
.stream()
|
||||||
.filter(yacht -> yacht.getPlacing() != null)
|
.filter(yacht -> yacht.getPosition() != null)
|
||||||
.forEach(yacht -> {
|
.forEach(yacht -> {
|
||||||
Series<String, Double> yachtData = new Series<>();
|
Series<String, Double> yachtData = new Series<>();
|
||||||
yachtData.setName(yacht.getSourceId().toString());
|
yachtData.setName(yacht.getSourceId().toString());
|
||||||
yachtData.getData().add(
|
yachtData.getData().add(
|
||||||
new XYChart.Data<>(
|
new Data<>(
|
||||||
Integer.toString(yacht.getLegNumber()),
|
Integer.toString(yacht.getLegNumber()),
|
||||||
1.0 + participants.size() - yacht.getPlacing()
|
1.0 + participants.size() - yacht.getPosition()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
sparkLineData.add(yachtData);
|
sparkLineData.add(yachtData);
|
||||||
@@ -270,6 +273,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Adds the new data series to the sparkline (and set the colour of the series)
|
// Adds the new data series to the sparkline (and set the colour of the series)
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
sparkLineData
|
sparkLineData
|
||||||
@@ -410,7 +414,9 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
List<Text> vboxEntries = new ArrayList<>();
|
List<Text> vboxEntries = new ArrayList<>();
|
||||||
|
|
||||||
for (int i = 0; i < yachts.size(); i++) {
|
for (int i = 0; i < yachts.size(); i++) {
|
||||||
if (yachts.get(i).getBoatStatus() == 3) { // 3 is finish status
|
// System.out.println("yacht == null " + String.valueOf(yacht == null));
|
||||||
|
if (yachts.get(i).getBoatStatus() == BoatStatus.FINISHED
|
||||||
|
.getCode()) { // 3 is finish status
|
||||||
Text textToAdd = new Text(i + 1 + ". " +
|
Text textToAdd = new Text(i + 1 + ". " +
|
||||||
yachts.get(i).getShortName() + " (Finished)");
|
yachts.get(i).getShortName() + " (Finished)");
|
||||||
textToAdd.setFill(Paint.valueOf("#d3d3d3"));
|
textToAdd.setFill(Paint.valueOf("#d3d3d3"));
|
||||||
|
|||||||
@@ -38,7 +38,12 @@
|
|||||||
<Corner SeqID="3" CompoundMarkID="3" Rounding="SP" ZoneSize="3" />
|
<Corner SeqID="3" CompoundMarkID="3" Rounding="SP" ZoneSize="3" />
|
||||||
<Corner SeqID="4" CompoundMarkID="4" Rounding="PS" ZoneSize="3" />
|
<Corner SeqID="4" CompoundMarkID="4" Rounding="PS" ZoneSize="3" />
|
||||||
<Corner SeqID="5" CompoundMarkID="3" Rounding="SP" ZoneSize="3" />
|
<Corner SeqID="5" CompoundMarkID="3" Rounding="SP" ZoneSize="3" />
|
||||||
<Corner SeqID="6" CompoundMarkID="5" Rounding="PS" ZoneSize="3" />
|
<Corner SeqID="6" CompoundMarkID="4" Rounding="PS" ZoneSize="3" />
|
||||||
|
<Corner SeqID="7" CompoundMarkID="3" Rounding="SP" ZoneSize="3" />
|
||||||
|
<Corner SeqID="8" CompoundMarkID="4" Rounding="PS" ZoneSize="3" />
|
||||||
|
<Corner SeqID="9" CompoundMarkID="3" Rounding="SP" ZoneSize="3" />
|
||||||
|
<Corner SeqID="10" CompoundMarkID="4" Rounding="PS" ZoneSize="3" />
|
||||||
|
<Corner SeqID="11" CompoundMarkID="5" Rounding="PS" ZoneSize="3" />
|
||||||
</CompoundMarkSequence>
|
</CompoundMarkSequence>
|
||||||
<CourseLimit>
|
<CourseLimit>
|
||||||
<Limit SeqID="1" Lat="57.6739450" Lon="11.8417100" />
|
<Limit SeqID="1" Lat="57.6739450" Lon="11.8417100" />
|
||||||
|
|||||||
Reference in New Issue
Block a user