Merge remote-tracking branch 'origin/develop' into Story80_BoatCustomization

# Conflicts:
#	src/main/java/seng302/gameServer/GameState.java
#	src/main/java/seng302/gameServer/ServerPacketParser.java
#	src/main/java/seng302/gameServer/ServerToClientThread.java
#	src/main/java/seng302/gameServer/messages/ChatterMessage.java
#	src/main/java/seng302/gameServer/messages/MarkRoundingMessage.java
#	src/main/java/seng302/model/ServerYacht.java
#	src/main/java/seng302/visualiser/ClientToServerThread.java
#	src/main/java/seng302/visualiser/GameClient.java
#	src/main/java/seng302/visualiser/GameView.java
This commit is contained in:
Alistair McIntyre
2017-08-17 13:31:27 +12:00
26 changed files with 1020 additions and 376 deletions
+45 -16
View File
@@ -8,6 +8,8 @@ import java.util.Observable;
import java.util.Observer;
import javafx.beans.property.ReadOnlyDoubleProperty;
import javafx.beans.property.ReadOnlyDoubleWrapper;
import javafx.beans.property.ReadOnlyIntegerProperty;
import javafx.beans.property.ReadOnlyIntegerWrapper;
import javafx.beans.property.ReadOnlyLongProperty;
import javafx.beans.property.ReadOnlyLongWrapper;
import javafx.scene.paint.Color;
@@ -28,19 +30,24 @@ public class ClientYacht extends Observable {
Boolean sailsIn, double velocity);
}
@FunctionalInterface
public interface MarkRoundingListener {
void notifyRounding(ClientYacht yacht, CompoundMark markPassed, int legNumber);
}
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 = false;
private Boolean sailIn = true;
private Integer currentMarkSeqID = 0;
private Long markRoundTime;
private Long timeTillNext;
@@ -50,13 +57,13 @@ public class ClientYacht extends Observable {
private Integer boatStatus;
private Double currentVelocity;
//CLIENT SIDE
private List<YachtLocationListener> locationListeners = new ArrayList<>();
private List<MarkRoundingListener> markRoundingListeners = new ArrayList<>();
private ReadOnlyDoubleWrapper velocityProperty = new ReadOnlyDoubleWrapper();
private ReadOnlyLongWrapper timeTillNextProperty = new ReadOnlyLongWrapper();
private ReadOnlyLongWrapper timeSinceLastMarkProperty = new ReadOnlyLongWrapper();
private ReadOnlyIntegerWrapper placingProperty = new ReadOnlyIntegerWrapper();
private CompoundMark lastMarkRounded;
private Integer positionInt = 0;
private Color colour;
public ClientYacht(String boatType, Integer sourceId, String hullID, String shortName,
@@ -146,12 +153,16 @@ public class ClientYacht extends Observable {
this.estimateTimeAtFinish = estimateTimeAtFinish;
}
public Integer getPositionInteger() {
return positionInt;
public Integer getPlacing() {
return placingProperty.get();
}
public void setPositionInteger(Integer position) {
this.positionInt = position;
public void setPlacing(Integer position) {
placingProperty.set(position);
}
public ReadOnlyIntegerProperty placingProperty() {
return placingProperty.getReadOnlyProperty();
}
public void updateVelocityProperty(double velocity) {
@@ -190,6 +201,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;
}
@@ -240,14 +259,6 @@ public class ClientYacht extends Observable {
this.colour = colour;
}
// public Double getCurrentVelocity() {
// return currentVelocity;
// }
//
// public void setCurrentVelocity(Double currentVelocity) {
// this.currentVelocity = currentVelocity;
// }
public void updateLocation(double lat, double lng, double heading, double velocity) {
setLocation(lat, lng);
@@ -263,7 +274,25 @@ public class ClientYacht extends Observable {
locationListeners.add(listener);
}
public void addMarkRoundingListener(MarkRoundingListener listener) {
markRoundingListeners.add(listener);
}
public void removeMarkRoundingListener(MarkRoundingListener listener) {
markRoundingListeners.remove(listener);
}
public boolean getSailIn () {
return sailIn;
}
public void roundMark(CompoundMark mark, long markRoundTime, long timeSinceLastMark) {
this.markRoundTime = markRoundTime;
timeSinceLastMarkProperty.set(timeSinceLastMark);
lastMarkRounded = mark;
legNumber += 1;
for (MarkRoundingListener listener : markRoundingListeners) {
listener.notifyRounding(this, lastMarkRounded, legNumber);
}
}
}