mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Multiple clients are now shown in lobby of host.
When multiple clients connect to the host, the lobby table now fills up with the names of the threads (will need to be changed later). Re-enabled multiple people connecting and the lobby table. Formatting changes in the lobby screen also made. #story[1047]
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
package seng302.controllers;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.ListView;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.Pane;
|
||||
@@ -11,8 +16,8 @@ import javafx.scene.text.Text;
|
||||
import seng302.gameServer.GameServerThread;
|
||||
import seng302.gameServer.GameStages;
|
||||
import seng302.gameServer.GameState;
|
||||
|
||||
import java.io.IOException;
|
||||
import seng302.gameServerWithThreading.MainServerThread;
|
||||
import seng302.gameServerWithThreading.ServerToClientThread;
|
||||
|
||||
/**
|
||||
* A class describing the actions of the lobby screen
|
||||
@@ -20,12 +25,15 @@ import java.io.IOException;
|
||||
*/
|
||||
public class LobbyController {
|
||||
|
||||
@FXML
|
||||
private ListView competitorsListView;
|
||||
@FXML
|
||||
private GridPane lobbyScreen;
|
||||
@FXML
|
||||
private Text lobbyIpText;
|
||||
|
||||
private GameServerThread gameServerThread;
|
||||
private static ObservableList competitors;
|
||||
|
||||
private void setContentPane(String jfxUrl) {
|
||||
try {
|
||||
@@ -42,6 +50,11 @@ public class LobbyController {
|
||||
}
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
competitors = FXCollections.observableArrayList();
|
||||
competitorsListView.setItems(competitors);
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
public void leaveLobbyButtonPressed() {
|
||||
@@ -52,6 +65,11 @@ public class LobbyController {
|
||||
gameServerThread.terminateGame();
|
||||
}
|
||||
|
||||
public static void refreshCompetitors(){
|
||||
Collection<String> competitorsIps = MainServerThread.getServerToClientThreads();
|
||||
competitors.clear();
|
||||
competitors.addAll(competitorsIps);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void readyButtonPressed() {
|
||||
|
||||
Reference in New Issue
Block a user