Changed host menu. Will update soon.
#story[1087]
This commit is contained in:
@@ -33,6 +33,12 @@ public class HostController extends Controller {
|
||||
@FXML
|
||||
AnchorPane hostWrapper;
|
||||
|
||||
@FXML
|
||||
TextField gameAddressFld;
|
||||
|
||||
@FXML
|
||||
TextField gamePortFld;
|
||||
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
}
|
||||
@@ -40,8 +46,12 @@ public class HostController extends Controller {
|
||||
public void hostGamePressed() throws IOException{
|
||||
try {
|
||||
Event game = Event.getEvent();
|
||||
gameAddressFld.textProperty().set(game.getAddress());
|
||||
gamePortFld.textProperty().set(Integer.toString(game.getPort()));
|
||||
System.out.println(gameAddressFld.textProperty().getValue());
|
||||
System.out.println(gamePortFld.textProperty().getValue());
|
||||
game.start();
|
||||
connectSocket();
|
||||
connectSocket(gameAddressFld.textProperty().getValue(), Integer.parseInt(gamePortFld.textProperty().getValue()));
|
||||
} catch (InvalidRaceDataException e) {
|
||||
e.printStackTrace();
|
||||
} catch (XMLReaderException e) {
|
||||
@@ -50,12 +60,14 @@ public class HostController extends Controller {
|
||||
e.printStackTrace();
|
||||
} catch (InvalidRegattaDataException e) {
|
||||
e.printStackTrace();
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
public void connectSocket() {
|
||||
public void connectSocket(String address, int port) {
|
||||
try{
|
||||
Socket socket = new Socket("localhost", 4942);
|
||||
Socket socket = new Socket(address, port);
|
||||
hostWrapper.setVisible(false);
|
||||
parent.enterLobby(socket);
|
||||
} catch (IOException e) { /* Never reached */ }
|
||||
|
||||
Reference in New Issue
Block a user