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

# Conflicts:
#	src/main/java/seng302/visualiser/ClientToServerThread.java
This commit is contained in:
Kusal Ekanayake
2017-09-28 15:08:53 +13:00
15 changed files with 121 additions and 39 deletions
@@ -83,7 +83,7 @@ public class GameClient {
* @param ipAddress IP to connect to.
* @param portNumber Port to connect to.
*/
public void runAsClient(String ipAddress, Integer portNumber) {
public boolean runAsClient(String ipAddress, Integer portNumber) {
try {
startClientToServerThread(ipAddress, portNumber);
socketThread.addDisconnectionListener((cause) -> {
@@ -94,12 +94,19 @@ public class GameClient {
ViewManager.getInstance().setPlayerList(clientLobbyList);
while (regattaData == null){
int triesLeft = 10;
while (regattaData == null && triesLeft >= 0){
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (InterruptedException ignored) {
;
}
triesLeft--;
}
if (triesLeft < 1){
return false;
}
ViewManager.getInstance().setProperty("serverName", regattaData.getRegattaName());
@@ -112,6 +119,8 @@ public class GameClient {
} catch (IOException ioe) {
ViewManager.getInstance().showErrorSnackBar("There are no servers currently available.");
}
return true;
}
/**