Fixed not being able to add custom connections. Still need to test if it works with the http match browser (can't test it atm. #story[1352]
This commit is contained in:
@@ -40,7 +40,6 @@ public class LobbyController extends Controller {
|
|||||||
private @FXML TextField addressFld;
|
private @FXML TextField addressFld;
|
||||||
private @FXML TextField portFld;
|
private @FXML TextField portFld;
|
||||||
|
|
||||||
private ObservableList<RaceConnection> connections;
|
|
||||||
private ObservableList<RaceConnection> customConnections;
|
private ObservableList<RaceConnection> customConnections;
|
||||||
|
|
||||||
private AudioClip sound;
|
private AudioClip sound;
|
||||||
@@ -83,7 +82,7 @@ public class LobbyController extends Controller {
|
|||||||
sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
|
sound = new AudioClip(this.getClass().getResource("/visualiser/sounds/buttonpress.wav").toExternalForm());
|
||||||
sound.play();
|
sound.play();
|
||||||
addServerGames();
|
addServerGames();
|
||||||
for(RaceConnection connection: connections) {
|
for(RaceConnection connection: httpMatchBrowserClient.connections) {
|
||||||
connection.check();
|
connection.check();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@@ -144,9 +143,9 @@ public class LobbyController extends Controller {
|
|||||||
try {
|
try {
|
||||||
int port = Integer.parseInt(portString);
|
int port = Integer.parseInt(portString);
|
||||||
customConnections.add(new RaceConnection(hostName, port, "Boat Game"));
|
customConnections.add(new RaceConnection(hostName, port, "Boat Game"));
|
||||||
connections.addAll(customConnections);
|
|
||||||
addressFld.clear();
|
addressFld.clear();
|
||||||
portFld.clear();
|
portFld.clear();
|
||||||
|
refreshBtnPressed();
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
System.err.println("Port number entered is not a number");
|
System.err.println("Port number entered is not a number");
|
||||||
}
|
}
|
||||||
@@ -174,6 +173,7 @@ public class LobbyController extends Controller {
|
|||||||
*/
|
*/
|
||||||
private void addServerGames() {
|
private void addServerGames() {
|
||||||
httpMatchBrowserClient.connections.addAll(customConnections);
|
httpMatchBrowserClient.connections.addAll(customConnections);
|
||||||
|
customConnections.clear();
|
||||||
httpMatchBrowserClient.connections.addListener(new ListChangeListener<RaceConnection>() {
|
httpMatchBrowserClient.connections.addListener(new ListChangeListener<RaceConnection>() {
|
||||||
@Override
|
@Override
|
||||||
public void onChanged(Change<? extends RaceConnection> c) {
|
public void onChanged(Change<? extends RaceConnection> c) {
|
||||||
|
|||||||
Reference in New Issue
Block a user