use of com.janfic.games.computercombat.model.match.MatchResults in project computercombat by janfic.
the class MatchScreen method listenForServerMessage.
private void listenForServerMessage() {
if (game.getServerAPI().hasMessage() && isAnimating() == false) {
Message serverMessage = game.getServerAPI().readMessage();
System.out.println(serverMessage.getType());
if (serverMessage.type == Type.MOVE_ACCEPT) {
List<MoveResult> results = json.fromJson(List.class, serverMessage.getMessage());
animate(results, this);
} else if (serverMessage.type == Type.PING) {
} else if (serverMessage.type == Type.MATCH_RESULTS) {
MatchResults results = json.fromJson(MatchResults.class, serverMessage.getMessage());
gameOver(results);
}
}
}
Aggregations