Feat: Game UI optimization #342

Merged
j.kropff merged 15 commits from feat/game-ui-optimization into main 2026-05-16 22:52:37 +02:00
2 changed files with 16 additions and 19 deletions
Showing only changes of commit e42a3c8cd5 - Show all commits
@@ -185,6 +185,7 @@ public class CasinoGameController {
private static final int NO_BET = 0; private static final int NO_BET = 0;
private boolean myDealerIconSizeBound; private boolean myDealerIconSizeBound;
private java.util.List<String> lobbyPlayerNames = java.util.List.of(); private java.util.List<String> lobbyPlayerNames = java.util.List.of();
private static final int MAX_ANIMATED_CHIPS = 12;
/** Standard constructor. Used by FXML. */ /** Standard constructor. Used by FXML. */
public CasinoGameController() { public CasinoGameController() {
@@ -1919,7 +1920,7 @@ public class CasinoGameController {
bottomRow.getChildren().add(chip); bottomRow.getChildren().add(chip);
} }
if (index < 12) { if (index < MAX_ANIMATED_CHIPS) {
animateChipAppear(chip, index); animateChipAppear(chip, index);
} else { } else {
chip.setOpacity(CHIP_FADE_TO); chip.setOpacity(CHIP_FADE_TO);
@@ -2017,10 +2018,7 @@ public class CasinoGameController {
*/ */
private void bindChipSize(ImageView view, javafx.scene.Scene scene) { private void bindChipSize(ImageView view, javafx.scene.Scene scene) {
view.fitHeightProperty() view.fitHeightProperty().bind(scene.heightProperty().multiply(CHIP_HEIGHT_RATIO));
.bind(
scene.heightProperty().multiply(CHIP_HEIGHT_RATIO)
);
view.fitWidthProperty().bind(scene.widthProperty().multiply(CHIP_WIDTH_RATIO)); view.fitWidthProperty().bind(scene.widthProperty().multiply(CHIP_WIDTH_RATIO));
} }
@@ -11,7 +11,6 @@ import ch.unibas.dmi.dbis.cs108.casono.client.ui.lobbyui.Casinomainui;
import ch.unibas.dmi.dbis.cs108.casono.ui.sound.SoundManager; import ch.unibas.dmi.dbis.cs108.casono.ui.sound.SoundManager;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.UnaryOperator; import java.util.function.UnaryOperator;
@@ -92,6 +91,7 @@ public class TaskbarController {
private int lastPotSnapshot = 0; private int lastPotSnapshot = 0;
private int lastObservedIncrease = 0; private int lastObservedIncrease = 0;
private int lastRaiseIncrement = 0; private int lastRaiseIncrement = 0;
private static final long REFRESH_DELAY_MS = 500;
/** Standard constructor. Used by FXML. */ /** Standard constructor. Used by FXML. */
public TaskbarController() { public TaskbarController() {
@@ -1030,9 +1030,10 @@ public class TaskbarController {
taskbarInput.clear(); taskbarInput.clear();
javafx.application.Platform.runLater(() -> { javafx.application.Platform.runLater(
() -> {
try { try {
Thread.sleep(500); Thread.sleep(REFRESH_DELAY_MS);
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} }
@@ -1040,9 +1041,7 @@ public class TaskbarController {
}); });
} }
/** /** Disables all action buttons to prevent multiple concurrent action submissions. */
* Disables all action buttons to prevent multiple concurrent action submissions.
*/
private void disableAllActionButtons() { private void disableAllActionButtons() {
if (betButton != null) { if (betButton != null) {
betButton.setDisable(true); betButton.setDisable(true);