mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user