Began fixing conflicts with LobbyController

#bug
This commit is contained in:
Calum
2017-07-26 12:05:03 +12:00
parent 9c9f6e4e80
commit 8ac44d13df
6 changed files with 233 additions and 26 deletions
@@ -172,6 +172,7 @@ public class GameClient {
);
lobbyList.clear();
allBoatsMap.forEach((id, boat) -> lobbyList.add(id.toString() + boat.getBoatName()));
allBoatsMap.forEach((i, b) -> System.out.println(b.getBoatName()));
startRaceIfAllDataReceived();
break;
@@ -206,10 +207,8 @@ public class GameClient {
if (positionData.getType() == DeviceType.YACHT_TYPE) {
if (allXMLReceived() && allBoatsMap.containsKey(positionData.getDeviceId())) {
Yacht yacht = allBoatsMap.get(positionData.getDeviceId());
yacht.setVelocityProperty(positionData.getGroundSpeed());
yacht.setLat(positionData.getLat());
yacht.setLon(positionData.getLon());
yacht.setHeading(positionData.getHeading());
yacht.updateLocation(positionData.getLat(),
positionData.getLon(), positionData.getHeading(), positionData.getGroundSpeed());
}
} else if (positionData.getType() == DeviceType.MARK_TYPE) {
Mark mark = courseData.getCompoundMarks().get(positionData.getDeviceId());
@@ -262,8 +262,15 @@ public class GameView extends Pane {
BoatObject newObject;
for (Yacht yacht : yachts) {
newObject = new BoatObject();
// newObject.bindBoat(boat);
newObject.setFill(Colors.getColor());
boatObjects.put(yacht, newObject);
yacht.addLocationListener((boat, lat, lon, heading, velocity) ->{
BoatObject bo = boatObjects.get(boat);
Point2D p2d = findScaledXY(lat, lon);
bo.setLayoutX(p2d.getX());
bo.setLayoutY(p2d.getY());
// bo.setTrajectory(heading, velocity * (metersPerPixelX + metersPerPixelY) / 2);
});
createAnnotationBox(yacht);
}
@@ -88,7 +88,6 @@ public class LobbyController implements Initializable {
private static ObservableList<String> seventhCompetitor = FXCollections.observableArrayList();
private static ObservableList<String> eighthCompetitor = FXCollections.observableArrayList();
// private ClientStateQueryingRunnable clientStateQueryingRunnable;
private ClientStateQueryingRunnable clientStateQueryingRunnable;
private static List<ImageView> imageViews;
private static List<ListView> listViews;
@@ -233,12 +232,12 @@ public class LobbyController implements Initializable {
// }
// });
// thread.start();
// }
}
private void initialiseImageView() {
for (int i = 0; i < MAX_NUM_PLAYERS; i++) {
imageViews.get(i).setImage(new Image(getClass().getResourceAsStream("/pics/sail.png")));
}
// for (int i = 0; i < MAX_NUM_PLAYERS; i++) {
// imageViews.get(i).setImage(new Image(getClass().getResourceAsStream("/pics/sail.png")));
// }
// Image image1 = new Image(getClass().getResourceAsStream("/pics/sail.png"));
// firstImageView.setImage(image1);
// Image image2 = new Image(getClass().getResourceAsStream("/pics/sail.png"));