From 67e318f236774be257dde1c1f7b6c2f5ea8212ee Mon Sep 17 00:00:00 2001 From: AleandroPagani Date: Thu, 14 May 2026 18:30:57 +0200 Subject: [PATCH] tmp --- .../gc14/View/GUI/MainFXMLController.java | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/main/java/it/polimi/ingsw/gc14/View/GUI/MainFXMLController.java b/src/main/java/it/polimi/ingsw/gc14/View/GUI/MainFXMLController.java index d12ec6f..db5e486 100644 --- a/src/main/java/it/polimi/ingsw/gc14/View/GUI/MainFXMLController.java +++ b/src/main/java/it/polimi/ingsw/gc14/View/GUI/MainFXMLController.java @@ -55,8 +55,8 @@ public class MainFXMLController { private HBox popupCards; private ClientController controller; - private CurrentState old_state; - private CurrentState new_state; + private GameStages old_state_stage; + private String old_state_username; public void setController(ClientController controller) { @@ -68,8 +68,9 @@ public class MainFXMLController { @FXML public void initialize() { - old_state=null; - new_state=null; + old_state_stage=null; + old_state_username=""; + // Import font and apply CSS Font.loadFont(getClass().getResourceAsStream("/Fonts/InknutAntiqua-Regular.ttf"), 14); @@ -86,32 +87,38 @@ public class MainFXMLController { public void render() { - new_state=controller.miniModel.currentState; - System.out.println("OLD: "+old_state+", NEW: "+new_state); - if (old_state==null) { + if (old_state_stage==null) { renderBackground(); renderUpper(); renderBoard(); renderLower(); renderMyHand(); renderSidePanel(); - } else if (old_state.getGameStage()==SLOT_CHOICE) { + } else if (old_state_stage==SLOT_CHOICE) { + System.out.println("OLD: "+old_state_stage+", NEW: "+controller.miniModel.currentState.getGameStage()); System.out.println("RIDISEGNO BOARD\n"); renderBoard(); - } else if (old_state.getGameStage()==RES_ACTIONS) { - System.out.println("RIDISEGNO TUTTO"); + } else if (old_state_stage==RES_ACTIONS) { + System.out.println("OLD: "+old_state_stage+", NEW: "+controller.miniModel.currentState.getGameStage()); + System.out.println("RIDISEGNO TUTTO. USERNAME: "+old_state_username); renderUpper(); renderBoard(); renderLower(); renderSidePanel(); - renderMyHand(); + //renderMyHand(); + + if (old_state_username==controller.myUsername) { + renderMyHand(); + } + // TODO: se sono io a pescare renderizzo myHand, altrimenti no (non รจ scontato) } else { System.out.println("NON GESTITO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); } - old_state=new_state; + old_state_stage=controller.miniModel.currentState.getGameStage(); + old_state_username=controller.miniModel.currentState.getCurrentPlayer().getUserName(); // TODO: le info in sidepanel non vengono aggiornate sempre aggiornate, bisogna prima capire dove metterle }