Feat/gameui #244

Merged
j.kropff merged 5 commits from feat/gameui into main 2026-04-09 10:57:24 +02:00
5 changed files with 43 additions and 45 deletions
Showing only changes of commit a99cf16c7e - Show all commits
@@ -7,11 +7,11 @@ import javafx.scene.layout.VBox;
/** /**
* Controller for the casino gaming area. * Controller for the casino gaming area.
* *
* <p>Responsible for: - the display of the poker table and the player interface, - the * <p>Responsible for: - the display of the poker table and the player interface, - the processing
* processing of user input, - the interface to the game engine and the network protocol. * of user input, - the interface to the game engine and the network protocol.
* *
* <p>Notes: - The `onTableClick()` method currently serves only as test logic. * <p>Notes: - The `onTableClick()` method currently serves only as test logic. It may no longer be
* It may no longer be functional and will be replaced by the final game interaction in the future. * functional and will be replaced by the final game interaction in the future.
*/ */
public class CasinoGameController { public class CasinoGameController {
@@ -12,8 +12,8 @@ import javafx.stage.Stage;
* <p>Starts the JavaFX application, loads the graphical user interface from the FXML file, and * <p>Starts the JavaFX application, loads the graphical user interface from the FXML file, and
* initializes the main stage for the game. * initializes the main stage for the game.
* *
* <p>Tasks: - Loads the FXML interface "/ui-structure/Casinogameui.fxml". - Loads the * <p>Tasks: - Loads the FXML interface "/ui-structure/Casinogameui.fxml". - Loads the application
* application icon from "/images/logoinverted.png". - Starts the application in full-screen mode. * icon from "/images/logoinverted.png". - Starts the application in full-screen mode.
*/ */
public class CasinoGameUI extends Application { public class CasinoGameUI extends Application {
@@ -33,22 +33,21 @@ import org.apache.logging.log4j.Logger;
/** /**
* Experimental embedded browser for Casono. * Experimental embedded browser for Casono.
* *
* <p>This class implements a simple embedded web browser based on {@link * <p>This class implements a simple embedded web browser based on {@link javafx.scene.web.WebView}.
* javafx.scene.web.WebView}. The browser primarily serves as a utility within the game to * The browser primarily serves as a utility within the game to display external content such as web
* display external content such as web pages or videos. * pages or videos.
* *
* <p>Status The browser is currently in an experimental phase. Some * <p>Status The browser is currently in an experimental phase. Some security mechanisms are based
* security mechanisms are based on experimental AI-driven recommendations and may * on experimental AI-driven recommendations and may change in future versions.
* change in future versions.
* *
* <p>Purpose The browser is currently being used experimentally to: Explain poker rules directly within the game * <p>Purpose The browser is currently being used experimentally to: Explain poker rules directly
* Display help pages or documentation Play videos (e.g., tutorials or explanations) * within the game Display help pages or documentation Play videos (e.g., tutorials or explanations)
* via platforms such as YouTube * via platforms such as YouTube
* *
* <p>Security Mechanisms Since external websites can be loaded, some basic * <p>Security Mechanisms Since external websites can be loaded, some basic protective measures have
* protective measures have been integrated: - Mandatory HTTPS for websites - Whitelist for known domains - * been integrated: - Mandatory HTTPS for websites - Whitelist for known domains - Warning for
* Warning for unknown websites - JavaScript disabled by default (but can be enabled for * unknown websites - JavaScript disabled by default (but can be enabled for Google, etc.) - Pop-up
* Google, etc.) - Pop-up blocker - Automatic cookie deletion upon closing * blocker - Automatic cookie deletion upon closing
*/ */
public class CasinoBrowserController { public class CasinoBrowserController {
@@ -112,8 +111,8 @@ public class CasinoBrowserController {
/** /**
* Opens a new browser window and loads a specified webpage. * Opens a new browser window and loads a specified webpage.
* *
* <p>If the webpage is not on the list of trusted domains, the user * <p>If the webpage is not on the list of trusted domains, the user will be asked whether the
* will be asked whether the page should be loaded anyway. * page should be loaded anyway.
* *
* @param url the URL of the webpage to be loaded * @param url the URL of the webpage to be loaded
*/ */
@@ -212,7 +211,8 @@ public class CasinoBrowserController {
var stream = CasinoBrowserController.class.getResourceAsStream(LOGO_PATH); var stream = CasinoBrowserController.class.getResourceAsStream(LOGO_PATH);
Image logo = new Image(stream); Image logo = new Image(stream);
// Variable streamM abbreviated to comply with the 100-character limit (LineLength) // Variable streamM abbreviated to comply with the 100-character
// limit (LineLength)
var streamM = var streamM =
CasinoBrowserController.class.getResourceAsStream(LOGO_PATH_MAIN); CasinoBrowserController.class.getResourceAsStream(LOGO_PATH_MAIN);
Image logomain = new Image(streamM); Image logomain = new Image(streamM);
@@ -455,12 +455,12 @@ public class CasinoBrowserController {
/** /**
* Loads a URL in the browser after performing basic security checks. * Loads a URL in the browser after performing basic security checks.
* *
* <p>Before loading a page, the following checks are performed: - Verification of the * <p>Before loading a page, the following checks are performed: - Verification of the protocol
* protocol (only HTTPS allowed) - Verification of the domain against a whitelist - Protection against * (only HTTPS allowed) - Verification of the domain against a whitelist - Protection against
* domain spoofing * domain spoofing
* *
* <p>If a domain is not classified as trustworthy, the user must * <p>If a domain is not classified as trustworthy, the user must confirm that the page may
* confirm that the page may still be opened. * still be opened.
* *
* @param engine the browser's WebEngine renderer * @param engine the browser's WebEngine renderer
* @param url the web address to be loaded * @param url the web address to be loaded
@@ -13,9 +13,8 @@ import org.apache.logging.log4j.Logger;
/** /**
* Controller for the interactive taskbar within the poker UI. * Controller for the interactive taskbar within the poker UI.
* *
* Responsible for: - Drag-and-drop movement of the taskbar, * <p>Responsible for: - Drag-and-drop movement of the taskbar, - Input and management of game
* - Input and management of game stakes, - Control of general * stakes, - Control of general menu functions such as Exit.
* menu functions such as Exit.
*/ */
public class TaskbarController { public class TaskbarController {
@@ -37,8 +36,8 @@ public class TaskbarController {
private static final int CREDIT_STEP = 5; private static final int CREDIT_STEP = 5;
/** /**
* Called when the taskbar is clicked with the mouse. Saves the relative * Called when the taskbar is clicked with the mouse. Saves the relative position for later,
* position for later, correct repositioning. * correct repositioning.
* *
* @param event The mouse event * @param event The mouse event
*/ */
@@ -49,11 +48,10 @@ public class TaskbarController {
} }
/** /**
* Called while dragging the taskbar with the mouse. Updates the position * Called while dragging the taskbar with the mouse. Updates the position and slightly scales
* and slightly scales the taskbar for visual feedback. * the taskbar for visual feedback.
* *
* <p>TODO: It still needs to be fixed that the taskbar cannot disappear out * <p>TODO: It still needs to be fixed that the taskbar cannot disappear out of the window.
* of the window.
* *
* @param event Das Mausereignis * @param event Das Mausereignis
*/ */
@@ -67,8 +65,8 @@ public class TaskbarController {
} }
/** /**
* Called when the mouse cursor is released over the taskbar. Resets the * Called when the mouse cursor is released over the taskbar. Resets the taskbar scaling to
* taskbar scaling to normal size. * normal size.
* *
* @param event The mouse event * @param event The mouse event
*/ */
@@ -91,8 +89,8 @@ public class TaskbarController {
} }
/** /**
* Called when the submit button in the taskbar is pressed. Triggers the * Called when the submit button in the taskbar is pressed. Triggers the processing of the
* processing of the deployment. * deployment.
*/ */
@FXML @FXML
private void onInputSubmittedAction() { private void onInputSubmittedAction() {
@@ -117,9 +115,9 @@ public class TaskbarController {
} }
/** /**
* Processes the stake entered in the text field. Only integer values between 5 * Processes the stake entered in the text field. Only integer values between 5 and 100,000
* and 100,000 credits are accepted, in multiples of 5 (in increments of 5). * credits are accepted, in multiples of 5 (in increments of 5). The stake is currently only
* The stake is currently only displayed on the console. * displayed on the console.
*/ */
private void processBet() { private void processBet() {
String input = taskbarInput.getText(); String input = taskbarInput.getText();
@@ -141,8 +139,8 @@ public class TaskbarController {
/** /**
* Opens the integrated Casono web browser. * Opens the integrated Casono web browser.
* *
* <p> TODO: Replace the start URL with the official project website * <p>TODO: Replace the start URL with the official project website (e.g., Tips & Tricks page)
* (e.g., Tips & Tricks page) once the content for strategies and support is available. * once the content for strategies and support is available.
*/ */
@FXML @FXML
private void onBrowserButtonClick() { private void onBrowserButtonClick() {
@@ -51,8 +51,8 @@ public class Deck {
} }
/** /**
* Sets the cards of the deck. This method replaces the internal list * Sets the cards of the deck. This method replaces the internal list with a copy of the
* with a copy of the provided list. * provided list.
* *
* @param cards the new list of cards to set * @param cards the new list of cards to set
*/ */