Feat/ms 4 integration #282

Merged
jona.walpert merged 23 commits from feat/ms-4-integration into main 2026-04-13 03:07:52 +02:00
Showing only changes of commit 44785ee77f - Show all commits
@@ -18,12 +18,15 @@ import java.util.concurrent.CompletableFuture;
import java.util.logging.Logger; import java.util.logging.Logger;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.image.Image; import javafx.scene.image.Image;
import javafx.scene.image.ImageView; import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.HBox; import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox; import javafx.scene.layout.VBox;
import javafx.stage.Stage;
/** /**
* Controller for the casino gaming area. * Controller for the casino gaming area.
@@ -229,24 +232,42 @@ public class CasinoGameController {
} }
private void initializeChatIfPossible() { private void initializeChatIfPossible() {
if (chatInitialized || chatContainer == null || chatClientService == null || chatUsername == null) { if (chatInitialized || chatClientService == null || chatUsername == null) {
return; return;
} }
try { try {
chatController = new ChatController(chatUsername, chatClientService); chatController = new ChatController(chatUsername, chatClientService);
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(chatController.getChatBoxController()); loader.setController(chatController.getChatBoxController());
javafx.scene.Node chatNode = loader.load();
chatContainer.getChildren().setAll(chatNode); Parent root = loader.load();
AnchorPane.setTopAnchor(chatNode, 0.0);
AnchorPane.setBottomAnchor(chatNode, 0.0); Stage chatStage = new Stage();
AnchorPane.setLeftAnchor(chatNode, 0.0);
AnchorPane.setRightAnchor(chatNode, 0.0); chatStage.setTitle("Casono");
String iconPath = getClass().getResource("/images/logoinverted.png").toExternalForm();
chatStage.getIcons().add(new Image(iconPath));
Scene scene = new Scene(root);
chatStage.setScene(scene);
chatStage.setWidth(400);
chatStage.setHeight(600);
chatStage.setOnCloseRequest(event -> chatInitialized = false);
chatStage.show();
if (chatLobbyId >= 0) { if (chatLobbyId >= 0) {
chatController.setLobbyChat(chatLobbyId); chatController.setLobbyChat(chatLobbyId);
} }
chatInitialized = true; 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());
} }