mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Finish screen
This commit is contained in:
@@ -31,13 +31,13 @@ public class ClientYacht extends Observable {
|
||||
private Logger logger = LoggerFactory.getLogger(ClientYacht.class);
|
||||
|
||||
|
||||
//BOTH AFAIK
|
||||
private String boatType;
|
||||
private Integer sourceId;
|
||||
private String hullID; //matches HullNum in the XML spec.
|
||||
private String shortName;
|
||||
private String boatName;
|
||||
private String country;
|
||||
private Integer position;
|
||||
|
||||
private Long estimateTimeAtFinish;
|
||||
private Boolean sailIn = true;
|
||||
@@ -50,7 +50,6 @@ public class ClientYacht extends Observable {
|
||||
private Integer boatStatus;
|
||||
private Double currentVelocity;
|
||||
|
||||
//CLIENT SIDE
|
||||
private List<YachtLocationListener> locationListeners = new ArrayList<>();
|
||||
private ReadOnlyDoubleWrapper velocityProperty = new ReadOnlyDoubleWrapper();
|
||||
private ReadOnlyLongWrapper timeTillNextProperty = new ReadOnlyLongWrapper();
|
||||
@@ -189,6 +188,14 @@ public class ClientYacht extends Observable {
|
||||
return location;
|
||||
}
|
||||
|
||||
public Integer getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public void setPosition(Integer position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
public void toggleSail() {
|
||||
sailIn = !sailIn;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import javafx.scene.layout.Pane;
|
||||
import seng302.gameServer.GameState;
|
||||
import seng302.gameServer.MainServerThread;
|
||||
import seng302.gameServer.server.messages.BoatAction;
|
||||
import seng302.gameServer.server.messages.BoatStatus;
|
||||
import seng302.model.ClientYacht;
|
||||
import seng302.model.RaceState;
|
||||
import seng302.model.stream.packets.StreamPacket;
|
||||
@@ -320,14 +321,10 @@ public class GameClient {
|
||||
}
|
||||
boolean raceFinished = true;
|
||||
for (ClientYacht yacht : allBoatsMap.values()) {
|
||||
if (yacht.getBoatStatus() != 3) {
|
||||
if (yacht.getBoatStatus() != BoatStatus.FINISHED.getCode()) {
|
||||
raceFinished = false;
|
||||
}
|
||||
}
|
||||
if (raceFinished) {
|
||||
close();
|
||||
loadFinishScreenView();
|
||||
}
|
||||
|
||||
for (long[] boatData : data.getBoatData()) {
|
||||
ClientYacht clientYacht = allBoatsMap.get((int) boatData[0]);
|
||||
@@ -337,14 +334,21 @@ public class GameClient {
|
||||
clientYacht.setBoatStatus((int) boatData[4]);
|
||||
if (legNumber != clientYacht.getLegNumber()) {
|
||||
clientYacht.setLegNumber(legNumber);
|
||||
raceState.sortPlayers();
|
||||
// System.out.println("ORDER:");
|
||||
// for (ClientYacht clientYacht1 : raceState.getPlayerPositions()) {
|
||||
// System.out.println(clientYacht1.getShortName());
|
||||
// }
|
||||
// System.out.println();
|
||||
updatePlayerPositions();
|
||||
}
|
||||
}
|
||||
|
||||
if (raceFinished) {
|
||||
close();
|
||||
loadFinishScreenView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updatePlayerPositions() {
|
||||
raceState.sortPlayers();
|
||||
for (ClientYacht yacht : raceState.getPlayerPositions()) {
|
||||
yacht.setPosition(raceState.getPlayerPositions().indexOf(yacht) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user