-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 118-play-game-menu
- Loading branch information
Showing
28 changed files
with
2,225 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 24 additions & 2 deletions
26
src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/ingame/InGameController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,43 @@ | ||
| package edu.ntnu.idi.idatt2003.g40.mappe.view.ingame; | ||
|
|
||
| import edu.ntnu.idi.idatt2003.g40.mappe.service.event.EventData; | ||
| import edu.ntnu.idi.idatt2003.g40.mappe.service.event.EventManager; | ||
| import edu.ntnu.idi.idatt2003.g40.mappe.service.event.EventSubscriber; | ||
| import edu.ntnu.idi.idatt2003.g40.mappe.service.event.EventType; | ||
| import edu.ntnu.idi.idatt2003.g40.mappe.view.ViewController; | ||
| import edu.ntnu.idi.idatt2003.g40.mappe.view.widgets.WidgetEnum; | ||
| import javafx.scene.Node; | ||
| import java.util.EnumMap; | ||
|
|
||
| public class InGameController extends ViewController<InGameView> { | ||
| public final class InGameController extends ViewController<InGameView> | ||
| implements EventSubscriber { | ||
|
|
||
| private final EnumMap<WidgetEnum, Node> widgetMap = new EnumMap<>(WidgetEnum.class); | ||
|
|
||
| /** | ||
| * {@inheritDoc}. | ||
| */ | ||
| protected InGameController(final InGameView viewElement, | ||
| public InGameController(final InGameView viewElement, | ||
| final EventManager eventManager) | ||
| throws IllegalArgumentException { | ||
| super(viewElement, eventManager); | ||
| eventManager.addSubscriber(this, EventType.CHANGE_INGAME_CENTER); | ||
| } | ||
|
|
||
| public void addwidget(final WidgetEnum widgetEnum, final Node widgetRoot) { | ||
| widgetMap.put(widgetEnum, widgetRoot); | ||
| } | ||
|
|
||
| @Override | ||
| protected void initInteractions() { | ||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public <T> void handleEvent(final EventData<T> data) { | ||
| if (!(data.data() instanceof WidgetEnum) || !widgetMap.containsKey(data.data())) { | ||
| throw new IllegalArgumentException("Invalid event thrown!"); | ||
| } | ||
| getViewElement().changeCenterView(widgetMap.get(data.data())); | ||
| } | ||
| } |
11 changes: 0 additions & 11 deletions
11
src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/ingame/InGameView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/WidgetEnum.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| package edu.ntnu.idi.idatt2003.g40.mappe.view.widgets; | ||
|
|
||
| /** | ||
| * Enum used to define the various widgets for the application. | ||
| * | ||
| * <p>Primarily handled by the {@link edu.ntnu.idi.idatt2003.g40.mappe.view.ingame.InGameController} | ||
| * for changing the active section of the game.</p> | ||
| * */ | ||
| 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 | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.