Added empty data sources, to be used by VisualiserRace.
Created FrameRateTracker which can be used to track framerate. Updated RequestToJoinEnum and JoinAcceptanceEnum to match the agreed connection API. Added AssignPlayerBoat message, which is used internally on the client to assign the player a source ID once they have connected. Fixed some race conditions in the MessageRouter. Updated ConnectionAcceptor.CheckClientConnection to wait slightly longer before removing connection (there was a slight race condition before). Race no longer has a reference to LatestMessages. LatestMessages no longer has specific messages types in it. Created RaceState class, which contains the state that is shared between VisualiserRaceState and MockRaceState (currently only used on visualiser). Split VisualiserRace into VisualiserRaceState and VisualiserRaceService. Added the VisualiserRace commands (BoatLocatonCommand, RaceStatusCommand, etc...). Slightly increased the preferred width of race.fxml table columns. issues #27 #37 #35 #story[1095]
This commit is contained in:
@@ -174,28 +174,33 @@ public class VisualiserBoat extends Boat {
|
||||
*/
|
||||
public String getTimeToNextMarkFormatted(ZonedDateTime currentTime) {
|
||||
|
||||
//Calculate time delta.
|
||||
Duration timeUntil = Duration.between(currentTime, getEstimatedTimeAtNextMark());
|
||||
if (getTimeAtLastMark() != null) {
|
||||
//Calculate time delta.
|
||||
Duration timeUntil = Duration.between(currentTime, getEstimatedTimeAtNextMark());
|
||||
|
||||
//Convert to seconds.
|
||||
long secondsUntil = timeUntil.getSeconds();
|
||||
//Convert to seconds.
|
||||
long secondsUntil = timeUntil.getSeconds();
|
||||
|
||||
//This means the estimated time is in the past, or not racing.
|
||||
if ((secondsUntil < 0) || (getStatus() != BoatStatusEnum.RACING)) {
|
||||
return " -";
|
||||
}
|
||||
//This means the estimated time is in the past, or not racing.
|
||||
if ((secondsUntil < 0) || (getStatus() != BoatStatusEnum.RACING)) {
|
||||
return " -";
|
||||
}
|
||||
|
||||
|
||||
if (secondsUntil <= 60) {
|
||||
//If less than 1 minute, display seconds only.
|
||||
return " " + secondsUntil + "s";
|
||||
if (secondsUntil <= 60) {
|
||||
//If less than 1 minute, display seconds only.
|
||||
return " " + secondsUntil + "s";
|
||||
|
||||
} else {
|
||||
//Otherwise display minutes and seconds.
|
||||
long seconds = secondsUntil % 60;
|
||||
long minutes = (secondsUntil - seconds) / 60;
|
||||
return String.format(" %dm %ds", minutes, seconds);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
//Otherwise display minutes and seconds.
|
||||
long seconds = secondsUntil % 60;
|
||||
long minutes = (secondsUntil - seconds) / 60;
|
||||
return String.format(" %dm %ds", minutes, seconds);
|
||||
|
||||
return " -";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user