Add: Added SKipTurn Button and Details Button. Fixed: TCP now display leaderboard
This commit is contained in:
@@ -161,19 +161,15 @@ public class TCPClient implements IClient {
|
||||
if (event.getIsError()) {
|
||||
controller.view.showError(event.toString());
|
||||
} else {
|
||||
synchronized (controller) {
|
||||
event.apply(controller.miniModel);
|
||||
}
|
||||
controller.view.render();
|
||||
|
||||
controller.view.applyAndRender(event);
|
||||
}
|
||||
|
||||
} else if (read instanceof MiniModel model) {
|
||||
synchronized (controller) {
|
||||
controller.setModel(model);
|
||||
}
|
||||
controller.view.render();
|
||||
}
|
||||
}
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -66,7 +66,8 @@ public class LeaderboardFXMLController {
|
||||
|
||||
public void render() {
|
||||
rankingList.getChildren().clear();
|
||||
|
||||
if(controller.miniModel.standingPlayers!=null)
|
||||
{
|
||||
List<Player> sorted = controller.miniModel.standingPlayers;
|
||||
|
||||
boolean iWon = sorted.get(0).getUserName().equals(controller.myUsername);
|
||||
@@ -94,6 +95,7 @@ public class LeaderboardFXMLController {
|
||||
rankingList.getChildren().add(createPlayerRow(i + 1, sorted.get(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ==== EFFECTS ====
|
||||
|
||||
@@ -498,6 +498,25 @@ public class MainFXMLController {
|
||||
VBox.setMargin(info, new Insets(5, 5, 5, 5));
|
||||
sidePanel.getChildren().add(info);
|
||||
|
||||
// ===== NUOVO: bottoni Skip Turn e Dettagli =====
|
||||
HBox buttonRow = new HBox(8);
|
||||
buttonRow.setAlignment(Pos.CENTER);
|
||||
VBox.setMargin(buttonRow, new Insets(0, 5, 5, 5));
|
||||
|
||||
javafx.scene.control.Button skipBtn = new javafx.scene.control.Button("Skip Turn");
|
||||
skipBtn.getStyleClass().add("action-button");
|
||||
skipBtn.setOnAction(e -> controller.skipTurn(controller.myUsername));
|
||||
addHoverZoom(skipBtn);
|
||||
|
||||
javafx.scene.control.Button detailsBtn = new javafx.scene.control.Button("Ending Details");
|
||||
detailsBtn.getStyleClass().add("action-button");
|
||||
detailsBtn.setOnAction(e -> openDetailsPopup());
|
||||
addHoverZoom(detailsBtn);
|
||||
|
||||
buttonRow.getChildren().addAll(skipBtn, detailsBtn);
|
||||
sidePanel.getChildren().add(buttonRow);
|
||||
// ================================================
|
||||
|
||||
for (Player player : controller.miniModel.players.values()) {
|
||||
renderPlayer(player);
|
||||
}
|
||||
@@ -574,4 +593,15 @@ public class MainFXMLController {
|
||||
}
|
||||
showPopup();
|
||||
}
|
||||
private void openDetailsPopup() {
|
||||
popupCards.getChildren().clear();
|
||||
ImageView img = new ImageView(loadImage("/GUIImages/Backs/back-118.png"));
|
||||
img.setFitHeight(290);
|
||||
img.setPreserveRatio(true);
|
||||
addClip(img);
|
||||
StackPane wrapper = new StackPane(img);
|
||||
addShadow(wrapper);
|
||||
popupCards.getChildren().add(wrapper);
|
||||
showPopup();
|
||||
}
|
||||
}
|
||||
@@ -48,3 +48,17 @@
|
||||
-fx-background-radius: 15, 12, 8, 4;
|
||||
-fx-padding: 15 15 15 15;
|
||||
}
|
||||
.action-button {
|
||||
-fx-background-color: #9d0208;
|
||||
-fx-text-fill: white;
|
||||
-fx-font-family: "Inknut Antiqua";
|
||||
-fx-font-size: 11px;
|
||||
-fx-background-radius: 8;
|
||||
-fx-border-radius: 8;
|
||||
-fx-padding: 4 10 4 10;
|
||||
-fx-cursor: hand;
|
||||
}
|
||||
|
||||
.action-button:hover {
|
||||
-fx-background-color: #b42224;
|
||||
}
|
||||
Reference in New Issue
Block a user