Merged with remote changes

This commit is contained in:
Calum
2017-09-04 23:42:10 +12:00
parent a1e3ec54c7
commit e4dbbd05c7
7 changed files with 86 additions and 54 deletions
@@ -234,7 +234,6 @@ public class GameClient {
private void parsePackets() {
while (socketThread.getPacketQueue().peek() != null) {
System.out.println("PARSING PACKET");
StreamPacket packet = socketThread.getPacketQueue().poll();
switch (packet.getType()) {
case RACE_STATUS:
@@ -298,8 +297,6 @@ public class GameClient {
case CHATTER_TEXT:
Pair<Integer, String> playerIdMessagePair = StreamParser
.extractChatterText(packet);
System.out.println("playerIdMessagePair = " + playerIdMessagePair);
raceView.updateChatHistory(
allBoatsMap.get(playerIdMessagePair.getKey()).getColour(),
playerIdMessagePair.getValue()
@@ -574,7 +574,6 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
yachtSelectionComboBox.setItems(
FXCollections.observableArrayList(participants.values())
);
//Null check is if the listener is fired but nothing selected
yachtSelectionComboBox.valueProperty().addListener((obs, lastSelection, selectedBoat) -> {
if (selectedBoat != null) {
gameView.selectBoat(selectedBoat);
@@ -677,7 +676,6 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
}
public void updateChatHistory(Paint playerColour, String newMessage) {
// Platform.runLater(() -> chatHistory.appendText(newMessage + "\n\n"));
Platform.runLater(() -> chatHistory.addMessage(playerColour, newMessage));
}
@@ -24,9 +24,18 @@ public class ChatHistory extends ScrollPane {
this.setMaxWidth(Double.MAX_VALUE);
this.setVbarPolicy(ScrollBarPolicy.ALWAYS);
this.setHbarPolicy(ScrollBarPolicy.NEVER);
textFlow.getChildren().addListener((ListChangeListener<Node>) c -> {
this.setVvalue(1.0);
});
//This makes the window auto scroll.
textFlow.getChildren().addListener((ListChangeListener<Node>) c ->
this.setVvalue(1.0)
);
//This just makes it so that the ChatHistory is on focus it passes it off to the parent.
this.parentProperty().addListener((obs, old, parent) ->
this.focusedProperty().addListener((obsVal, oldVal, onFocus) -> {
if (onFocus) {
parent.requestFocus();
}
})
);
}
/**