popup.setMessage("Join Game", "Connecting to '" + address + ":" + port + "' - please wait ...");
popup.onSuccess(new Function<JoinStatus, Void>() {
@Override
public Void apply(JoinStatus result) {
GameEngine engine = CoreRegistry.get(GameEngine.class);
if (result.getStatus() != JoinStatus.Status.FAILED) {
engine.changeState(new StateLoading(result));
} else {
MessagePopup screen = manager.pushScreen(MessagePopup.ASSET_URI, MessagePopup.class);
screen.setMessage("Failed to Join", "Could not connect to server - " + result.getErrorMessage());
}