Feat: accept optional client username and forward to ClientApp #271

Merged
jona.walpert merged 15 commits from feat/change-username-at-start-or-in-game into main 2026-04-12 11:17:39 +02:00
2 changed files with 115 additions and 26 deletions
Showing only changes of commit 77ec50e008 - Show all commits
+104 -18
View File
@@ -1,4 +1,3 @@
/* Pixel-Art Font (WICHTIG: Nutze eine Monospace-Schrift für Pixel-Look) */
.root { .root {
-fx-background-color: #000000; -fx-background-color: #000000;
-fx-font-family: "Monospaced", "Courier New"; -fx-font-family: "Monospaced", "Courier New";
@@ -6,23 +5,23 @@
.anchor-pane-bg { .anchor-pane-bg {
-fx-background-color: #ffffff; -fx-background-color: #ffffff;
/* Optional: Bild entfernen oder als Overlay nutzen */ /* Optional: Remove the image or use it as an overlay */
-fx-background-image: url("/images/background.png"); -fx-background-image: url("/images/background.png");
-fx-background-size: cover; -fx-background-size: cover;
-fx-background-position: center center; -fx-background-position: center center;
-fx-background-repeat: no-repeat; -fx-background-repeat: no-repeat;
} }
/* DIE SCHWEBENDE INFO-BOX (PIXEL-STYLE) */ /* THE FLOATING INFO BOX */
.floating-chat-box { .floating-chat-box {
-fx-background-color: #0d9e3b; -fx-background-color: #0d9e3b;
/* Pixel-Ränder: Keine Rundung (0px) oder nur sehr kleine Stufen */ /* Pixel edges: No rounding (0px) or only very slight steps */
-fx-background-radius: 58; -fx-background-radius: 58;
-fx-border-radius: 50; -fx-border-radius: 50;
-fx-border-color: #5c3d10 #3d260a #3d260a #5c3d10; -fx-border-color: #5c3d10 #3d260a #3d260a #5c3d10;
-fx-border-width: 12; -fx-border-width: 12;
-fx-padding: 20; -fx-padding: 20;
/* Harter Schatten statt weicher Glow */ /* Hard shadows instead of a soft glow */
-fx-effect: dropshadow(one-pass-box, rgba(0,0,0,1), 0, 0, 15, 15); -fx-effect: dropshadow(one-pass-box, rgba(0,0,0,1), 0, 0, 15, 15);
} }
@@ -38,20 +37,19 @@
-fx-font-size: 16px; -fx-font-size: 16px;
} }
/* DER OVALE PIXEL-TISCH */ /* THE OVAL PIXEL TABLE */
.casino-table { .casino-table {
-fx-background-color: #0d9e3b; /* Feste Farbe statt Gradient für Pixel-Look */ -fx-background-color: #0d9e3b; /* Solid color instead of a gradient for a pixelated look */
/* Oval durch festen Radius - Pixel-Art-Ovale sind stufig */ /* Oval with a fixed radius - Pixel art ovals are jagged */
-fx-background-radius: 2000; -fx-background-radius: 2000;
-fx-border-radius: 2000; -fx-border-radius: 2000;
/* Dicker, eckiger Holzrand */ /* Thick, square wooden edge */
-fx-border-color: #5c3d10 #3d260a #3d260a #5c3d10; -fx-border-color: #5c3d10 #3d260a #3d260a #5c3d10;
-fx-border-width: 12; -fx-border-width: 12;
} }
.table-title { .table-title {
-fx-text-fill: #ffffff; -fx-text-fill: #ffffff;
-fx-font-size: 28px; -fx-font-size: 28px;
@@ -59,10 +57,98 @@
-fx-effect: dropshadow(one-pass-box, #000, 0, 0, 3, 3); -fx-effect: dropshadow(one-pass-box, #000, 0, 0, 3, 3);
} }
.black-input-field {
-fx-background-color: #1a1a1a;
-fx-text-fill: #ffffff;
-fx-font-family: "Courier New";
-fx-font-weight: bold;
-fx-background-radius: 8;
-fx-border-radius: 8;
-fx-border-color: #444444;
-fx-border-width: 2;
-fx-padding: 5 12;
}
.black-input-field:hover {
-fx-translate-y: -3;
-fx-effect: dropshadow(one-pass-box, rgba(0, 0, 0, 0.8), 0, 0, 3, 3);
}
.black-input-field:focused {
-fx-border-color: #ffffff;
-fx-background-color: #000000;
}
/* Hauptcontainer der Statusbox */ .gray-input-field {
-fx-background-color: #333333;
-fx-text-fill: #ffffff;
-fx-font-family: "Courier New";
-fx-font-weight: bold;
-fx-background-radius: 8;
-fx-border-radius: 8;
-fx-border-color: #666666;
-fx-color-color: #cccccc;
-fx-border-width: 2;
-fx-padding: 5 12;
}
.gray-input-field:hover {
-fx-translate-y: -3;
-fx-effect: dropshadow(one-pass-box, rgba(0, 0, 0, 0.8), 0, 0, 3, 3);
}
.gray-input-field:focused {
-fx-border-color: #ffffff;
-fx-background-color: #333333;
}
.yellow-input-field {
-fx-background-color: #b8860b;
-fx-text-fill: #ffffff;
-fx-prompt-text-fill: #ffffff;
-fx-font-family: "Courier New";
-fx-font-weight: bold;
-fx-background-radius: 8;
-fx-border-radius: 8;
-fx-border-color: #ffd700;
-fx-border-width: 2;
-fx-padding: 5 12;
}
.yellow-input-field:hover {
-fx-translate-y: -3;
-fx-effect: dropshadow(one-pass-box, rgba(0, 0, 0, 0.8), 0, 0, 3, 3);
}
.yellow-input-field:focused {
-fx-border-color: #ffffff;
-fx-background-color: #b8860b;
}
.red-input-field {
-fx-background-color: #8b0000;
-fx-text-fill: #ffffff;
-fx-prompt-text-fill: #ffffff;
-fx-font-family: "Courier New";
-fx-font-weight: bold;
-fx-background-radius: 8;
-fx-border-radius: 8;
-fx-border-color: #ff4444;
-fx-border-width: 2;
-fx-padding: 5 12;
}
.red-input-field:hover {
-fx-translate-y: -3;
-fx-effect: dropshadow(one-pass-box, rgba(0, 0, 0, 0.8), 0, 0, 3, 3);
}
.red-input-field:focused {
-fx-border-color: #ffffff;
-fx-background-color: #8b0000;
}
/* MAIN CONTAINER OF THE STATUS BOX */
.player-status-pane { .player-status-pane {
-fx-background-color: rgb(129, 13, 158); -fx-background-color: rgb(129, 13, 158);
-fx-background-radius: 15; -fx-background-radius: 15;
@@ -77,7 +163,7 @@
-fx-translate-y: -3; -fx-translate-y: -3;
} }
/* Die zwei inneren Boxen */ /* THE TWO INNER BOXES */
.status-inner-box-top { .status-inner-box-top {
-fx-background-color: rgb(13, 93, 158); -fx-background-color: rgb(13, 93, 158);
-fx-background-radius: 19; -fx-background-radius: 19;
@@ -103,16 +189,16 @@
} }
.table-title { .table-title {
/* Titel-Text anpassen */ /* Customize the title text */
-fx-text-fill: #ffffff; -fx-text-fill: #ffffff;
-fx-font-size: 32px; -fx-font-size: 32px;
-fx-font-weight: bold; -fx-font-weight: bold;
-fx-effect: dropshadow(one-pass-box, #000, 0, 0, 3, 3); -fx-effect: dropshadow(one-pass-box, #000, 0, 0, 3, 3);
-fx-padding: 10 0 0 0; /* Abstand nach oben */ -fx-padding: 10 0 0 0; /* Space above */
} }
.green-box { .green-box {
/* Grüne Box anpassen */ /* Customize the green box */
-fx-fill: #4CAF50; -fx-fill: #4CAF50;
-fx-stroke: #FFFFFF; -fx-stroke: #FFFFFF;
-fx-stroke-width: 3; -fx-stroke-width: 3;
@@ -133,12 +219,13 @@
-fx-border-color: #666666; -fx-border-color: #666666;
-fx-text-fill: #CCCCCC; -fx-text-fill: #CCCCCC;
} }
.button-exit:hover { .button-exit:hover {
-fx-translate-y: -3; -fx-translate-y: -3;
-fx-effect: dropshadow(one-pass-box, rgba(0, 0, 0, 0.8), 0, 0, 3, 3); -fx-effect: dropshadow(one-pass-box, rgba(0, 0, 0, 0.8), 0, 0, 3, 3);
} }
/* LOBBY ERSTELLEN BUTTON */ /* CREATE LOBBY BUTTON */
.button-create-lobby { .button-create-lobby {
-fx-background-radius: 12; -fx-background-radius: 12;
-fx-border-radius: 12; -fx-border-radius: 12;
@@ -151,10 +238,9 @@
-fx-border-color: #2ecc71; -fx-border-color: #2ecc71;
-fx-text-fill: #ffffff; -fx-text-fill: #ffffff;
} }
.button-create-lobby:hover { .button-create-lobby:hover {
-fx-translate-y: -3; -fx-translate-y: -3;
-fx-effect: dropshadow(one-pass-box, rgba(0, 0, 0, 0.8), 0, 0, 3, 3); -fx-effect: dropshadow(one-pass-box, rgba(0, 0, 0, 0.8), 0, 0, 3, 3);
-fx-background-color: #27ae60; -fx-background-color: #27ae60;
} }
@@ -12,9 +12,9 @@
<GridPane prefWidth="1200" prefHeight="800" AnchorPane.topAnchor="0" AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0" AnchorPane.rightAnchor="0"> <GridPane prefWidth="1200" prefHeight="800" AnchorPane.topAnchor="0" AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0" AnchorPane.rightAnchor="0">
<columnConstraints> <columnConstraints>
<!-- Tisch bekommt 75% vom Fenster --> <!-- The table takes up 70% of the window -->
<ColumnConstraints percentWidth="70.0" hgrow="ALWAYS" /> <ColumnConstraints percentWidth="70.0" hgrow="ALWAYS" />
<!-- Info-Box bekommt 25% vom Fenster inkl. 5 prozent buffer --> <!-- The info box takes up 25% of the window, including a 5% buffer -->
<ColumnConstraints percentWidth="5.0" hgrow="ALWAYS" /> <ColumnConstraints percentWidth="5.0" hgrow="ALWAYS" />
<ColumnConstraints percentWidth="25.0" hgrow="ALWAYS" /> <ColumnConstraints percentWidth="25.0" hgrow="ALWAYS" />
</columnConstraints> </columnConstraints>
@@ -24,7 +24,7 @@
</rowConstraints> </rowConstraints>
<children> <children>
<!-- LINKER BEREICH (Tisch) --> <!-- LEFT SIDE (Table) -->
<GridPane GridPane.columnIndex="0" style="-fx-background-color: transparent;" alignment="CENTER"> <GridPane GridPane.columnIndex="0" style="-fx-background-color: transparent;" alignment="CENTER">
<rowConstraints> <rowConstraints>
<RowConstraints percentHeight="25.0" vgrow="ALWAYS" /> <RowConstraints percentHeight="25.0" vgrow="ALWAYS" />
@@ -68,7 +68,7 @@
<Insets top="20" left="20" /> <Insets top="20" left="20" />
</GridPane.margin> </GridPane.margin>
</Button> </Button>
<Button text="Lobby erstellen" <Button text="CREATE A LOBBY"
styleClass="button-create-lobby" styleClass="button-create-lobby"
fx:id="createLobbyButton" fx:id="createLobbyButton"
onAction="#handleCreateLobbyButton" onAction="#handleCreateLobbyButton"
@@ -88,10 +88,13 @@
GridPane.halignment="LEFT" GridPane.halignment="LEFT"
GridPane.valignment="TOP"> GridPane.valignment="TOP">
<GridPane.margin> <GridPane.margin>
<!-- place below the 'Lobby erstellen' button --> <!-- place below the 'CREATE A LOBBY' button -->
<Insets top="100" left="20" /> <Insets top="100" left="20" />
</GridPane.margin> </GridPane.margin>
<TextField fx:id="usernameField" promptText="Benutzername" maxWidth="180" /> <TextField fx:id="usernameField"
promptText="Username"
styleClass="gray-input-field"
maxWidth="180" />
<Button text="Login" <Button text="Login"
fx:id="loginButton" fx:id="loginButton"
onAction="#handleLoginButton" onAction="#handleLoginButton"
@@ -119,10 +122,10 @@
alignment="CENTER" alignment="CENTER"
minWidth="100" minWidth="100"
minHeight="100"> minHeight="100">
<!-- Bleibt leer --> <!-- Remains empty -->
</VBox> </VBox>
<!-- RECHTER BEREICH (Info-Box) --> <!-- RIGHT SIDE (Chat Box) -->
<fx:include source="components/chatui/chatbox.fxml" GridPane.columnIndex="2"/> <fx:include source="components/chatui/chatbox.fxml" GridPane.columnIndex="2"/>
</children> </children>
</GridPane> </GridPane>