Class LeaderboardFXMLController
java.lang.Object
it.polimi.ingsw.gc14.View.GUI.LeaderboardFXMLController
FXML controller for the end-of-game leaderboard scene.
Displays the final player rankings and a winner/game-over banner.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate RunnableAction run when the player returns to the login screen (disconnect + scene switch).private ClientControllerClient controller for fetching game state and sending actions.Shared image cache to avoid reloading resources multiple times.private javafx.scene.layout.VBoxMain vertical container holding the outcome label and ranking rows.private javafx.stage.PopupAuto-hiding popup that shows detailed player card information.private javafx.scene.layout.VBoxContent container insidepopup.private javafx.scene.layout.VBoxVertical list populated with oneHBoxrow per ranked player.private javafx.scene.layout.StackPaneRoot pane of the leaderboard scene; used to set the background and anchor the popup. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddHoverZoom(javafx.scene.Node node) Scalesnodeto 1.02× on hover and sets a hand cursor.private voidaddShadow(javafx.scene.Node node) Applies a static drop-shadow tonode.private javafx.scene.layout.HBoxcreatePlayerRow(int position, Player player) Builds a styled leaderboard row showing rank, totem, username, stats, and prestige forplayer.private javafx.scene.layout.HBoxcreateStatItem(String iconPath, String value, double iconHeight) Creates a single icon + label widget for one stat type.private javafx.scene.layout.HBoxcreateStatsBox(Player player) Creates a compact icon+count stats strip for all card types ofplayer.private ArrayList<PlayableCard> getPlayerCards(String username, String type) Returns a copy of the named card collection forusername.voidInitializes the scene: loads fonts, sets up the background, and initializes the popup.private voidCreates and configures the auto-hiding player-detail popup.private javafx.scene.image.ImageReturns a cachedImagefor the given classpathpath, loading it on first access.private voidDisconnects the client and invokes the post-game action to return to the login scene.private voidopenPlayerPopup(Player player) Opens the player-detail popup showing all cards held byplayer, grouped by type.voidrender()Populates the ranking list with the final player standings and shows the outcome banner.private voidSets the full-cover background image on the root pane.voidsetController(ClientController controller, Runnable action) Injects the client controller, a post-game action, and the login scene reference.
-
Field Details
-
rootPane
private javafx.scene.layout.StackPane rootPaneRoot pane of the leaderboard scene; used to set the background and anchor the popup. -
mainVBox
private javafx.scene.layout.VBox mainVBoxMain vertical container holding the outcome label and ranking rows. -
rankingList
private javafx.scene.layout.VBox rankingListVertical list populated with oneHBoxrow per ranked player. -
controller
Client controller for fetching game state and sending actions. -
popup
private javafx.stage.Popup popupAuto-hiding popup that shows detailed player card information. -
popupContent
private javafx.scene.layout.VBox popupContentContent container insidepopup. -
imageCache
-
action
Action run when the player returns to the login screen (disconnect + scene switch).
-
-
Constructor Details
-
LeaderboardFXMLController
public LeaderboardFXMLController()
-
-
Method Details
-
loadImage
Returns a cachedImagefor the given classpathpath, loading it on first access. -
setController
Injects the client controller, a post-game action, and the login scene reference.- Parameters:
controller- the client controller.action- the action to run when the player returns to the login screen.
-
initialize
public void initialize()Initializes the scene: loads fonts, sets up the background, and initializes the popup. -
render
public void render()Populates the ranking list with the final player standings and shows the outcome banner. -
addHoverZoom
private void addHoverZoom(javafx.scene.Node node) Scalesnodeto 1.02× on hover and sets a hand cursor. -
addShadow
private void addShadow(javafx.scene.Node node) Applies a static drop-shadow tonode. -
createPlayerRow
Builds a styled leaderboard row showing rank, totem, username, stats, and prestige forplayer. -
createStatsBox
Creates a compact icon+count stats strip for all card types ofplayer. -
createStatItem
-
initPopup
private void initPopup()Creates and configures the auto-hiding player-detail popup. -
openPlayerPopup
Opens the player-detail popup showing all cards held byplayer, grouped by type. -
getPlayerCards
Returns a copy of the named card collection forusername. -
renderBackground
private void renderBackground()Sets the full-cover background image on the root pane. -
onNewGame
private void onNewGame()Disconnects the client and invokes the post-game action to return to the login scene.
-