Fix: Chat UI initialization improved in Game UI

This commit is contained in:
Julian Kropff
2026-04-23 19:59:55 +02:00
committed by Mathis Ginkel
parent 6471749133
commit 48476a67f3
@@ -278,37 +278,18 @@ public class CasinoGameController {
} }
try { try {
ChatBoxController chatBoxController = new ChatBoxController(chatUsername, chatController); String username = chatUsername;
// chatController = new ChatController(username, chatClientService);
chatController.setChatBoxController(chatBoxController);
URL resource = getClass().getResource("/ui-structure/components/chatui/chatbox.fxml"); URL resource = getClass().getResource("/ui-structure/components/chatui/chatbox.fxml");
FXMLLoader loader = new FXMLLoader(resource); FXMLLoader loader = new FXMLLoader(resource);
loader.setController(chatBoxController); loader.setController(chatController.getChatBoxController());
Node chatNode = loader.load();
chatBoxController.loadChats(); chatContainer.getChildren().setAll(chatNode);
AnchorPane.setTopAnchor(chatNode, 6.0);
Node chatBox = loader.load(); AnchorPane.setBottomAnchor(chatNode, 6.0);
AnchorPane.setLeftAnchor(chatNode, 0.0);
chatContainer.getChildren().add(chatBox); AnchorPane.setRightAnchor(chatNode, 6.0);
/* // gridManager.setChatController(chatController);
Scene scene = new Scene(root);
chatStage.setScene(scene);
chatStage.setWidth(CHAT_WIDTH);
chatStage.setHeight(CHAT_HEIGHT);
chatStage.setOnCloseRequest(event -> chatInitialized = false);
chatStage.show();
*/
if (chatLobbyId >= 0) {
chatController.setLobbyChat(chatLobbyId);
}
chatInitialized = true;
} catch (IOException e) { } catch (IOException e) {
LOGGER.warning("Could not initialize game chat UI: " + e.getMessage()); LOGGER.warning("Could not initialize game chat UI: " + e.getMessage());
} }