Removed more referencec to ListView and added some threads in the hope of making the gameplay smoother
This commit is contained in:
parent
f0566cbf37
commit
216c9004e7
@ -378,9 +378,6 @@ public class Client {
|
||||
chatApp.getGameController().clearAllNoiseDisplay();
|
||||
dayNightChangeListener.setNoiseButtonInvisible(true);
|
||||
break;
|
||||
case GuiParameters.getMembersInLobby:
|
||||
updateLobbyMembers(data);
|
||||
break;
|
||||
case GuiParameters.viewChangeToGame:
|
||||
chatApp.getLoungeSceneViewController().addGameView();
|
||||
gameStateModel.setGameOver(false);
|
||||
@ -418,42 +415,6 @@ public class Client {
|
||||
|
||||
}
|
||||
|
||||
private void removeLobbyFromGui(String data) {
|
||||
loungeSceneViewController.removeLobbyFromView(data);
|
||||
LOGGER.debug("Made it into removeLobbyFromGui()");
|
||||
}
|
||||
|
||||
private void makeNewLobby(String data) {
|
||||
String[] params = data.split(":");
|
||||
loungeSceneViewController.newLobby(params[0], params[1]);
|
||||
LOGGER.debug("makeNewLobby() seems to have finished");
|
||||
|
||||
}
|
||||
|
||||
private void addPlayerToLobby(String data) {
|
||||
String[] params = data.split(":");
|
||||
loungeSceneViewController.addPlayerToLobby(params[0], params[1]);
|
||||
LOGGER.debug("addPlayerToLobby() seems to have finished");
|
||||
}
|
||||
|
||||
private void updateLobbyMembers(String data) {
|
||||
String[] dataArr = data.split(":");
|
||||
String lobbyID = dataArr[0];
|
||||
String adminName = dataArr[1];
|
||||
}
|
||||
|
||||
private void updateListOfLobbies(String data) {
|
||||
String[] arr = data.split(":");
|
||||
ObservableList<SimpleStringProperty> list = new SimpleListProperty<>();
|
||||
int n = arr.length;
|
||||
for (int i = 0; i < n; i = i + 2) {
|
||||
list.add(new SimpleStringProperty(arr[i]));
|
||||
//ChatController.getClient().addLobbyToList(new SimpleStringProperty(arr[i]));
|
||||
}
|
||||
//TODO
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Starts a new thread, thad adds a message to notificationText in the gameController, waits 3
|
||||
* seconds and deletes it again.
|
||||
|
||||
@ -51,10 +51,15 @@ public class ListOfLobbiesController implements Initializable {
|
||||
|
||||
|
||||
public void updateList() {
|
||||
clearVBox();
|
||||
for (LobbyModel lobby : LobbyDisplayHandler.getLobbies()) {
|
||||
newTreeView(lobby.getId(), lobby.getAdmin(), chatApp.getcModel().getUsername(), lobby.getMembers());
|
||||
}
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
clearVBox();
|
||||
for (LobbyModel lobby : LobbyDisplayHandler.getLobbies()) {
|
||||
newTreeView(lobby.getId(), lobby.getAdmin(), chatApp.getcModel().getUsername(), lobby.getMembers());
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -31,6 +31,9 @@ public class LobbyDisplayHandler {
|
||||
}
|
||||
|
||||
public void updateLobbies(String data) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
for (LobbyModel model : lobbies) {
|
||||
model.setHasBeenVisited(false);
|
||||
@ -56,6 +59,8 @@ public class LobbyDisplayHandler {
|
||||
e.printStackTrace();
|
||||
LOGGER.info("empty list");
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void addLobbyFromString(int id, String admin, boolean isOpen, String[] oneLobby) {
|
||||
|
||||
Reference in New Issue
Block a user