diff --git a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/WidgetEnum.java b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/WidgetEnum.java index 5efcbb0..9bf85ac 100644 --- a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/WidgetEnum.java +++ b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/WidgetEnum.java @@ -1,10 +1,39 @@ package edu.ntnu.idi.idatt2003.g40.mappe.view.widgets; +/** + * Enum used to define the various widgets for the application. + * + *
Primarily handled by the {@link edu.ntnu.idi.idatt2003.g40.mappe.view.ingame.InGameController} + * for changing the active section of the game.
+ * */ public enum WidgetEnum { + /** + * {@link edu.ntnu.idi.idatt2003.g40.mappe.view.widgets.dashboard.DashBoardView}. + * */ DASHBOARD, + + /** + * {@link edu.ntnu.idi.idatt2003.g40.mappe.view.widgets.market.MarketView}. + * */ MARKET, + + /** + * {@link edu.ntnu.idi.idatt2003.g40.mappe.view.widgets.minigames.MiniGamesView}. + * */ MINIGAMES_OVERVIEW, + + /** + * {@link edu.ntnu.idi.idatt2003.g40.mappe.view.widgets.minigames.GameEngineView}. + * */ MINIGAMES_ENGINE, + + /** + * {@link edu.ntnu.idi.idatt2003.g40.mappe.view.widgets.stats.StatsView}. + * */ STATS, + + /** + * {@link edu.ntnu.idi.idatt2003.g40.mappe.view.widgets.transactions.TransactionsView}. + * */ TRANSACTIONS } diff --git a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/minigames/GameEngineController.java b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/minigames/GameEngineController.java index 92a9a22..58912c3 100644 --- a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/minigames/GameEngineController.java +++ b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/minigames/GameEngineController.java @@ -10,19 +10,75 @@ import javafx.animation.Timeline; import javafx.util.Duration; +/** + * Controller for the {@link GameEngineView}. + * + *Extends {@link ViewController}
+ * */ public final class GameEngineController extends ViewControllerIf report is not active, the player can exit without affecting the market. + * If report is active, exiting will cause effect.
+ * */ private boolean reportActive = false; + /** + * Constructor. + * + * @param viewElement the associated {@link GameEngineView}. + * @param chosenStock the chosen {@link Stock} object. + * */ public GameEngineController(final GameEngineView viewElement, final EventManager eventManager, final Stock chosenStock) throws IllegalArgumentException { @@ -52,6 +108,11 @@ protected void initInteractions() { getViewElement().setOnAction(MiniGamesActions.INGAME_RETURN, this::returnToOverview); } + /** + * Launches a given {@link GameGimmick} session. + * + * @param gimmick the gimmick to launch. + * */ public void launchGimmickSession(final GameGimmick gimmick) { activeGimmick = gimmick; currentScore = 0; @@ -70,10 +131,18 @@ public void launchGimmickSession(final GameGimmick gimmick) { engineLoop.play(); } + /** + * Setter method for chosen stock. + * + * @param newStock the new {@link Stock} object to set. + * */ public void setChosenStock(final Stock newStock) { chosenStock = newStock; } + /** + * Refreshes the metrics shown and updates appropriate values. + * */ private void refreshMetrics() { int hours = secondsRemaining / 3600; int minutes = (secondsRemaining % 3600) / 60; @@ -114,6 +183,14 @@ private void refreshMetrics() { getViewElement().updateMetadataDisplay(currentScore, formattedTime, currentRank); } + /** + * Stops the game session. + * + *If showReport is true, fortune will be set. + * if not, market is unaffected.
+ * + * @param showReport value indicating whether to show report or not. + * */ private void stopGameSession(final boolean showReport) { if (engineLoop != null) { engineLoop.stop(); @@ -124,6 +201,9 @@ private void stopGameSession(final boolean showReport) { } } + /** + * Changes widget to {@link MiniGamesView}. + * */ private void returnToOverview() { EventData