Feat: Add chat box into the game screen #303

Merged
m.ginkel merged 28 commits from feat/chat-integration into main 2026-04-24 14:14:17 +02:00
Showing only changes of commit 33998e4a88 - Show all commits
@@ -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());
} }