Feat/ms 4 integration #282
+29
-15
@@ -37,6 +37,7 @@ public class TaskbarController {
|
|||||||
|
|
||||||
private GameService gameService;
|
private GameService gameService;
|
||||||
private PlayerId myPlayerId;
|
private PlayerId myPlayerId;
|
||||||
|
private GameState lastState;
|
||||||
private double xOffset = 0;
|
private double xOffset = 0;
|
||||||
private double yOffset = 0;
|
private double yOffset = 0;
|
||||||
private static final double TASKBAR_SCALE = 0.95;
|
private static final double TASKBAR_SCALE = 0.95;
|
||||||
@@ -225,6 +226,8 @@ public class TaskbarController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.lastState = state;
|
||||||
|
|
||||||
Player me =
|
Player me =
|
||||||
state.players.stream()
|
state.players.stream()
|
||||||
.filter(p -> myPlayerId.equals(p.getId()))
|
.filter(p -> myPlayerId.equals(p.getId()))
|
||||||
@@ -341,22 +344,33 @@ public class TaskbarController {
|
|||||||
@FXML
|
@FXML
|
||||||
private void onInputPlayerRaise() {
|
private void onInputPlayerRaise() {
|
||||||
|
|
||||||
String input = taskbarInput.getText();
|
if (gameService == null) {
|
||||||
|
LOGGER.error("GameService not initialized");
|
||||||
try {
|
return;
|
||||||
int amount = Integer.parseInt(input.trim());
|
|
||||||
|
|
||||||
gameService.raise(amount);
|
|
||||||
|
|
||||||
LOGGER.info("Player RAISE {}", amount);
|
|
||||||
|
|
||||||
taskbarInput.clear();
|
|
||||||
|
|
||||||
refreshGame();
|
|
||||||
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
LOGGER.error("Invalid raise amount");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GameState state = lastState;
|
||||||
|
if (state == null) {
|
||||||
|
try {
|
||||||
|
state = gameService.refresh();
|
||||||
|
lastState = state;
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.error("Failed to refresh game state for raise: {}", e.getMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == null || state.currentBet <= 0) {
|
||||||
|
LOGGER.warn("Raise not possible: current bet is {}", state != null ? state.currentBet : null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int raiseAmount = state.currentBet;
|
||||||
|
gameService.raise(raiseAmount);
|
||||||
|
LOGGER.info("Player RAISE by {} (target: double table bet)", raiseAmount);
|
||||||
|
|
||||||
|
taskbarInput.clear();
|
||||||
|
refreshGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user