|
|
|
|
@ -19,7 +19,7 @@ import java.net.UnknownHostException;
|
|
|
|
|
import java.util.ResourceBundle;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Created by zwu18 on 25/07/17.
|
|
|
|
|
* Controller for Hosting a game.
|
|
|
|
|
*/
|
|
|
|
|
public class HostController extends Controller {
|
|
|
|
|
|
|
|
|
|
@ -38,6 +38,10 @@ public class HostController extends Controller {
|
|
|
|
|
public void initialize(URL location, ResourceBundle resources) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Hosts a game
|
|
|
|
|
* @throws IOException if socket cannot be connected to
|
|
|
|
|
*/
|
|
|
|
|
public void hostGamePressed() throws IOException{
|
|
|
|
|
try {
|
|
|
|
|
Event game = Event.getEvent();
|
|
|
|
|
@ -54,6 +58,11 @@ public class HostController extends Controller {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Connect to a socket
|
|
|
|
|
* @param address address of the server
|
|
|
|
|
* @param port port that the server is run off
|
|
|
|
|
*/
|
|
|
|
|
public void connectSocket(String address, int port) {
|
|
|
|
|
try{
|
|
|
|
|
Socket socket = new Socket(address, port);
|
|
|
|
|
@ -66,6 +75,9 @@ public class HostController extends Controller {
|
|
|
|
|
return hostWrapper;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Hosts a game.
|
|
|
|
|
*/
|
|
|
|
|
public void hostGame(){
|
|
|
|
|
hostWrapper.setVisible(true);
|
|
|
|
|
System.out.println("Reacted hostGame");
|
|
|
|
|
|