Added functionality to host game and join a game in lobby. Host name and game name are not implemented yet.

#story[1087]
This commit is contained in:
zwu18
2017-07-26 20:42:36 +12:00
parent 578f04c74f
commit 9c9b98f882
10 changed files with 93 additions and 13 deletions
@@ -6,8 +6,10 @@ import javafx.scene.control.*;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import mock.app.App;
import visualiser.model.RaceConnection;
import java.io.IOException;
import java.net.Socket;
import java.net.URL;
import java.util.ResourceBundle;
@@ -31,7 +33,17 @@ public class HostController extends Controller {
}
public void hostGamePressed() throws IOException{
System.out.println("TODO: Run mock");
new App().start(new Stage());
System.out.println("Run mock");
connectSocket();
}
public void connectSocket() {
try{
Socket socket = new Socket("localhost", 4942);
hostWrapper.setVisible(false);
parent.enterLobby(socket);
} catch (IOException e) { /* Never reached */ }
}
public AnchorPane startWrapper(){