499 lines
24 KiB
HTML
499 lines
24 KiB
HTML
|
||
|
||
|
||
<!DOCTYPE html>
|
||
<html id="htmlId">
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||
<title>Coverage Report > LeaderboardFXMLController</title>
|
||
<style type="text/css">
|
||
@import "../../css/coverage.css";
|
||
@import "../../css/idea.min.css";
|
||
</style>
|
||
<script type="text/javascript" src="../../js/highlight.min.js"></script>
|
||
<script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
|
||
</head>
|
||
|
||
<body>
|
||
<div class="content">
|
||
<div class="breadCrumbs">
|
||
Current scope: <a href="../../index.html">all classes</a>
|
||
<span class="separator">|</span>
|
||
<a href="../index.html">it.polimi.ingsw.gc14.View.GUI</a>
|
||
</div>
|
||
|
||
<h1>Coverage Summary for Class: LeaderboardFXMLController (it.polimi.ingsw.gc14.View.GUI)</h1>
|
||
|
||
<table class="coverageStats">
|
||
<tr>
|
||
<th class="name">Class</th>
|
||
<th class="coverageStat
|
||
">
|
||
Class, %
|
||
</th>
|
||
<th class="coverageStat
|
||
">
|
||
Method, %
|
||
</th>
|
||
<th class="coverageStat
|
||
">
|
||
Branch, %
|
||
</th>
|
||
<th class="coverageStat
|
||
">
|
||
Line, %
|
||
</th>
|
||
</tr>
|
||
<tr>
|
||
<td class="name">LeaderboardFXMLController</td>
|
||
<td class="coverageStat">
|
||
<span class="percent">
|
||
0%
|
||
</span>
|
||
<span class="absValue">
|
||
(0/1)
|
||
</span>
|
||
</td>
|
||
<td class="coverageStat">
|
||
<span class="percent">
|
||
0%
|
||
</span>
|
||
<span class="absValue">
|
||
(0/19)
|
||
</span>
|
||
</td>
|
||
<td class="coverageStat">
|
||
<span class="percent">
|
||
0%
|
||
</span>
|
||
<span class="absValue">
|
||
(0/34)
|
||
</span>
|
||
</td>
|
||
<td class="coverageStat">
|
||
<span class="percent">
|
||
0%
|
||
</span>
|
||
<span class="absValue">
|
||
(0/182)
|
||
</span>
|
||
</td>
|
||
</tr>
|
||
|
||
</table>
|
||
|
||
<br/>
|
||
<br/>
|
||
|
||
|
||
<pre>
|
||
<code class="sourceCode" id="sourceCode"> package it.polimi.ingsw.gc14.View.GUI;
|
||
|
||
import it.polimi.ingsw.gc14.Controller.ClientController;
|
||
import it.polimi.ingsw.gc14.Model.Player;
|
||
import javafx.animation.ScaleTransition;
|
||
import it.polimi.ingsw.gc14.Model.PlayableCard;
|
||
import javafx.event.Event;
|
||
import javafx.fxml.FXML;
|
||
import javafx.scene.Scene;
|
||
import javafx.scene.control.ScrollPane;
|
||
import javafx.stage.Popup;
|
||
import javafx.geometry.Insets;
|
||
import javafx.geometry.Pos;
|
||
import javafx.scene.Cursor;
|
||
import javafx.scene.Node;
|
||
import javafx.scene.control.Label;
|
||
import javafx.scene.effect.DropShadow;
|
||
import javafx.scene.image.Image;
|
||
import javafx.scene.image.ImageView;
|
||
import javafx.scene.input.MouseEvent;
|
||
import javafx.scene.layout.*;
|
||
import javafx.scene.paint.Color;
|
||
import javafx.scene.paint.LinearGradient;
|
||
import javafx.scene.paint.Stop;
|
||
import javafx.scene.paint.CycleMethod;
|
||
import javafx.scene.text.Font;
|
||
import javafx.stage.Stage;
|
||
import javafx.stage.Window;
|
||
import javafx.util.Duration;
|
||
|
||
import java.util.*;
|
||
|
||
/**
|
||
* FXML controller for the end-of-game leaderboard scene.
|
||
*
|
||
* <p>Displays the final player rankings and a winner/game-over banner.
|
||
*/
|
||
<b class="nc"> public class LeaderboardFXMLController {</b>
|
||
|
||
@FXML private StackPane rootPane;
|
||
@FXML private VBox mainVBox;
|
||
@FXML private VBox rankingList;
|
||
// title label removed; outcome text is added dynamically in render()
|
||
//TODO
|
||
private ClientController controller;
|
||
//TODO
|
||
private Popup popup;
|
||
//TODO
|
||
private VBox popupContent;
|
||
//TODO
|
||
<b class="nc"> private static final Map<String, Image> imageCache = new HashMap<>();</b>
|
||
//TODO
|
||
private Scene loginScene;
|
||
|
||
//TODO
|
||
private Runnable action;
|
||
|
||
/** Returns a cached {@link Image} for the given classpath {@code path}, loading it on first access. */
|
||
private Image loadImage(String path) {
|
||
<b class="nc"> return imageCache.computeIfAbsent(path,</b>
|
||
<b class="nc"> p -> new Image(getClass().getResourceAsStream(p)));</b>
|
||
}
|
||
|
||
|
||
/**
|
||
* Injects the client controller, a post-game action, and the login scene reference.
|
||
*
|
||
* @param controller the client controller.
|
||
* @param action the action to run when the player returns to the login screen.
|
||
* @param loginScene the login scene to show on exit.
|
||
*/
|
||
public void setController(ClientController controller, Runnable action, Scene loginScene) {
|
||
<b class="nc"> this.controller = controller;</b>
|
||
<b class="nc"> this.loginScene = loginScene;</b>
|
||
<b class="nc"> this.action = action;</b>
|
||
}
|
||
|
||
|
||
/** Initializes the scene: loads fonts, sets up the background, and initializes the popup. */
|
||
@FXML
|
||
public void initialize() {
|
||
<b class="nc"> Font.loadFont(getClass().getResourceAsStream("/Fonts/InknutAntiqua-Regular.ttf"), 14);</b>
|
||
<b class="nc"> mainVBox.sceneProperty().addListener((obs, oldScene, newScene) -> {</b>
|
||
<b class="nc"> if (newScene != null) newScene.getRoot().applyCss();</b>
|
||
});
|
||
<b class="nc"> renderBackground();</b>
|
||
<b class="nc"> initPopup();</b>
|
||
}
|
||
|
||
|
||
/** Populates the ranking list with the final player standings and shows the outcome banner. */
|
||
public void render() {
|
||
<b class="nc"> rankingList.getChildren().clear();</b>
|
||
<b class="nc"> if(!controller.getMiniModel().standingPlayers.isEmpty())</b>
|
||
{
|
||
<b class="nc"> List<Player> sorted = controller.getMiniModel().standingPlayers;</b>
|
||
|
||
<b class="nc"> boolean iWon = sorted.get(0).getUserName().equals(controller.getMyUsername());</b>
|
||
|
||
// Label grande Winner / Game Over
|
||
<b class="nc"> Label outcomeLabel = new Label(iWon ? "\uD83C\uDFC6 WINNER! \uD83C\uDFC6" : "GAME OVER");</b>
|
||
<b class="nc"> outcomeLabel.setStyle(</b>
|
||
"-fx-font-size: 64px;" +
|
||
"-fx-font-weight: bold;" +
|
||
<b class="nc"> "-fx-text-fill: " + (iWon ? "#FFD700;" : "#FF4444;")</b>
|
||
);
|
||
<b class="nc"> DropShadow glow = new DropShadow();</b>
|
||
<b class="nc"> glow.setColor(iWon ? Color.rgb(255, 200, 0, 0.95) : Color.rgb(220, 0, 0, 0.95));</b>
|
||
<b class="nc"> glow.setRadius(35);</b>
|
||
<b class="nc"> glow.setSpread(0.35);</b>
|
||
<b class="nc"> outcomeLabel.setEffect(glow);</b>
|
||
<b class="nc"> rankingList.getChildren().add(outcomeLabel);</b>
|
||
|
||
<b class="nc"> Region sep = new Region();</b>
|
||
<b class="nc"> sep.setPrefHeight(16);</b>
|
||
<b class="nc"> rankingList.getChildren().add(sep);</b>
|
||
|
||
<b class="nc"> for (int i = 0; i < sorted.size(); i++) {</b>
|
||
<b class="nc"> rankingList.getChildren().add(createPlayerRow(i + 1, sorted.get(i)));</b>
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
// ==== EFFECTS ====
|
||
/** Scales {@code node} to 1.02× on hover and sets a hand cursor. */
|
||
private void addHoverZoom(Node node) {
|
||
<b class="nc"> ScaleTransition scaleUp = new ScaleTransition(Duration.millis(150), node);</b>
|
||
<b class="nc"> scaleUp.setToX(1.02);</b>
|
||
<b class="nc"> scaleUp.setToY(1.02);</b>
|
||
<b class="nc"> ScaleTransition scaleDown = new ScaleTransition(Duration.millis(150), node);</b>
|
||
<b class="nc"> scaleDown.setToX(1.0);</b>
|
||
<b class="nc"> scaleDown.setToY(1.0);</b>
|
||
<b class="nc"> node.addEventHandler(MouseEvent.MOUSE_ENTERED, e -> { scaleUp.play(); node.setCursor(Cursor.HAND); });</b>
|
||
<b class="nc"> node.addEventHandler(MouseEvent.MOUSE_EXITED, e -> { scaleDown.play(); node.setCursor(Cursor.DEFAULT); });</b>
|
||
}
|
||
|
||
/** Applies a static drop-shadow to {@code node}. */
|
||
private void addShadow(Node node) {
|
||
<b class="nc"> DropShadow shadow = new DropShadow();</b>
|
||
<b class="nc"> shadow.setColor(Color.rgb(0, 0, 0, 0.6));</b>
|
||
<b class="nc"> shadow.setRadius(12);</b>
|
||
<b class="nc"> shadow.setOffsetX(3);</b>
|
||
<b class="nc"> shadow.setOffsetY(3);</b>
|
||
<b class="nc"> node.setEffect(shadow);</b>
|
||
}
|
||
|
||
|
||
// ==== ROW ====
|
||
/** Builds a styled leaderboard row showing rank, totem, username, stats, and prestige for {@code player}. */
|
||
private HBox createPlayerRow(int position, Player player) {
|
||
<b class="nc"> HBox row = new HBox(20);</b>
|
||
<b class="nc"> row.setAlignment(Pos.CENTER_LEFT);</b>
|
||
<b class="nc"> row.setPadding(new Insets(14, 28, 14, 28));</b>
|
||
<b class="nc"> row.setMaxWidth(Double.MAX_VALUE);</b>
|
||
|
||
<b class="nc"> LinearGradient gradient = new LinearGradient(</b>
|
||
0, 0, 1, 0, true, CycleMethod.NO_CYCLE,
|
||
<b class="nc"> new Stop(0.0, Color.rgb(0, 0, 0, 0.75)),</b>
|
||
<b class="nc"> new Stop(0.5, Color.rgb(0, 0, 0, 0.60)),</b>
|
||
<b class="nc"> new Stop(1.0, Color.rgb(0, 0, 0, 0.75))</b>
|
||
);
|
||
<b class="nc"> row.setBackground(new Background(new BackgroundFill(</b>
|
||
gradient,
|
||
new CornerRadii(12),
|
||
Insets.EMPTY
|
||
)));
|
||
<b class="nc"> addShadow(row);</b>
|
||
<b class="nc"> addHoverZoom(row);</b>
|
||
|
||
<b class="nc"> Label posLabel = new Label(position + "°");</b>
|
||
<b class="nc"> posLabel.setMinWidth(55);</b>
|
||
<b class="nc"> String medalColor = switch (position) {</b>
|
||
<b class="nc"> case 1 -> "#FFD700"; // oro</b>
|
||
<b class="nc"> case 2 -> "#C0C0C0"; // argento</b>
|
||
<b class="nc"> case 3 -> "#CD7F32"; // bronzo</b>
|
||
<b class="nc"> default -> "#EEEEEE";</b>
|
||
<b class="nc"> };</b>
|
||
<b class="nc"> posLabel.setStyle("-fx-font-size: 28px; -fx-font-weight: bold; -fx-text-fill: " + medalColor + ";");</b>
|
||
|
||
|
||
<b class="nc"> ImageView totem = new ImageView(loadImage(</b>
|
||
<b class="nc"> "/GUIImages/Totems/totem_" + player.getTotem().toString().toLowerCase(Locale.ROOT) + ".png"));</b>
|
||
<b class="nc"> totem.setFitHeight(55);</b>
|
||
<b class="nc"> totem.setPreserveRatio(true);</b>
|
||
|
||
<b class="nc"> Label nameLabel = new Label(player.getUserName());</b>
|
||
<b class="nc"> nameLabel.setStyle(</b>
|
||
"-fx-font-size: 22px; -fx-font-weight: bold; -fx-text-fill: " +
|
||
<b class="nc"> (player.getUserName().equals(controller.getMyUsername()) ? "#ff6b6b;" : "#FFFFFF;")</b>
|
||
);
|
||
<b class="nc"> HBox.setHgrow(nameLabel, Priority.ALWAYS);</b>
|
||
|
||
<b class="nc"> HBox stats = createStatsBox(player);</b>
|
||
|
||
<b class="nc"> HBox ppBox = new HBox(6);</b>
|
||
<b class="nc"> ppBox.setAlignment(Pos.CENTER);</b>
|
||
<b class="nc"> ImageView ppIcon = new ImageView(loadImage("/GUIImages/Icons/PrestigePoint.png"));</b>
|
||
<b class="nc"> ppIcon.setFitHeight(45);</b>
|
||
<b class="nc"> ppIcon.setPreserveRatio(true);</b>
|
||
<b class="nc"> Label ppLabel = new Label(String.valueOf(player.getPrestigeValue()));</b>
|
||
<b class="nc"> ppLabel.setStyle("-fx-font-size: 28px; -fx-font-weight: bold; -fx-text-fill: #FFD700;");</b>
|
||
<b class="nc"> ppBox.getChildren().addAll(ppIcon, ppLabel);</b>
|
||
|
||
<b class="nc"> row.getChildren().addAll(posLabel, totem, nameLabel, stats, ppBox);</b>
|
||
<b class="nc"> row.setOnMouseClicked(e -> openPlayerPopup(player));</b>
|
||
<b class="nc"> return row;</b>
|
||
}
|
||
|
||
/** Creates a compact icon+count stats strip for all card types of {@code player}. */
|
||
private HBox createStatsBox(Player player) {
|
||
<b class="nc"> HBox stats = new HBox(14);</b>
|
||
<b class="nc"> stats.setAlignment(Pos.CENTER);</b>
|
||
|
||
<b class="nc"> stats.getChildren().add(createStatItem("/GUIImages/Icons/Food.png", String.valueOf(player.getFoodValue()), 26));</b>
|
||
<b class="nc"> stats.getChildren().add(createStatItem("/GUIImages/Icons/Artist.png", String.valueOf(player.getArtists().size()), 26));</b>
|
||
<b class="nc"> stats.getChildren().add(createStatItem("/GUIImages/Icons/Gatherer.png", String.valueOf(player.getGatherers().size()), 26));</b>
|
||
<b class="nc"> stats.getChildren().add(createStatItem("/GUIImages/Icons/Inventor.png", String.valueOf(player.getInventors().size()), 26));</b>
|
||
<b class="nc"> stats.getChildren().add(createStatItem("/GUIImages/Icons/Builder.png", String.valueOf(player.getBuilders().size()), 26));</b>
|
||
<b class="nc"> stats.getChildren().add(createStatItem("/GUIImages/Icons/Shaman.png", String.valueOf(player.getShamans().size()), 26));</b>
|
||
<b class="nc"> stats.getChildren().add(createStatItem("/GUIImages/Icons/Hunter.png", String.valueOf(player.getHunters().size()), 26));</b>
|
||
<b class="nc"> stats.getChildren().add(createStatItem("/GUIImages/Icons/Building.png", String.valueOf(player.getBuildingCards().size()), 26));</b>
|
||
|
||
<b class="nc"> return stats;</b>
|
||
}
|
||
|
||
/** Creates a single icon + label widget for one stat type. */
|
||
private HBox createStatItem(String iconPath, String value, double iconHeight) {
|
||
<b class="nc"> HBox box = new HBox(4);</b>
|
||
<b class="nc"> box.setAlignment(Pos.CENTER);</b>
|
||
<b class="nc"> ImageView icon = new ImageView(loadImage(iconPath));</b>
|
||
<b class="nc"> icon.setFitHeight(iconHeight);</b>
|
||
<b class="nc"> icon.setPreserveRatio(true);</b>
|
||
<b class="nc"> Label label = new Label(value);</b>
|
||
<b class="nc"> label.setStyle("-fx-font-size: 16px; -fx-text-fill: #FFFFFF; -fx-font-weight: bold;");</b>
|
||
<b class="nc"> DropShadow textShadow = new DropShadow();</b>
|
||
<b class="nc"> textShadow.setColor(Color.rgb(0, 0, 0, 0.9));</b>
|
||
<b class="nc"> textShadow.setRadius(4);</b>
|
||
<b class="nc"> label.setEffect(textShadow);</b>
|
||
<b class="nc"> box.getChildren().addAll(icon, label);</b>
|
||
<b class="nc"> return box;</b>
|
||
}
|
||
|
||
|
||
// ==== POPUP ====
|
||
/** Creates and configures the auto-hiding player-detail popup. */
|
||
private void initPopup() {
|
||
<b class="nc"> popupContent = new VBox(12);</b>
|
||
<b class="nc"> popupContent.setAlignment(Pos.CENTER);</b>
|
||
<b class="nc"> popupContent.setPadding(new Insets(16));</b>
|
||
<b class="nc"> popupContent.setStyle(</b>
|
||
"-fx-background-color: rgba(20,10,5,0.97);" +
|
||
"-fx-border-color: #8B4513;" +
|
||
"-fx-border-width: 3;" +
|
||
"-fx-border-radius: 14;" +
|
||
"-fx-background-radius: 14;"
|
||
);
|
||
|
||
<b class="nc"> popup = new Popup();</b>
|
||
<b class="nc"> popup.getContent().add(popupContent);</b>
|
||
<b class="nc"> popup.setAutoHide(true);</b>
|
||
<b class="nc"> popup.addEventHandler(Event.ANY, e -> {</b>
|
||
<b class="nc"> if (popup.getScene() != null) popup.getScene().setFill(Color.TRANSPARENT);</b>
|
||
});
|
||
}
|
||
|
||
/** Opens the player-detail popup showing all cards held by {@code player}, grouped by type. */
|
||
private void openPlayerPopup(Player player) {
|
||
<b class="nc"> popupContent.getChildren().clear();</b>
|
||
|
||
<b class="nc"> HBox header = new HBox(10);</b>
|
||
<b class="nc"> header.setAlignment(Pos.CENTER);</b>
|
||
<b class="nc"> ImageView totem = new ImageView(loadImage(</b>
|
||
<b class="nc"> "/GUIImages/Totems/totem_" + player.getTotem().toString().toLowerCase(Locale.ROOT) + ".png"));</b>
|
||
<b class="nc"> totem.setFitHeight(30);</b>
|
||
<b class="nc"> totem.setPreserveRatio(true);</b>
|
||
<b class="nc"> Label nameLabel = new Label(player.getUserName());</b>
|
||
<b class="nc"> nameLabel.setStyle("-fx-font-size: 18px; -fx-font-weight: bold; -fx-text-fill: #FFD700;");</b>
|
||
<b class="nc"> header.getChildren().addAll(totem, nameLabel);</b>
|
||
<b class="nc"> popupContent.getChildren().add(header);</b>
|
||
|
||
<b class="nc"> String[][] types = {</b>
|
||
{"Artist", "artists"},
|
||
{"Gatherer", "gatherers"},
|
||
{"Inventor", "inventors"},
|
||
{"Builder", "builders"},
|
||
{"Shaman", "shamans"},
|
||
{"Hunter", "hunters"},
|
||
{"Building", "buildingCards"}
|
||
};
|
||
|
||
<b class="nc"> VBox grid = new VBox(6);</b>
|
||
<b class="nc"> grid.setAlignment(Pos.CENTER_LEFT);</b>
|
||
<b class="nc"> boolean hasAnyCard = false;</b>
|
||
|
||
<b class="nc"> for (String[] type : types) {</b>
|
||
<b class="nc"> String typeName = type[0];</b>
|
||
<b class="nc"> String field = type[1];</b>
|
||
<b class="nc"> ArrayList<PlayableCard> cards = getPlayerCards(player.getUserName(), field);</b>
|
||
<b class="nc"> if (cards.isEmpty()) continue;</b>
|
||
<b class="nc"> hasAnyCard = true;</b>
|
||
|
||
<b class="nc"> HBox row = new HBox(6);</b>
|
||
<b class="nc"> row.setAlignment(Pos.CENTER_LEFT);</b>
|
||
|
||
<b class="nc"> ImageView typeIcon = new ImageView(loadImage("/GUIImages/Icons/"+typeName+".png"));</b>
|
||
<b class="nc"> typeIcon.setFitHeight(22);</b>
|
||
<b class="nc"> typeIcon.setPreserveRatio(true);</b>
|
||
<b class="nc"> row.getChildren().add(typeIcon);</b>
|
||
|
||
<b class="nc"> for (PlayableCard card : cards) {</b>
|
||
<b class="nc"> ImageView img = new ImageView(loadImage("/GUIImages/Fronts/card-" + card.getIdIMG() + ".png"));</b>
|
||
<b class="nc"> img.setFitHeight(230);</b>
|
||
<b class="nc"> img.setPreserveRatio(true);</b>
|
||
<b class="nc"> img.setCursor(Cursor.HAND);</b>
|
||
<b class="nc"> row.getChildren().add(img);</b>
|
||
}
|
||
|
||
<b class="nc"> grid.getChildren().add(row);</b>
|
||
}
|
||
|
||
<b class="nc"> if (!hasAnyCard) {</b>
|
||
<b class="nc"> Label empty = new Label("No cards");</b>
|
||
<b class="nc"> empty.setStyle("-fx-font-size: 14px; -fx-text-fill: #888888;");</b>
|
||
<b class="nc"> grid.getChildren().add(empty);</b>
|
||
}
|
||
|
||
<b class="nc"> ScrollPane scrollPane = new ScrollPane(grid);</b>
|
||
<b class="nc"> scrollPane.setFitToWidth(true);</b>
|
||
<b class="nc"> scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);</b>
|
||
<b class="nc"> scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);</b>
|
||
<b class="nc"> scrollPane.setStyle("-fx-background: transparent; -fx-background-color: transparent;");</b>
|
||
|
||
<b class="nc"> Window window = rootPane.getScene().getWindow();</b>
|
||
<b class="nc"> scrollPane.setMaxHeight(window.getHeight() * 0.8); // cap scroll area to 80% of window height</b>
|
||
<b class="nc"> popupContent.getChildren().add(scrollPane);</b>
|
||
<b class="nc"> popup.show(window, 0, 0);</b>
|
||
<b class="nc"> popup.getScene().setFill(Color.TRANSPARENT);</b>
|
||
<b class="nc"> popup.setX(window.getX() + (window.getWidth() - popup.getWidth()) / 2);</b>
|
||
<b class="nc"> popup.setY(window.getY() + (window.getHeight() - popup.getHeight()) / 2);</b>
|
||
}
|
||
|
||
/** Returns a copy of the named card collection for {@code username}. */
|
||
private ArrayList<PlayableCard> getPlayerCards(String username, String type) {
|
||
<b class="nc"> Player p = controller.getMiniModel().players.get(username);</b>
|
||
<b class="nc"> return switch (type) {</b>
|
||
<b class="nc"> case "artists" -> new ArrayList<>(p.getArtists());</b>
|
||
<b class="nc"> case "gatherers" -> new ArrayList<>(p.getGatherers());</b>
|
||
<b class="nc"> case "inventors" -> new ArrayList<>(p.getInventors());</b>
|
||
<b class="nc"> case "builders" -> new ArrayList<>(p.getBuilders());</b>
|
||
<b class="nc"> case "shamans" -> new ArrayList<>(p.getShamans());</b>
|
||
<b class="nc"> case "hunters" -> new ArrayList<>(p.getHunters());</b>
|
||
<b class="nc"> case "buildingCards" -> new ArrayList<>(p.getBuildingCards());</b>
|
||
<b class="nc"> default -> new ArrayList<>();</b>
|
||
};
|
||
}
|
||
|
||
// ==== BACKGROUND ====
|
||
/** Sets the full-cover background image on the root pane. */
|
||
private void renderBackground() {
|
||
<b class="nc"> BackgroundSize size = new BackgroundSize(</b>
|
||
BackgroundSize.AUTO, BackgroundSize.AUTO,
|
||
false, false, true, true
|
||
);
|
||
<b class="nc"> rootPane.setBackground(new Background(new BackgroundImage(</b>
|
||
<b class="nc"> loadImage("/GUIImages/Background.png"),</b>
|
||
BackgroundRepeat.NO_REPEAT,
|
||
BackgroundRepeat.NO_REPEAT,
|
||
BackgroundPosition.CENTER,
|
||
size
|
||
)));
|
||
}
|
||
|
||
|
||
// ==== ACTIONS ====
|
||
/** Disconnects the client and invokes the post-game action to return to the login scene. */
|
||
@FXML
|
||
private void onNewGame() {
|
||
<b class="nc"> controller.disconnect();</b>
|
||
<b class="nc"> action.run();</b>
|
||
}
|
||
}
|
||
</code>
|
||
</pre>
|
||
</div>
|
||
|
||
<script type="text/javascript">
|
||
(function() {
|
||
var msie = false, msie9 = false;
|
||
/*@cc_on
|
||
msie = true;
|
||
@if (@_jscript_version >= 9)
|
||
msie9 = true;
|
||
@end
|
||
@*/
|
||
|
||
if (!msie || msie && msie9) {
|
||
hljs.highlightAll()
|
||
hljs.initLineNumbersOnLoad();
|
||
}
|
||
})();
|
||
</script>
|
||
|
||
<div class="footer">
|
||
|
||
<div style="float:right;">generated on 2026-06-14 21:53</div>
|
||
</div>
|
||
</body>
|
||
</html>
|