# Conflicts: # racevisionGame/src/main/java/visualiser/Controllers/InGameLobbyController.java # racevisionGame/src/main/resources/visualiser/scenes/gameLobby.fxml # racevisionGame/src/main/resources/visualiser/scenes/hostgame.fxmlmain
parent
aafc0dc9db
commit
00780e17e9
@ -1,7 +1,37 @@
|
|||||||
package visualiser.app;
|
package visualiser.app;
|
||||||
|
|
||||||
/**
|
import visualiser.network.MatchBrowserInterface;
|
||||||
* Created by hba56 on 13/09/17.
|
|
||||||
*/
|
import java.io.IOException;
|
||||||
|
import java.net.DatagramSocket;
|
||||||
|
|
||||||
public class MatchBrowserSingleton {
|
public class MatchBrowserSingleton {
|
||||||
|
private DatagramSocket udpSocket;
|
||||||
|
private MatchBrowserInterface matchBrowserInterface;
|
||||||
|
|
||||||
|
private static MatchBrowserSingleton instance = null;
|
||||||
|
|
||||||
|
public MatchBrowserSingleton() {
|
||||||
|
this.matchBrowserInterface = new MatchBrowserInterface();
|
||||||
|
try{
|
||||||
|
this.udpSocket = matchBrowserInterface.setupMatchBrowserConnection();
|
||||||
|
}catch (IOException e){
|
||||||
|
System.err.println("Error in setting up connection with match browser");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MatchBrowserSingleton getInstance() {
|
||||||
|
if (instance == null){
|
||||||
|
instance = new MatchBrowserSingleton();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DatagramSocket getUdpSocket() {
|
||||||
|
return udpSocket;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MatchBrowserInterface getMatchBrowserInterface() {
|
||||||
|
return matchBrowserInterface;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in new issue