Check method moved to new class called ping so that refresh will be called on new thread.
#story[1087]
This commit is contained in:
@@ -48,10 +48,13 @@ public class LobbyController extends Controller {
|
||||
statusColumn.setCellValueFactory(cellData -> cellData.getValue().statusProperty());
|
||||
|
||||
lobbyTable.getSelectionModel().selectedItemProperty().addListener((obs, prev, curr) -> {
|
||||
if (curr != null && ((RaceConnection)curr).check())
|
||||
{joinGameBtn.setDisable(false);}
|
||||
|
||||
else {joinGameBtn.setDisable(true);}
|
||||
if (curr != null && curr.statusProperty().getValue().equals("Ready")) {
|
||||
joinGameBtn.setDisable(false);
|
||||
}
|
||||
else {
|
||||
joinGameBtn.setDisable(true);
|
||||
System.out.println(curr.statusProperty().getValue());
|
||||
}
|
||||
});
|
||||
joinGameBtn.setDisable(true);
|
||||
}
|
||||
@@ -60,6 +63,14 @@ public class LobbyController extends Controller {
|
||||
for(RaceConnection connection: connections) {
|
||||
connection.check();
|
||||
}
|
||||
|
||||
try {
|
||||
if (lobbyTable.getSelectionModel().getSelectedItem().statusProperty().getValue().equals("Ready")) {
|
||||
joinGameBtn.setDisable(false);
|
||||
} else {
|
||||
joinGameBtn.setDisable(true);
|
||||
}
|
||||
} catch (Exception e){}
|
||||
}
|
||||
|
||||
public void connectSocket() {
|
||||
@@ -68,7 +79,9 @@ public class LobbyController extends Controller {
|
||||
Socket socket = new Socket(connection.getHostname(), connection.getPort());
|
||||
lobbyWrapper.setVisible(false);
|
||||
parent.enterLobby(socket);
|
||||
} catch (IOException e) { /* Never reached */ }
|
||||
} catch (IOException e) { /* Never reached */
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public AnchorPane startWrapper(){
|
||||
|
||||
Reference in New Issue
Block a user