Merge remote-tracking branch 'remotes/origin/master' into css
This commit is contained in:
@@ -81,6 +81,13 @@ public class ConnectionController extends Controller {
|
||||
|
||||
private ObservableList<RaceConnection> connections;
|
||||
|
||||
|
||||
/**
|
||||
* Represents whether the client is currently hosting a game already - this is to ensure they don't launch multiple servers.
|
||||
*/
|
||||
private boolean currentlyHostingGame = false;
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
// TODO - replace with config file
|
||||
@@ -91,7 +98,7 @@ public class ConnectionController extends Controller {
|
||||
statusColumn.setCellValueFactory(cellData -> cellData.getValue().statusProperty());
|
||||
|
||||
connectionTable.getSelectionModel().selectedItemProperty().addListener((obs, prev, curr) -> {
|
||||
if (curr != null && ((RaceConnection)curr).check()) connectButton.setDisable(false);
|
||||
if (curr != null && curr.check()) connectButton.setDisable(false);
|
||||
else connectButton.setDisable(true);
|
||||
});
|
||||
connectButton.setDisable(true);
|
||||
@@ -142,12 +149,17 @@ public class ConnectionController extends Controller {
|
||||
*/
|
||||
public void addLocal() {
|
||||
try {
|
||||
Event game = Event.getEvent();
|
||||
urlField.textProperty().set(game.getAddress());
|
||||
portField.textProperty().set(Integer.toString(game.getPort()));
|
||||
//We don't want to host more than one game.
|
||||
if (!currentlyHostingGame) {
|
||||
Event game = Event.getEvent();
|
||||
urlField.textProperty().set(game.getAddress());
|
||||
portField.textProperty().set(Integer.toString(game.getPort()));
|
||||
|
||||
game.start();
|
||||
addConnection();
|
||||
game.start();
|
||||
addConnection();
|
||||
|
||||
currentlyHostingGame = true;
|
||||
}
|
||||
} catch (InvalidRaceDataException e) {
|
||||
e.printStackTrace();
|
||||
} catch (XMLReaderException e) {
|
||||
|
||||
Reference in New Issue
Block a user