From 9315f8728803e936251f5fd6e704ce19562cb2a8 Mon Sep 17 00:00:00 2001 From: Arelodgaard Date: Tue, 26 May 2026 07:07:11 +0200 Subject: [PATCH 1/2] Added initial game end view and functionality --- .../gruppe53/controller/GameController.java | 52 +++++- .../java/no/ntnu/gruppe53/view/EndView.java | 153 ++++++++++++++++++ .../no/ntnu/gruppe53/view/NavigationBar.java | 15 +- .../src/main/resources/i18n/lang.properties | 9 +- .../main/resources/i18n/lang_en.properties | 3 +- .../main/resources/i18n/lang_no.properties | 1 + millions/target/classes/i18n/lang.properties | 9 +- .../target/classes/i18n/lang_en.properties | 3 +- .../target/classes/i18n/lang_no.properties | 1 + .../compile/default-compile/createdFiles.lst | 1 + .../compile/default-compile/inputFiles.lst | 1 + 11 files changed, 241 insertions(+), 7 deletions(-) create mode 100644 millions/src/main/java/no/ntnu/gruppe53/view/EndView.java diff --git a/millions/src/main/java/no/ntnu/gruppe53/controller/GameController.java b/millions/src/main/java/no/ntnu/gruppe53/controller/GameController.java index 5228eb9..9acbb78 100644 --- a/millions/src/main/java/no/ntnu/gruppe53/controller/GameController.java +++ b/millions/src/main/java/no/ntnu/gruppe53/controller/GameController.java @@ -1,9 +1,13 @@ package no.ntnu.gruppe53.controller; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.List; +import javafx.application.Platform; import javafx.scene.control.Alert; +import javafx.scene.control.ButtonBar; +import javafx.scene.control.ButtonType; import javafx.stage.Stage; import javafx.util.Subscription; import no.ntnu.gruppe53.model.*; @@ -26,6 +30,7 @@ public class GameController { private MarketView marketView; private PortfolioView portfolioView; private TransactionArchiveView transactionArchiveView; + private EndView endView; private PurchaseCalculator purchaseCalculator; private SaleCalculator saleCalculator; @@ -71,6 +76,8 @@ public void startNewGame() { transactionArchiveView = new TransactionArchiveView(); transactionArchiveView.setPlayer(player); + endView = new EndView(); + sharedNav.bindPlayer(player); sharedNav.bindExchange(exchange); sharedFooter.setExchange(exchange); @@ -78,6 +85,7 @@ public void startNewGame() { vm.addView("portfolio", portfolioView); vm.addView("market", marketView); vm.addView("history", transactionArchiveView); + vm.addView("endGame", endView); initialize(sharedNav, sharedFooter); @@ -97,7 +105,7 @@ public void showMarketView() { /** * Switches the view to the {@link PortfolioView}. *

Contains the data from a player's {@link Portfolio}.

- *

PortfolioView lets the player perform {@link Sale} transactions.

+ *

PortfolioView lets theEndView player perform {@link Sale} transactions.

*/ public void showPortfolio() { if (portfolioView != null) vm.switchView("portfolio"); @@ -123,6 +131,7 @@ public void initialize(NavigationBar nav, FooterBar footer) { nav.onMarketButtonClick(() -> vm.switchView("market")); nav.onPortfolioButtonClick(() -> vm.switchView("portfolio")); nav.onHistoryButtonClick(() -> vm.switchView("history")); + nav.onEndGameButtonClick(() -> endGame()); footer.onLanguageChange(selected -> { lm.setLocale(selected.locale()); @@ -168,7 +177,6 @@ public void initialize(NavigationBar nav, FooterBar footer) { Stock stock = marketView.getSelectedStock(); if (stock != null) purchaseStock(stock.getSymbol(), marketView.getQuantityPurchase()); }); - marketView.onQuantitySelect(() -> { if (marketView.getSelectedStock() != null) { marketView.setPurchaseCalculator(calculatePurchase(marketView.getSelectedStock(), @@ -198,7 +206,11 @@ public void initialize(NavigationBar nav, FooterBar footer) { portfolioView.onSellButton(this::handleSell); + endView.onQuitButton(Platform::exit); + endView.onNewGameButton(() -> { + startNewGame(); + }); } /** @@ -270,6 +282,42 @@ private SaleCalculator calculateSale(Share share) { } + private void endGame() { + Alert alert = new Alert(Alert.AlertType.CONFIRMATION); + alert.setTitle("End Game?"); + alert.setHeaderText("Are you sure?"); + alert.setContentText("Do you want to end the current game?"); + + ButtonType yesButton = new ButtonType("Yes", ButtonBar.ButtonData.YES); + ButtonType noButton = new ButtonType("No", ButtonBar.ButtonData.NO); + + + alert.getButtonTypes().setAll(yesButton, noButton); + + alert.showAndWait().ifPresent(button -> { + if (button == yesButton) { + sellPortfolio(); + vm.setGlobalPanels(null, null); + vm.switchView("endGame"); + + endView.getStatusLabel().setText(player.getStatus(exchange)); + endView.getMoneyLabel().setText(player.getMoney().setScale(2, RoundingMode.HALF_EVEN).toString()); + + + + } + }); + + } + + private void sellPortfolio() { + List sharesToSell = List.copyOf(player.getPortfolio().getShares()); + + for (Share share : sharesToSell) { + exchange.sell(share, player); + } + } + /** * Creates a default error alert to be used for notifying the player of errors. * @param title title of the error alert diff --git a/millions/src/main/java/no/ntnu/gruppe53/view/EndView.java b/millions/src/main/java/no/ntnu/gruppe53/view/EndView.java new file mode 100644 index 0000000..3f373e1 --- /dev/null +++ b/millions/src/main/java/no/ntnu/gruppe53/view/EndView.java @@ -0,0 +1,153 @@ +package no.ntnu.gruppe53.view; + +import javafx.geometry.Insets; +import javafx.geometry.Pos; +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.layout.*; +import no.ntnu.gruppe53.service.LanguageManager; + +public class EndView extends BorderPane { + + + private Button newGameButton; + private Button quitButton; + + private Label statusLabel; + private Label moneyLabel; + + + private final LanguageManager lm = LanguageManager.getInstance(); + + public EndView() { + this.setCenter(centerPane()); + } + + private BorderPane centerPane() { + BorderPane pane = new BorderPane(); + pane.setPadding(new Insets(15, 12, 15, 12)); + //pane.setSpacing(10); + //Blue Background color + pane.setStyle("-fx-background-color: #00bcf0;"); + + VBox centerPane = new VBox(); + + HBox statusLabelBox = new HBox(); + Label statusLabelText = new Label(); + statusLabelText.textProperty().bind(lm.bindString("statusLabelText")); + statusLabel = new Label(); + + statusLabelBox.setStyle("-fx-background-color: #ffe556;" + + "-fx-text-fill: #303539;" + + "-fx-background-radius: 8;" + + "-fx-border-color: #303539;" + + "-fx-border-radius: 8;" + ); + statusLabelBox.setPadding(new Insets(8, 14, 8, 14)); + statusLabelBox.setAlignment(Pos.CENTER); + statusLabelBox.setMinHeight(65); + + statusLabelBox.getChildren().addAll(statusLabelText, statusLabel); + + HBox moneyLabelBox = new HBox(); + Label moneyLabelText = new Label(); + moneyLabelText.textProperty().bind(lm.bindString("navMoneyLabelText")); + moneyLabel = new Label(); + + moneyLabelBox.setStyle("-fx-background-color: #ffe556;" + + "-fx-text-fill: #303539;" + + "-fx-background-radius: 8;" + + "-fx-border-color: #303539;" + + "-fx-border-radius: 8;" + ); + moneyLabelBox.setPadding(new Insets(8, 14, 8, 14)); + moneyLabelBox.setAlignment(Pos.CENTER); + moneyLabelBox.setMinHeight(65); + + moneyLabelBox.getChildren().addAll(moneyLabelText, moneyLabel); + + centerPane.setPadding(new Insets(15, 12, 15, 12)); + centerPane.setAlignment(Pos.CENTER); + centerPane.setSpacing(10); + centerPane.setMaxWidth(700); + centerPane.getChildren().addAll(statusLabelBox, moneyLabelBox); + + HBox quitButtonBox = new HBox(); + quitButton = new Button(); + quitButton.textProperty().bind(lm.bindString("quitButton")); + quitButton.setPrefSize(200, 50); + quitButton.setStyle("-fx-text-fill: #303539;" + + "-fx-font-size: 18px;" + + "-fx-border-color: #303539;" + + "-fx-border-radius: 8;" + + "-fx-background-radius: 8;" + ); + + + quitButtonBox.setStyle("-fx-background-color: #ffe556;" + + "-fx-text-fill: #303539;" + + "-fx-background-radius: 8;" + + "-fx-border-color: #303539;" + + "-fx-border-radius: 8;" + ); + quitButtonBox.setPadding(new Insets(8, 14, 8, 14)); + quitButtonBox.setAlignment(Pos.CENTER); + + + quitButtonBox.getChildren().addAll(quitButton); + + HBox newGameButtonBox = new HBox(); + newGameButton = new Button(); + newGameButton.textProperty().bind(lm.bindString("newGameButton")); + newGameButton.setPrefSize(200, 50); + newGameButton.setStyle("-fx-text-fill: #303539;" + + "-fx-font-size: 18px;" + + "-fx-border-color: #303539;" + + "-fx-border-radius: 8;" + + "-fx-background-radius: 8;" + ); + newGameButtonBox.setStyle("-fx-background-color: #ffe556;" + + "-fx-text-fill: #303539;" + + "-fx-background-radius: 8;" + + "-fx-border-color: #303539;" + + "-fx-border-radius: 8;" + ); + newGameButtonBox.setPadding(new Insets(8, 14, 8, 14)); + newGameButtonBox.setAlignment(Pos.CENTER); + newGameButtonBox.getChildren().add(newGameButton); + + HBox buttons = new HBox(quitButtonBox, newGameButtonBox); + + + + Region spacerBottomLeft = new Region(); + Region spacerBottomRight = new Region(); + + HBox.setHgrow(spacerBottomLeft, Priority.ALWAYS); + HBox.setHgrow(spacerBottomRight, Priority.ALWAYS); + + HBox bottomPane = new HBox(spacerBottomLeft, buttons, spacerBottomRight); + + pane.setCenter(centerPane); + pane.setBottom(bottomPane); + + return pane; + } + + + public void onQuitButton(Runnable action) { + quitButton.setOnAction(e -> action.run()); + } + + public void onNewGameButton(Runnable action) { + newGameButton.setOnAction(e -> action.run()); + } + + public Label getStatusLabel() { + return statusLabel; + } + + public Label getMoneyLabel() { + return moneyLabel; + } +} diff --git a/millions/src/main/java/no/ntnu/gruppe53/view/NavigationBar.java b/millions/src/main/java/no/ntnu/gruppe53/view/NavigationBar.java index c44680b..2360452 100644 --- a/millions/src/main/java/no/ntnu/gruppe53/view/NavigationBar.java +++ b/millions/src/main/java/no/ntnu/gruppe53/view/NavigationBar.java @@ -36,6 +36,7 @@ public class NavigationBar extends HBox { private final Button marketButton; private final Button portfolioButton; private final Button historyButton; + private final Button endGameButton; private Subscription netWorthSubscription; private Subscription moneySubscription; private Subscription currentWeekSubscription; @@ -151,7 +152,11 @@ public NavigationBar() { networthBox.setAlignment(Pos.CENTER); networthBox.getChildren().addAll(networthLabelText, netWorthLabel); - this.getChildren().addAll(marketButton, portfolioButton, historyButton, spacer, playerBox, statusBox, moneyBox, networthBox); + endGameButton = new Button(); + endGameButton.textProperty().bind(lm.bindString("endGameButton")); + endGameButton.setStyle("-fx-background-color: #ffe556; -fx-text-fill: #303539;"); + + this.getChildren().addAll(marketButton, portfolioButton, historyButton, spacer, playerBox, statusBox, moneyBox, networthBox, endGameButton); } /** * Exposes the marketButton to the GameController. @@ -180,6 +185,14 @@ public void onHistoryButtonClick(Runnable action) { historyButton.setOnAction(e -> action.run()); } + /** + * Exposes the endGameButton to the GameController. + * + * @param action the action to be run when clicking the button + */ + public void onEndGameButtonClick(Runnable action) { + endGameButton.setOnAction(e -> action.run()); + } /** diff --git a/millions/src/main/resources/i18n/lang.properties b/millions/src/main/resources/i18n/lang.properties index 61c65d9..8c215d4 100644 --- a/millions/src/main/resources/i18n/lang.properties +++ b/millions/src/main/resources/i18n/lang.properties @@ -26,7 +26,8 @@ navPlayerLabelText = Player: marketButton = Market portfolioButton = Portfolio historyButton = History -statusLabelText = Status: +statusLabelText = Level: +endGameButton = End Game # FooterBar currentWeekLabelText = Current Week: @@ -63,3 +64,9 @@ historyTitle=Transaction History historyTypePurchase=Purchase historyTypeSale=Sale historyCellFormat=Week %d | %s | %s | Qty: %s | Total: $%s + +# EndView +newGameButton = New Game +quitButton = Quit + + diff --git a/millions/src/main/resources/i18n/lang_en.properties b/millions/src/main/resources/i18n/lang_en.properties index 0c7bae8..2cf482e 100644 --- a/millions/src/main/resources/i18n/lang_en.properties +++ b/millions/src/main/resources/i18n/lang_en.properties @@ -26,7 +26,8 @@ navPlayerLabelText = Player: marketButton = Market portfolioButton = Portfolio historyButton = History -statusLabelText = Status: +statusLabelText = Level: +endGameButton = End Game # FooterBar currentWeekLabelText = Current Week: diff --git a/millions/src/main/resources/i18n/lang_no.properties b/millions/src/main/resources/i18n/lang_no.properties index b61e8e7..e393ba3 100644 --- a/millions/src/main/resources/i18n/lang_no.properties +++ b/millions/src/main/resources/i18n/lang_no.properties @@ -27,6 +27,7 @@ marketButton = Marked portfolioButton = Portefølje historyButton = Historikk statusLabelText = Nivå: +endGameButton = Avslutt Spill # FooterBar currentWeekLabelText = Gjeldende Uke: diff --git a/millions/target/classes/i18n/lang.properties b/millions/target/classes/i18n/lang.properties index 61c65d9..8c215d4 100644 --- a/millions/target/classes/i18n/lang.properties +++ b/millions/target/classes/i18n/lang.properties @@ -26,7 +26,8 @@ navPlayerLabelText = Player: marketButton = Market portfolioButton = Portfolio historyButton = History -statusLabelText = Status: +statusLabelText = Level: +endGameButton = End Game # FooterBar currentWeekLabelText = Current Week: @@ -63,3 +64,9 @@ historyTitle=Transaction History historyTypePurchase=Purchase historyTypeSale=Sale historyCellFormat=Week %d | %s | %s | Qty: %s | Total: $%s + +# EndView +newGameButton = New Game +quitButton = Quit + + diff --git a/millions/target/classes/i18n/lang_en.properties b/millions/target/classes/i18n/lang_en.properties index 0c7bae8..2cf482e 100644 --- a/millions/target/classes/i18n/lang_en.properties +++ b/millions/target/classes/i18n/lang_en.properties @@ -26,7 +26,8 @@ navPlayerLabelText = Player: marketButton = Market portfolioButton = Portfolio historyButton = History -statusLabelText = Status: +statusLabelText = Level: +endGameButton = End Game # FooterBar currentWeekLabelText = Current Week: diff --git a/millions/target/classes/i18n/lang_no.properties b/millions/target/classes/i18n/lang_no.properties index b61e8e7..e393ba3 100644 --- a/millions/target/classes/i18n/lang_no.properties +++ b/millions/target/classes/i18n/lang_no.properties @@ -27,6 +27,7 @@ marketButton = Marked portfolioButton = Portefølje historyButton = Historikk statusLabelText = Nivå: +endGameButton = Avslutt Spill # FooterBar currentWeekLabelText = Gjeldende Uke: diff --git a/millions/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/millions/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst index 2f61388..b0b4c17 100644 --- a/millions/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ b/millions/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -7,5 +7,6 @@ no/ntnu/gruppe53/controller/StartViewController.class no/ntnu/gruppe53/service/LanguageManager.class no/ntnu/gruppe53/model/SaleFactory.class no/ntnu/gruppe53/service/LanguageOption.class +no/ntnu/gruppe53/view/EndView.class no/ntnu/gruppe53/model/TransactionFactory.class no/ntnu/gruppe53/service/LanguageRegistry.class diff --git a/millions/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/millions/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index 5cf1ce9..5fa44b0 100644 --- a/millions/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/millions/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -25,6 +25,7 @@ /home/alodgaard/Programmering/Skole/Prog 2/Millions/millions/src/main/java/no/ntnu/gruppe53/service/LanguageRegistry.java /home/alodgaard/Programmering/Skole/Prog 2/Millions/millions/src/main/java/no/ntnu/gruppe53/service/StockLineChartService.java /home/alodgaard/Programmering/Skole/Prog 2/Millions/millions/src/main/java/no/ntnu/gruppe53/view/CSVChooserView.java +/home/alodgaard/Programmering/Skole/Prog 2/Millions/millions/src/main/java/no/ntnu/gruppe53/view/EndView.java /home/alodgaard/Programmering/Skole/Prog 2/Millions/millions/src/main/java/no/ntnu/gruppe53/view/FooterBar.java /home/alodgaard/Programmering/Skole/Prog 2/Millions/millions/src/main/java/no/ntnu/gruppe53/view/MarketView.java /home/alodgaard/Programmering/Skole/Prog 2/Millions/millions/src/main/java/no/ntnu/gruppe53/view/NavigationBar.java From b50ac32134b79e22bec5a30b45ae3b0d11376f88 Mon Sep 17 00:00:00 2001 From: Arelodgaard Date: Tue, 26 May 2026 07:45:20 +0200 Subject: [PATCH 2/2] Added localization --- .../gruppe53/controller/GameController.java | 15 +++-- .../java/no/ntnu/gruppe53/view/EndView.java | 58 +++++++++++++++++-- .../src/main/resources/i18n/lang.properties | 13 ++++- .../main/resources/i18n/lang_en.properties | 12 ++++ .../main/resources/i18n/lang_no.properties | 14 ++++- millions/target/classes/i18n/lang.properties | 13 ++++- .../target/classes/i18n/lang_en.properties | 12 ++++ .../target/classes/i18n/lang_no.properties | 14 ++++- 8 files changed, 136 insertions(+), 15 deletions(-) diff --git a/millions/src/main/java/no/ntnu/gruppe53/controller/GameController.java b/millions/src/main/java/no/ntnu/gruppe53/controller/GameController.java index 9acbb78..d8ea407 100644 --- a/millions/src/main/java/no/ntnu/gruppe53/controller/GameController.java +++ b/millions/src/main/java/no/ntnu/gruppe53/controller/GameController.java @@ -282,14 +282,19 @@ private SaleCalculator calculateSale(Share share) { } + + /** + * Creates an alert where the Player can confirm if they want to end the game. + * If yes, then sells entire portfolio and displays the EndView. + */ private void endGame() { Alert alert = new Alert(Alert.AlertType.CONFIRMATION); - alert.setTitle("End Game?"); - alert.setHeaderText("Are you sure?"); - alert.setContentText("Do you want to end the current game?"); + alert.titleProperty().bind(lm.bindString("endGameAlertTitle")); + alert.headerTextProperty().bind(lm.bindString("endGameAlertHeaderText")); + alert.contentTextProperty().bind(lm.bindString("endGameAlertContentText")); - ButtonType yesButton = new ButtonType("Yes", ButtonBar.ButtonData.YES); - ButtonType noButton = new ButtonType("No", ButtonBar.ButtonData.NO); + ButtonType yesButton = new ButtonType(lm.getString("yes"), ButtonBar.ButtonData.YES); + ButtonType noButton = new ButtonType(lm.getString("no"), ButtonBar.ButtonData.NO); alert.getButtonTypes().setAll(yesButton, noButton); diff --git a/millions/src/main/java/no/ntnu/gruppe53/view/EndView.java b/millions/src/main/java/no/ntnu/gruppe53/view/EndView.java index 3f373e1..9ac97de 100644 --- a/millions/src/main/java/no/ntnu/gruppe53/view/EndView.java +++ b/millions/src/main/java/no/ntnu/gruppe53/view/EndView.java @@ -5,8 +5,15 @@ import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.layout.*; +import javafx.scene.text.TextAlignment; import no.ntnu.gruppe53.service.LanguageManager; + +/** + * Represents the End Game screen, showing the Level the Player reached, + * money earned in total after selling portfolio and gives the option + * to quit the program or start a new game. + */ public class EndView extends BorderPane { @@ -32,10 +39,30 @@ private BorderPane centerPane() { VBox centerPane = new VBox(); + HBox congratsBox = new HBox(); + Label congratsLabel = new Label(); + congratsLabel.textProperty().bind(lm.bindString("congratsLabel")); + congratsLabel.setStyle("-fx-font-size: 18"); + congratsLabel.setTextAlignment(TextAlignment.CENTER); + + congratsBox.setStyle("-fx-background-color: #ffe556;" + + "-fx-text-fill: #303539;" + + "-fx-background-radius: 8;" + + "-fx-border-color: #303539;" + + "-fx-border-radius: 8;" + ); + congratsBox.setPadding(new Insets(8, 14, 8, 14)); + congratsBox.setAlignment(Pos.CENTER); + congratsBox.setMinHeight(65); + + congratsBox.getChildren().add(congratsLabel); + HBox statusLabelBox = new HBox(); Label statusLabelText = new Label(); statusLabelText.textProperty().bind(lm.bindString("statusLabelText")); + statusLabelText.setStyle("-fx-font-size: 18"); statusLabel = new Label(); + statusLabel.setStyle("-fx-font-size: 18"); statusLabelBox.setStyle("-fx-background-color: #ffe556;" + "-fx-text-fill: #303539;" + @@ -52,7 +79,9 @@ private BorderPane centerPane() { HBox moneyLabelBox = new HBox(); Label moneyLabelText = new Label(); moneyLabelText.textProperty().bind(lm.bindString("navMoneyLabelText")); + moneyLabelText.setStyle("-fx-font-size: 18"); moneyLabel = new Label(); + moneyLabel.setStyle("-fx-font-size: 18"); moneyLabelBox.setStyle("-fx-background-color: #ffe556;" + "-fx-text-fill: #303539;" + @@ -70,11 +99,13 @@ private BorderPane centerPane() { centerPane.setAlignment(Pos.CENTER); centerPane.setSpacing(10); centerPane.setMaxWidth(700); - centerPane.getChildren().addAll(statusLabelBox, moneyLabelBox); + + + centerPane.getChildren().addAll(congratsBox, statusLabelBox, moneyLabelBox); HBox quitButtonBox = new HBox(); quitButton = new Button(); - quitButton.textProperty().bind(lm.bindString("quitButton")); + quitButton.textProperty().bind(lm.bindString("quitGame")); quitButton.setPrefSize(200, 50); quitButton.setStyle("-fx-text-fill: #303539;" + "-fx-font-size: 18px;" + @@ -98,7 +129,7 @@ private BorderPane centerPane() { HBox newGameButtonBox = new HBox(); newGameButton = new Button(); - newGameButton.textProperty().bind(lm.bindString("newGameButton")); + newGameButton.textProperty().bind(lm.bindString("newGame")); newGameButton.setPrefSize(200, 50); newGameButton.setStyle("-fx-text-fill: #303539;" + "-fx-font-size: 18px;" + @@ -134,19 +165,38 @@ private BorderPane centerPane() { return pane; } - + /** + * Sets the action to be run when clicking the quit button + * + * @param action the action to run when clicking the quit button + */ public void onQuitButton(Runnable action) { quitButton.setOnAction(e -> action.run()); } + /** + * Sets the action to be run when clicking the New Game button + * + * @param action the action to run when clicking the New Game button + */ public void onNewGameButton(Runnable action) { newGameButton.setOnAction(e -> action.run()); } + /** + * Returns the statusLabel. + * + * @return the statusLabel + */ public Label getStatusLabel() { return statusLabel; } + /** + * Returns the moneyLabel. + * + * @return the moneyLabel + */ public Label getMoneyLabel() { return moneyLabel; } diff --git a/millions/src/main/resources/i18n/lang.properties b/millions/src/main/resources/i18n/lang.properties index 8c215d4..01a4ec3 100644 --- a/millions/src/main/resources/i18n/lang.properties +++ b/millions/src/main/resources/i18n/lang.properties @@ -1,5 +1,9 @@ # Default file to use if there is an error with language locale +# General +yes = Yes +no = No + # StartView newGame = New Game languageButtonLabel = Toggle Language @@ -66,7 +70,12 @@ historyTypeSale=Sale historyCellFormat=Week %d | %s | %s | Qty: %s | Total: $%s # EndView -newGameButton = New Game -quitButton = Quit +congratsLabel = Thank you for playing Millions!\nBelow you can see what level you reached and the amount of\nmoney you ended up with!\nYou can also choose to start a new game. + +# EndGameAlert +endGameAlertTitle = Ending Game +endGameAlertHeaderText=Warning, this ends the game! +endGameAlertContentText = Are your sure you want to end the game? + diff --git a/millions/src/main/resources/i18n/lang_en.properties b/millions/src/main/resources/i18n/lang_en.properties index 2cf482e..3cd4ac9 100644 --- a/millions/src/main/resources/i18n/lang_en.properties +++ b/millions/src/main/resources/i18n/lang_en.properties @@ -1,5 +1,9 @@ # File for the english language +# General +yes = Yes +no = No + # StartView newGame = New Game languageButtonLabel = Toggle Language @@ -64,3 +68,11 @@ historyTitle=Transaction History historyTypePurchase=Purchase historyTypeSale=Sale historyCellFormat=Week %d | %s | %s | Qty: %s | Total: $%s + +# EndView +congratsLabel = Thank you for playing Millions!\nBelow you can see what level you reachedand the amount of\nmoney you ended up with!\nYou can also choose to start a new game. + +# EndGameAlert +endGameAlertTitle = Ending Game +endGameAlertHeaderText=Warning, this ends the game! +endGameAlertContentText = Are your sure you want to end the game? diff --git a/millions/src/main/resources/i18n/lang_no.properties b/millions/src/main/resources/i18n/lang_no.properties index e393ba3..c8bdec5 100644 --- a/millions/src/main/resources/i18n/lang_no.properties +++ b/millions/src/main/resources/i18n/lang_no.properties @@ -1,5 +1,9 @@ # File for the norwegian language +# General +yes = Ja +no = Nei + # StartView newGame = Nytt Spill languageButtonLabel = Skift Språk @@ -63,4 +67,12 @@ portfolioCurrentPrice = Gjeldende pris: historyTitle=Transaksjonshistorikk historyTypePurchase=Kjøp historyTypeSale=Salg -historyCellFormat=Uke %d | %s | %s | Ant: %s | Total: $%s \ No newline at end of file +historyCellFormat=Uke %d | %s | %s | Ant: %s | Total: $%s + +# EndView +congratsLabel = Takk for at du spilte Millions!\nNedenfor kan du se hvilket nivå du nådde opp til\nog din endelige saldo!\nDu kan også velge å starte et nytt spill. + +# EndGameAlert +endGameAlertTitle = Avslutter Spill +endGameAlertHeaderText= Advarsel, dette vil avslutte spillet! +endGameAlertContentText = Er du sikker på at du vil avslutte spillet? \ No newline at end of file diff --git a/millions/target/classes/i18n/lang.properties b/millions/target/classes/i18n/lang.properties index 8c215d4..01a4ec3 100644 --- a/millions/target/classes/i18n/lang.properties +++ b/millions/target/classes/i18n/lang.properties @@ -1,5 +1,9 @@ # Default file to use if there is an error with language locale +# General +yes = Yes +no = No + # StartView newGame = New Game languageButtonLabel = Toggle Language @@ -66,7 +70,12 @@ historyTypeSale=Sale historyCellFormat=Week %d | %s | %s | Qty: %s | Total: $%s # EndView -newGameButton = New Game -quitButton = Quit +congratsLabel = Thank you for playing Millions!\nBelow you can see what level you reached and the amount of\nmoney you ended up with!\nYou can also choose to start a new game. + +# EndGameAlert +endGameAlertTitle = Ending Game +endGameAlertHeaderText=Warning, this ends the game! +endGameAlertContentText = Are your sure you want to end the game? + diff --git a/millions/target/classes/i18n/lang_en.properties b/millions/target/classes/i18n/lang_en.properties index 2cf482e..3cd4ac9 100644 --- a/millions/target/classes/i18n/lang_en.properties +++ b/millions/target/classes/i18n/lang_en.properties @@ -1,5 +1,9 @@ # File for the english language +# General +yes = Yes +no = No + # StartView newGame = New Game languageButtonLabel = Toggle Language @@ -64,3 +68,11 @@ historyTitle=Transaction History historyTypePurchase=Purchase historyTypeSale=Sale historyCellFormat=Week %d | %s | %s | Qty: %s | Total: $%s + +# EndView +congratsLabel = Thank you for playing Millions!\nBelow you can see what level you reachedand the amount of\nmoney you ended up with!\nYou can also choose to start a new game. + +# EndGameAlert +endGameAlertTitle = Ending Game +endGameAlertHeaderText=Warning, this ends the game! +endGameAlertContentText = Are your sure you want to end the game? diff --git a/millions/target/classes/i18n/lang_no.properties b/millions/target/classes/i18n/lang_no.properties index e393ba3..c8bdec5 100644 --- a/millions/target/classes/i18n/lang_no.properties +++ b/millions/target/classes/i18n/lang_no.properties @@ -1,5 +1,9 @@ # File for the norwegian language +# General +yes = Ja +no = Nei + # StartView newGame = Nytt Spill languageButtonLabel = Skift Språk @@ -63,4 +67,12 @@ portfolioCurrentPrice = Gjeldende pris: historyTitle=Transaksjonshistorikk historyTypePurchase=Kjøp historyTypeSale=Salg -historyCellFormat=Uke %d | %s | %s | Ant: %s | Total: $%s \ No newline at end of file +historyCellFormat=Uke %d | %s | %s | Ant: %s | Total: $%s + +# EndView +congratsLabel = Takk for at du spilte Millions!\nNedenfor kan du se hvilket nivå du nådde opp til\nog din endelige saldo!\nDu kan også velge å starte et nytt spill. + +# EndGameAlert +endGameAlertTitle = Avslutter Spill +endGameAlertHeaderText= Advarsel, dette vil avslutte spillet! +endGameAlertContentText = Er du sikker på at du vil avslutte spillet? \ No newline at end of file