mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Merge branch 'Story1124_Sparkline' into 'develop'
Fixing Ordering # Changes * Fixed ordering which was broken from a previous commit * Removed Sparkline as we could not get it working in time # Testing * Manual testlog only See merge request !65
This commit is contained in:
@@ -280,7 +280,6 @@ public class ServerToClientThread implements Runnable, Observer {
|
||||
currentByte = is.read();
|
||||
crcBuffer.write(currentByte);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.warn("Socket read failed", 1);
|
||||
}
|
||||
if (currentByte == -1) {
|
||||
|
||||
@@ -290,7 +290,7 @@ public class ClientYacht extends Observable {
|
||||
this.markRoundTime = markRoundTime;
|
||||
timeSinceLastMarkProperty.set(timeSinceLastMark);
|
||||
lastMarkRounded = mark;
|
||||
legNumber += 1;
|
||||
legNumber++;
|
||||
for (MarkRoundingListener listener : markRoundingListeners) {
|
||||
listener.notifyRounding(this, lastMarkRounded, legNumber);
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ public class ClientToServerThread implements Runnable {
|
||||
clientLog("Read byte failed", 1);
|
||||
}
|
||||
if (currentByte == -1) {
|
||||
throw new ByteReadException("InputStream reach end of stream");
|
||||
clientLog("InputStream reach end of stream", 1);
|
||||
}
|
||||
return currentByte;
|
||||
}
|
||||
|
||||
@@ -308,6 +308,7 @@ public class GameClient {
|
||||
raceState.getRaceTime() - roundingData.getTimeStamp()
|
||||
);
|
||||
}
|
||||
updatePlayerPositions();
|
||||
}
|
||||
|
||||
private void processRaceStatusUpdate(RaceStatusData data) {
|
||||
@@ -324,12 +325,11 @@ public class GameClient {
|
||||
ClientYacht clientYacht = allBoatsMap.get((int) boatData[0]);
|
||||
clientYacht.setEstimateTimeTillNextMark(raceState.getRaceTime() - boatData[1]);
|
||||
clientYacht.setEstimateTimeAtFinish(boatData[2]);
|
||||
int legNumber = (int) boatData[3];
|
||||
// int legNumber = (int) boatData[3];
|
||||
clientYacht.setBoatStatus((int) boatData[4]);
|
||||
if (legNumber != clientYacht.getLegNumber()) {
|
||||
clientYacht.setLegNumber(legNumber);
|
||||
updatePlayerPositions();
|
||||
}
|
||||
// if (legNumber != clientYacht.getLegNumber()) {
|
||||
// clientYacht.setLegNumber(legNumber);
|
||||
// }
|
||||
}
|
||||
|
||||
if (raceFinished) {
|
||||
|
||||
@@ -35,6 +35,7 @@ import javafx.scene.text.Text;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.StageStyle;
|
||||
import javafx.util.StringConverter;
|
||||
import seng302.gameServer.messages.BoatStatus;
|
||||
import seng302.model.ClientYacht;
|
||||
import seng302.model.RaceState;
|
||||
import seng302.model.mark.CompoundMark;
|
||||
@@ -94,9 +95,10 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
||||
importantAnnotations = new ImportantAnnotationsState();
|
||||
|
||||
//Formatting the y axis of the sparkline
|
||||
raceSparkLine.getYAxis().setRotate(180);
|
||||
raceSparkLine.getYAxis().setTickLabelRotation(180);
|
||||
raceSparkLine.getYAxis().setTranslateX(-5);
|
||||
// raceSparkLine.getYAxis().setRotate(180);
|
||||
// raceSparkLine.getYAxis().setTickLabelRotation(180);
|
||||
// raceSparkLine.getYAxis().setTranslateX(-5);
|
||||
raceSparkLine.visibleProperty().setValue(false);
|
||||
raceSparkLine.getYAxis().setAutoRanging(false);
|
||||
sparklineYAxis.setTickMarkVisible(false);
|
||||
|
||||
@@ -124,6 +126,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
||||
while (c.next()) {
|
||||
if (c.wasPermutated()) {
|
||||
updateOrder(raceState.getPlayerPositions());
|
||||
updateSparkLine();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -247,14 +250,14 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
||||
// Create a new data series for new yachts
|
||||
sparkLineCandidates
|
||||
.stream()
|
||||
.filter(yacht -> yacht.getPlacing() != null)
|
||||
.filter(yacht -> yacht.getPosition() != null)
|
||||
.forEach(yacht -> {
|
||||
Series<String, Double> yachtData = new Series<>();
|
||||
yachtData.setName(yacht.getSourceId().toString());
|
||||
yachtData.getData().add(
|
||||
new XYChart.Data<>(
|
||||
new Data<>(
|
||||
Integer.toString(yacht.getLegNumber()),
|
||||
1.0 + participants.size() - yacht.getPlacing()
|
||||
1.0 + participants.size() - yacht.getPosition()
|
||||
)
|
||||
);
|
||||
sparkLineData.add(yachtData);
|
||||
@@ -270,6 +273,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
||||
return -1;
|
||||
}
|
||||
});
|
||||
|
||||
// Adds the new data series to the sparkline (and set the colour of the series)
|
||||
Platform.runLater(() -> {
|
||||
sparkLineData
|
||||
@@ -411,7 +415,8 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
||||
|
||||
for (int i = 0; i < yachts.size(); i++) {
|
||||
// System.out.println("yacht == null " + String.valueOf(yacht == null));
|
||||
if (yachts.get(i).getBoatStatus() == 3) { // 3 is finish status
|
||||
if (yachts.get(i).getBoatStatus() == BoatStatus.FINISHED
|
||||
.getCode()) { // 3 is finish status
|
||||
Text textToAdd = new Text(i + 1 + ". " +
|
||||
yachts.get(i).getShortName() + " (Finished)");
|
||||
textToAdd.setFill(Paint.valueOf("#d3d3d3"));
|
||||
|
||||
@@ -38,7 +38,12 @@
|
||||
<Corner SeqID="3" CompoundMarkID="3" Rounding="SP" ZoneSize="3" />
|
||||
<Corner SeqID="4" CompoundMarkID="4" Rounding="PS" 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>
|
||||
<CourseLimit>
|
||||
<Limit SeqID="1" Lat="57.6739450" Lon="11.8417100" />
|
||||
|
||||
Reference in New Issue
Block a user