Added functionality to host game and join a game in lobby. Host name and game name are not implemented yet.

#story[1087]
This commit is contained in:
zwu18
2017-07-26 20:42:36 +12:00
parent 578f04c74f
commit 9c9b98f882
10 changed files with 93 additions and 13 deletions
@@ -14,12 +14,14 @@ public class RaceConnection {
private final StringProperty hostname;
private final int port;
private final StringProperty status;
private final StringProperty gamename;
public RaceConnection(String hostname, int port) {
public RaceConnection(String hostname, int port, String gamename) {
this.hostname = new SimpleStringProperty(hostname);
this.port = port;
this.status = new SimpleStringProperty("");
check();
this.gamename = new SimpleStringProperty(gamename);
}
/**
@@ -34,7 +36,8 @@ public class RaceConnection {
s.connect(i, 750);//TODO this should be at least a second or two, once moved to its own thread
status.set("Ready");
return true;
} catch (IOException e) {}
} catch (IOException e) {
}
status.set("Offline");
return false;
@@ -55,4 +58,6 @@ public class RaceConnection {
public StringProperty statusProperty() {
return status;
}
public StringProperty gamenameProperty() { return gamename;}
}