Add Game UI logic #255
+90
-83
@@ -5,7 +5,6 @@ import ch.unibas.dmi.dbis.cs108.casono.client.game.GameService;
|
|||||||
import ch.unibas.dmi.dbis.cs108.casono.client.game.GameState;
|
import ch.unibas.dmi.dbis.cs108.casono.client.game.GameState;
|
||||||
import ch.unibas.dmi.dbis.cs108.casono.client.game.Player;
|
import ch.unibas.dmi.dbis.cs108.casono.client.game.Player;
|
||||||
import ch.unibas.dmi.dbis.cs108.casono.client.game.PlayerId;
|
import ch.unibas.dmi.dbis.cs108.casono.client.game.PlayerId;
|
||||||
import ch.unibas.dmi.dbis.cs108.casono.client.game.PlayerState;
|
|
||||||
import ch.unibas.dmi.dbis.cs108.casono.client.ui.gameui.gameuicomponents.PlayerStatusController;
|
import ch.unibas.dmi.dbis.cs108.casono.client.ui.gameui.gameuicomponents.PlayerStatusController;
|
||||||
import ch.unibas.dmi.dbis.cs108.casono.client.ui.gameui.gameuicomponents.TaskbarController;
|
import ch.unibas.dmi.dbis.cs108.casono.client.ui.gameui.gameuicomponents.TaskbarController;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -169,94 +168,102 @@ public class CasinoGameController {
|
|||||||
casinoTableInnerBox.setTranslateY(-screenHeight * TABLE_OFFSET_Y_FACTOR);
|
casinoTableInnerBox.setTranslateY(-screenHeight * TABLE_OFFSET_Y_FACTOR);
|
||||||
playerCardsBox.setTranslateY(screenHeight * PLAYER_CARDS_OFFSET_Y_FACTOR);
|
playerCardsBox.setTranslateY(screenHeight * PLAYER_CARDS_OFFSET_Y_FACTOR);
|
||||||
|
|
||||||
uiTest();
|
// uiTest();
|
||||||
|
|
||||||
// empty display only (optional)
|
// empty display only (optional)
|
||||||
renderCommunityCards(List.of());
|
renderCommunityCards(List.of());
|
||||||
renderPlayerCards(List.of());
|
renderPlayerCards(List.of());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// Test method to demonstrate the UI functionality with sample data.
|
||||||
* Test method to demonstrate the UI functionality with sample data.
|
// @FXML
|
||||||
*/
|
// public void uiTest() {
|
||||||
@FXML
|
// if (communityCardsBox == null) {
|
||||||
public void uiTest() {
|
// LOGGER.info("communityCardsBox is NULL");
|
||||||
if (communityCardsBox == null) {
|
// return;
|
||||||
LOGGER.info("communityCardsBox is NULL");
|
// }
|
||||||
return;
|
//
|
||||||
}
|
// try {
|
||||||
|
// renderCommunityCards(
|
||||||
try {
|
// List.of(
|
||||||
renderCommunityCards(
|
// new Card("ace", "hearts"),
|
||||||
List.of(
|
// new Card("king", "spades"),
|
||||||
new Card("ace", "hearts"),
|
// new Card("10", "diamonds")));
|
||||||
new Card("king", "spades"),
|
//
|
||||||
new Card("10", "diamonds")));
|
// renderPlayerCards(List.of(new Card("10", "spades"), new Card("king", "spades")));
|
||||||
|
// } catch (Exception e) {
|
||||||
renderPlayerCards(List.of(new Card("10", "spades"), new Card("king", "spades")));
|
// e.printStackTrace();
|
||||||
} catch (Exception e) {
|
// }
|
||||||
e.printStackTrace();
|
//
|
||||||
}
|
// Player mathis = new Player(PlayerId.of("Mathis"), 20000);
|
||||||
|
// mathis.setState(PlayerState.ACTIVE);
|
||||||
Player mathis = new Player(PlayerId.of("Mathis"), 20000);
|
//
|
||||||
mathis.setState(PlayerState.ACTIVE);
|
// Player jona = new Player(PlayerId.of("Jona"), 20000);
|
||||||
|
// jona.setState(PlayerState.FOLDED);
|
||||||
Player jona = new Player(PlayerId.of("Jona"), 20000);
|
//
|
||||||
jona.setState(PlayerState.FOLDED);
|
// Player lars = new Player(PlayerId.of("Lars"), 20000);
|
||||||
|
// lars.setState(PlayerState.ACTIVE);
|
||||||
Player lars = new Player(PlayerId.of("Lars"), 20000);
|
//
|
||||||
lars.setState(PlayerState.ACTIVE);
|
// player1Controller.setPlayer(mathis);
|
||||||
|
// player2Controller.setPlayer(jona);
|
||||||
player1Controller.setPlayer(mathis);
|
// player3Controller.setPlayer(lars);
|
||||||
player2Controller.setPlayer(jona);
|
//
|
||||||
player3Controller.setPlayer(lars);
|
// LOGGER.info(
|
||||||
|
// "Player 1: "
|
||||||
LOGGER.info(
|
// + mathis.getName()
|
||||||
"Player 1: "
|
// + " | $"
|
||||||
+ mathis.getName()
|
// + mathis.getChips()
|
||||||
+ " | $"
|
// + " | "
|
||||||
+ mathis.getChips()
|
// + mathis.getState());
|
||||||
+ " | "
|
// LOGGER.info(
|
||||||
+ mathis.getState());
|
// "Player 2: "
|
||||||
LOGGER.info(
|
// + jona.getName()
|
||||||
"Player 2: " + jona.getName() + " | $" + jona.getChips() + " | " + jona.getState());
|
// + " | $"
|
||||||
LOGGER.info(
|
// + jona.getChips()
|
||||||
"Player 3: " + lars.getName() + " | $" + lars.getChips() + " | " + lars.getState());
|
// + " | "
|
||||||
|
// + jona.getState());
|
||||||
if (playerStatusController != null) {
|
// LOGGER.info(
|
||||||
playerStatusController.setPlayer(mathis);
|
// "Player 3: "
|
||||||
} else {
|
// + lars.getName()
|
||||||
LOGGER.warning("PlayerStatusController is NULL");
|
// + " | $"
|
||||||
}
|
// + lars.getChips()
|
||||||
|
// + " | "
|
||||||
javafx.stage.Screen screen = javafx.stage.Screen.getPrimary();
|
// + lars.getState());
|
||||||
double screenHeight = screen.getBounds().getHeight();
|
//
|
||||||
|
// if (playerStatusController != null) {
|
||||||
casinoTableInnerBox.setTranslateY(-screenHeight * 0.08);
|
// playerStatusController.setPlayer(mathis);
|
||||||
playerCardsBox.setTranslateY(screenHeight * 0.35);
|
// } else {
|
||||||
|
// LOGGER.warning("PlayerStatusController is NULL");
|
||||||
renderPot(500);
|
// }
|
||||||
|
//
|
||||||
lars.removeChips(500);
|
// javafx.stage.Screen screen = javafx.stage.Screen.getPrimary();
|
||||||
LOGGER.info("Lars: $" + lars.getChips());
|
// double screenHeight = screen.getBounds().getHeight();
|
||||||
|
//
|
||||||
player3Controller.refresh();
|
// casinoTableInnerBox.setTranslateY(-screenHeight * 0.08);
|
||||||
|
// playerCardsBox.setTranslateY(screenHeight * 0.35);
|
||||||
mathis.fall();
|
//
|
||||||
player1Controller.refresh();
|
// renderPot(500);
|
||||||
|
//
|
||||||
GameState s = new GameState();
|
// lars.removeChips(500);
|
||||||
s.dealer = 3;
|
// LOGGER.info("Lars: $" + lars.getChips());
|
||||||
highlightDealer(s);
|
//
|
||||||
|
// player3Controller.refresh();
|
||||||
s.phase = "FLOP";
|
//
|
||||||
|
// mathis.fall();
|
||||||
updateGameInfo(s);
|
// player1Controller.refresh();
|
||||||
|
//
|
||||||
s.winnerIndex = 1;
|
// GameState s = new GameState();
|
||||||
|
// s.dealer = 3;
|
||||||
updateGameInfo(s);
|
// highlightDealer(s);
|
||||||
}
|
//
|
||||||
|
// s.phase = "FLOP";
|
||||||
|
//
|
||||||
|
// updateGameInfo(s);
|
||||||
|
//
|
||||||
|
// s.winnerIndex = 1;
|
||||||
|
//
|
||||||
|
// updateGameInfo(s);
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start the UI update loop.
|
* Start the UI update loop.
|
||||||
|
|||||||
Reference in New Issue
Block a user