Added server list updates, and added lobby

- Server list updates when a server is added/removed
- Player can host a server
- Lobby view shows players connected

Tags: #pair[mra106, hyi25] #story[1245]
This commit is contained in:
Michael Rausch
2017-09-07 19:20:36 +12:00
parent 8cc725616c
commit b35126ff4e
13 changed files with 280 additions and 170 deletions
@@ -1,16 +1,25 @@
package seng302.visualiser.controllers;
import com.jfoenix.controls.JFXDecorator;
import javafx.collections.ObservableList;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import seng302.visualiser.GameClient;
import java.io.IOException;
import java.util.HashMap;
public class ViewManager {
private static ViewManager instance;
private GameClient gameClient;
private JFXDecorator decorator;
private HashMap<String, String> props; //TODO is this the best way to do this??
private ObservableList<String> playerList;
private ViewManager(){
props = new HashMap<>();
gameClient = new GameClient(decorator);
}
@@ -34,8 +43,33 @@ public class ViewManager {
decorator.setContent(scene);
}
public void goToStartView() {
try {
Parent root = FXMLLoader.load(getClass().getResource("/views/StartScreenView.fxml"));
this.setScene(root);
} catch (IOException e) {
e.printStackTrace();
}
}
public GameClient getGameClient(){
return gameClient;
}
public String getProperty(String key){
return props.get(key);
}
public void setProperty(String key, String val){
props.put(key, val);
}
public void setPlayerList(ObservableList<String> playerList) {
this.playerList = playerList;
}
public ObservableList<String> getPlayerList(){
return playerList;
}
}