prices = new ArrayList<>();
/**
* Constructs a new stock with symbol, company name, and initial sales price.
@@ -124,6 +124,13 @@ public StockGraph getStockGraph() {
return stockGraph;
}
+ public void fakeHistory(int stockResolution) {
+ for (int i = 0; i < stockResolution; i++) {
+ updatePrice();
+ }
+ prices = prices.reversed();
+ }
+
/**
* Updates the stock graph if it is visible.
*/
diff --git a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/View/Apps/GameOverApp.java b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/View/Apps/GameOverApp.java
index 5b98342..033a7f9 100644
--- a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/View/Apps/GameOverApp.java
+++ b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/View/Apps/GameOverApp.java
@@ -51,4 +51,9 @@ private void buildLayout() {
public Button getStartOverButton() {
return startOverButton;
}
+
+ public void show(){
+ getRoot().setVisible(true);
+ getRoot().toFront();
+ }
}
diff --git a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/View/Apps/WarningApp.java b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/View/Apps/WarningApp.java
index fe3a249..422e298 100644
--- a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/View/Apps/WarningApp.java
+++ b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/View/Apps/WarningApp.java
@@ -12,8 +12,6 @@
/**
* Compact, reusable warning popup used across the entire game.
*
- * Call {@link #configureSingle} for a single dismiss button, or
- * {@link #configureDouble} for a two-button choice. Wire button actions after
* configuring, then show the root and overlay via the desktop controller.
*
* The close button is always re-wired by the configure methods so it
@@ -69,7 +67,7 @@ public WarningApp() {
* @param message body text below the heading
* @param primaryLabel label on the single action button
*/
- public void configureSingle(
+ public void configure(
final String icon,
final String title,
final String message,
@@ -99,7 +97,7 @@ public void configureSingle(
* @param secondaryLabel label on the left / cancel button
* @param primaryLabel label on the right / action button
*/
- public void configureDouble(
+ public void configure(
final String icon,
final String title,
final String message,
@@ -120,6 +118,11 @@ public void configureDouble(
getCloseButton().setOnAction(event -> secondaryButton.fire());
}
+ public void show(){
+ getRoot().setVisible(true);
+ getRoot().toFront();
+ }
+
/** The right-side action button (always visible). Wire with {@code setOnAction}. */
public Button getPrimaryButton() {
return primaryButton;
diff --git a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/View/Apps/WeekendRapportApp.java b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/View/Apps/WeekendRapportApp.java
index d304766..89dc2f5 100644
--- a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/View/Apps/WeekendRapportApp.java
+++ b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/View/Apps/WeekendRapportApp.java
@@ -21,10 +21,10 @@
*
*
Designed to read like a real weekly statement:
*
- * - Hero: the week's net income, large and color-coded
+ * - Player summary: the week's net income, large and color-coded
* - Verdict: a one-line mood label (e.g. "Strong week")
* - Receipts: each transaction rendered with the shared {@link Receipt}
- * - Footer: cash → rent → balance, with the final balance large and colored
+ * - Footer: cash, rent, and balance — with the final balance large and colored
*
*
* Dismissed only via the "Continue to Sunday" button or by clicking the
@@ -32,11 +32,10 @@
*/
public class WeekendRapportApp extends Popup {
- /** Threshold for "strong week" (net income covers rent.) */
private static final BigDecimal STRONG_WEEK_THRESHOLD = new BigDecimal("50.00");
- private final Label heroAmountLabel = new Label();
- private final Label heroCaptionLabel = new Label("Net Income This Week");
+ private final Label playerAmountLabel = new Label();
+ private final Label playerCaptionLabel = new Label("Net Income This Week");
private final Label verdictLabel = new Label();
private final Label cashLabel = new Label();
@@ -50,8 +49,7 @@ public class WeekendRapportApp extends Popup {
public WeekendRapportApp() {
super(740, 620, 0, 0, App.WEEKENDRAPPORT);
- // Close button mirrors the continue action
- getCloseButton().setOnAction(e -> continueButton.fire());
+ getCloseButton().setOnAction(event -> continueButton.fire());
continueButton.getStyleClass().add("primary-button");
continueButton.setMaxWidth(Double.MAX_VALUE);
@@ -60,112 +58,116 @@ public WeekendRapportApp() {
content.setPadding(new Insets(28, 28, 24, 28));
content.setSpacing(18);
+
buildLayout();
}
private void buildLayout() {
- heroAmountLabel.getStyleClass().add("rapport-hero-amount");
- heroCaptionLabel.getStyleClass().add("rapport-hero-caption");
+ playerAmountLabel.getStyleClass().add("rapport-player-amount");
+ playerCaptionLabel.getStyleClass().add("rapport-player-caption");
verdictLabel.getStyleClass().add("rapport-verdict");
- VBox hero = new VBox(2, heroAmountLabel, heroCaptionLabel);
- hero.setAlignment(Pos.CENTER);
+ VBox playerAmountBlock = new VBox(2, playerAmountLabel, playerCaptionLabel);
+ playerAmountBlock.setAlignment(Pos.CENTER);
- VBox heroBlock = new VBox(10, hero, verdictLabel);
- heroBlock.setAlignment(Pos.CENTER);
- heroBlock.getStyleClass().add("rapport-hero-block");
- heroBlock.setPadding(new Insets(20, 16, 20, 16));
+ VBox playerBlock = new VBox(10, playerAmountBlock, verdictLabel);
+ playerBlock.setAlignment(Pos.CENTER);
+ playerBlock.getStyleClass().add("rapport-player-block");
+ playerBlock.setPadding(new Insets(20, 16, 20, 16));
- Label txHeader = sectionHeader("Transactions");
+ Label transactionHeader = sectionHeader("Transactions");
- ScrollPane scroll = new ScrollPane(receiptList);
- scroll.setFitToWidth(true);
- scroll.getStyleClass().add("rapport-scroll");
- VBox.setVgrow(scroll, Priority.ALWAYS);
+ ScrollPane scrollPane = new ScrollPane(receiptList);
+ scrollPane.setFitToWidth(true);
+ scrollPane.getStyleClass().add("rapport-scroll");
+ VBox.setVgrow(scrollPane, Priority.ALWAYS);
cashLabel.getStyleClass().add("rapport-line-value");
rentLabel.getStyleClass().addAll("rapport-line-value", "rapport-rent-value");
- HBox cashLine = footerRow("Cash Available", cashLabel);
- HBox rentLine = footerRow("Rent Due", rentLabel);
- rentLine.getStyleClass().add("rapport-rent-row");
+ HBox cashRow = footerRow("Cash Available", cashLabel);
+ HBox rentRow = footerRow("Rent Due", rentLabel);
+ rentRow.getStyleClass().add("rapport-rent-row");
- Region rule = new Region();
- rule.getStyleClass().add("rapport-rule");
- rule.setMinHeight(1);
- rule.setMaxWidth(Double.MAX_VALUE);
+ Region dividerRule = new Region();
+ dividerRule.getStyleClass().add("rapport-rule");
+ dividerRule.setMinHeight(1);
+ dividerRule.setMaxWidth(Double.MAX_VALUE);
- Label balanceHeader = new Label("Balance After Rent");
- balanceHeader.getStyleClass().add("rapport-balance-header");
+ Label balanceHeaderLabel = new Label("Balance After Rent");
+ balanceHeaderLabel.getStyleClass().add("rapport-balance-header");
balanceLabel.getStyleClass().add("rapport-balance-value");
- HBox balanceLine = new HBox();
- Region balSpacer = new Region();
- HBox.setHgrow(balSpacer, Priority.ALWAYS);
- balanceLine.getChildren().addAll(balanceHeader, balSpacer, balanceLabel);
- balanceLine.setAlignment(Pos.CENTER_LEFT);
- balanceLine.setPadding(new Insets(2, 0, 0, 0));
+ Region balanceSpacer = new Region();
+ HBox.setHgrow(balanceSpacer, Priority.ALWAYS);
+
+ HBox balanceRow = new HBox();
+ balanceRow.getChildren().addAll(balanceHeaderLabel, balanceSpacer, balanceLabel);
+ balanceRow.setAlignment(Pos.CENTER_LEFT);
+ balanceRow.setPadding(new Insets(2, 0, 0, 0));
- VBox footer = new VBox(8, cashLine, rentLine, rule, balanceLine);
+ VBox footer = new VBox(8, cashRow, rentRow, dividerRule, balanceRow);
content.getChildren().setAll(
- heroBlock,
- txHeader, scroll,
+ playerBlock,
+ transactionHeader,
+ scrollPane,
footer,
continueButton
);
}
- private static Label sectionHeader(final String text) {
- Label l = new Label(text);
- l.getStyleClass().add("rapport-section-header");
- return l;
+ private static Label sectionHeader(String text) {
+ Label label = new Label(text);
+ label.getStyleClass().add("rapport-section-header");
+ return label;
}
- private static HBox footerRow(final String label, final Label valueLabel) {
- Label key = new Label(label);
- key.getStyleClass().add("rapport-line-key");
+ private static HBox footerRow(String labelText, Label valueLabel) {
+ Label keyLabel = new Label(labelText);
+ keyLabel.getStyleClass().add("rapport-line-key");
+
Region spacer = new Region();
HBox.setHgrow(spacer, Priority.ALWAYS);
- HBox row = new HBox(key, spacer, valueLabel);
+
+ HBox row = new HBox(keyLabel, spacer, valueLabel);
row.setAlignment(Pos.CENTER_LEFT);
return row;
}
-
/**
* Populates the rapport with the completed week's data.
* Rent has already been deducted from the player's balance before this is called.
*
* @param transactions all transactions that occurred this week
- * @param netIncome net cash change from trading (sales − purchases)
+ * @param netIncome net cash change from trading (sales minus purchases)
* @param cashBeforeRent cash available before rent was deducted
* @param rent the rent amount that was deducted
* @param cashAfterRent cash balance after rent deduction (may be negative)
*/
public void populate(
- final List transactions,
- final BigDecimal netIncome,
- final BigDecimal cashBeforeRent,
- final BigDecimal rent,
- final BigDecimal cashAfterRent
+ List transactions,
+ BigDecimal netIncome,
+ BigDecimal cashBeforeRent,
+ BigDecimal rent,
+ BigDecimal cashAfterRent
) {
- heroAmountLabel.setText(formatSigned(netIncome));
- applyMoodClass(heroAmountLabel, moodFor(netIncome));
+ playerAmountLabel.setText(formatSigned(netIncome));
+ applyMoodStyle(playerAmountLabel, moodStyleFor(netIncome));
- String verdict = computeVerdict(netIncome, cashAfterRent);
- verdictLabel.setText(verdict);
- applyMoodClass(verdictLabel, moodFor(netIncome, cashAfterRent));
+ verdictLabel.setText(computeVerdict(netIncome, cashAfterRent));
+ applyMoodStyle(verdictLabel, moodStyleFor(netIncome, cashAfterRent));
receiptList.getChildren().clear();
+
if (transactions.isEmpty()) {
- Label empty = new Label("No transactions this week.");
- empty.getStyleClass().add("rapport-line-key");
- empty.setPadding(new Insets(20));
- receiptList.getChildren().add(empty);
+ Label emptyMessage = new Label("No transactions this week.");
+ emptyMessage.getStyleClass().add("rapport-line-key");
+ emptyMessage.setPadding(new Insets(20));
+ receiptList.getChildren().add(emptyMessage);
} else {
- for (Transaction tx : transactions) {
- receiptList.getChildren().add(Receipt.forTransaction(tx));
+ for (Transaction transaction : transactions) {
+ receiptList.getChildren().add(Receipt.forTransaction(transaction));
}
}
@@ -183,69 +185,68 @@ public Button getContinueButton() {
return continueButton;
}
- /**
- * One-line mood label derived from net income and final balance.
- * Reads as a quick gut-check for how the week went.
- */
- private static String computeVerdict(final BigDecimal net, final BigDecimal balance) {
+ private static String computeVerdict(BigDecimal netIncome, BigDecimal balance) {
if (balance.signum() < 0) {
return "Week ended in debt";
}
- if (net.compareTo(STRONG_WEEK_THRESHOLD) >= 0) {
+ if (netIncome.compareTo(STRONG_WEEK_THRESHOLD) >= 0) {
return "Strong week";
}
- if (net.signum() > 0) {
+ if (netIncome.signum() > 0) {
return "Made some money";
}
- if (net.signum() == 0) {
+ if (netIncome.signum() == 0) {
return "Breaking even";
}
return "Rough week";
}
- /** Mood derived from net income alone (used for the hero amount). */
- private static String moodFor(final BigDecimal net) {
- if (net.signum() > 0) {
+ private static String moodStyleFor(BigDecimal netIncome) {
+ if (netIncome.signum() > 0) {
return "mood-positive";
}
- if (net.signum() < 0) {
+ if (netIncome.signum() < 0) {
return "mood-negative";
}
return "mood-neutral";
}
- /** Mood derived from net income AND final balance (used for the verdict). */
- private static String moodFor(final BigDecimal net, final BigDecimal balance) {
+ private static String moodStyleFor(BigDecimal netIncome, BigDecimal balance) {
if (balance.signum() < 0) {
return "mood-negative";
}
- if (net.compareTo(STRONG_WEEK_THRESHOLD) >= 0) {
+ if (netIncome.compareTo(STRONG_WEEK_THRESHOLD) >= 0) {
return "mood-positive";
}
- if (net.signum() >= 0) {
+ if (netIncome.signum() >= 0) {
return "mood-neutral";
}
return "mood-negative";
}
- private static void applyMoodClass(final Label label, final String moodClass) {
+ private static void applyMoodStyle(Label label, String moodStyle) {
label.getStyleClass().removeAll("mood-positive", "mood-negative", "mood-neutral");
- label.getStyleClass().add(moodClass);
+ label.getStyleClass().add(moodStyle);
}
- private static String formatUsd(final BigDecimal amount) {
+ private static String formatUsd(BigDecimal amount) {
return "$" + String.format("%,.2f", amount.abs());
}
- private static String formatSigned(final BigDecimal amount) {
+ private static String formatSigned(BigDecimal amount) {
String sign = amount.signum() >= 0 ? "+" : "−";
return sign + "$" + String.format("%,.2f", amount.abs());
}
- static String formatBalance(final BigDecimal amount) {
+ static String formatBalance(BigDecimal amount) {
if (amount.signum() < 0) {
return "$" + String.format("%,.2f", amount.negate()) + " in debt";
}
return "$" + String.format("%,.2f", amount);
}
-}
+
+ public void show(){
+ getRoot().setVisible(true);
+ getRoot().toFront();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/View/Views/DesktopView.java b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/View/Views/DesktopView.java
index 9263982..26a4d40 100644
--- a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/View/Views/DesktopView.java
+++ b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/View/Views/DesktopView.java
@@ -249,6 +249,7 @@ private HBox createBottomBar() {
HBox heartsBox = buildHeartsBox(player);
nextWeekButton = new Button("Advance to next week");
+ nextWeekButton.getStyleClass().add("primary-button");
Region spacerLeft = new Region();
Region spacerRight = new Region();
@@ -324,7 +325,7 @@ private HBox createStatusBox() {
twc.temperatureProperty().addListener((o, ov, nv)
-> Platform.runLater(() -> temp.setText(nv + "°C")));
- HBox box = new HBox(10, weather, temp, day, week, clock);
+ HBox box = new HBox(10, weather, temp, clock, day, week);
box.setAlignment(Pos.CENTER_RIGHT);
box.setMinWidth(Region.USE_PREF_SIZE);
return box;
diff --git a/src/main/resources/Audio/clock.wav b/src/main/resources/Audio/clock.wav
new file mode 100644
index 0000000..67e1002
Binary files /dev/null and b/src/main/resources/Audio/clock.wav differ
diff --git a/src/main/resources/Audio/close_app.wav b/src/main/resources/Audio/close_app.wav
index 55ea3aa..9b6291b 100644
Binary files a/src/main/resources/Audio/close_app.wav and b/src/main/resources/Audio/close_app.wav differ
diff --git a/src/main/resources/Audio/mouse_click.wav b/src/main/resources/Audio/mouse_click.wav
deleted file mode 100644
index 848eb7a..0000000
Binary files a/src/main/resources/Audio/mouse_click.wav and /dev/null differ
diff --git a/src/main/resources/Audio/open_app.wav b/src/main/resources/Audio/open_app.wav
index 1332cc1..5675422 100644
Binary files a/src/main/resources/Audio/open_app.wav and b/src/main/resources/Audio/open_app.wav differ
diff --git a/src/main/resources/Audio/transaction.wav b/src/main/resources/Audio/transaction.wav
new file mode 100644
index 0000000..6f135a9
Binary files /dev/null and b/src/main/resources/Audio/transaction.wav differ
diff --git a/src/main/resources/Audio/weekend_theme.mp3 b/src/main/resources/Audio/weekend_theme.mp3
new file mode 100644
index 0000000..469e608
Binary files /dev/null and b/src/main/resources/Audio/weekend_theme.mp3 differ
diff --git a/src/main/resources/Audio/work_theme.mp3 b/src/main/resources/Audio/work_theme.mp3
new file mode 100644
index 0000000..cc557cd
Binary files /dev/null and b/src/main/resources/Audio/work_theme.mp3 differ
diff --git a/src/main/resources/css/global.css b/src/main/resources/css/global.css
index cc3ce8c..40680d1 100644
--- a/src/main/resources/css/global.css
+++ b/src/main/resources/css/global.css
@@ -2,26 +2,26 @@
.root {
-fx-font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
- -primary: #007AFF;
- -primary-hover: #0051d4;
-
- -success: #34C759;
- -danger: #e54848;
- -danger-soft: #ffe6e6;
- -warning: #ff9500;
- -accent: -danger; /* hearts, exit, destructive accents */
-
- -text-strong: #1a1a1a;
- -text-base: #333333;
- -text-muted: #888888;
- -text-faint: #aaaaaa;
-
- -surface: white;
- -surface-soft: #f5f5f5;
- -surface-line: #e8e8e8;
- -popup-bg: white;
- -popup-border: #d1d1d1;
- -overlay: rgba(0, 0, 0, 0.45);
+ -primary: #007AFF;
+ -primary-hover: #0051d4;
+
+ -success: #34C759;
+ -danger: #e54848;
+ -danger-soft: #ffe6e6;
+ -warning: #ff9500;
+ -accent: -danger; /* hearts, exit, destructive accents */
+
+ -text-strong: #1a1a1a;
+ -text-base: #333333;
+ -text-muted: #888888;
+ -text-faint: #aaaaaa;
+
+ -surface: white;
+ -surface-soft: #f5f5f5;
+ -surface-line: #e8e8e8;
+ -popup-bg: white;
+ -popup-border: #d1d1d1;
+ -overlay: rgba(0, 0, 0, 0.45);
}
.scroll-pane > .viewport {
diff --git a/src/main/resources/stocks.csv b/src/main/resources/stocks.csv
index c9d57af..36eefea 100644
--- a/src/main/resources/stocks.csv
+++ b/src/main/resources/stocks.csv
@@ -16,4 +16,16 @@ UNI,NTNU Org.,311.14
COM,Communication Org.,155.28
MON,Monsters Inc.,329.54
AIR,Plane Inc.,240.70
-ATB,Bus Inc.,539.52
\ No newline at end of file
+ATB,Bus Inc.,539.52
+BAT,Battery Inc.,243.43
+KWI,Kiwi Inc.,102,24
+VAC,Vacine Inc.,156.76
+JZZ,Jazz Inc.,230.40
+MET,Metal Inc.,302,89
+FRM,Farm Org.,260.76
+COS,Cosmetic Inc.,403.30
+TXI,Taxi Org.,239.70
+GOR,Gorilla Inc.,503.35
+MKY,Monkey Inc.,67.87
+NET,Network Org.,389.37
+WWW,Internet Org.,402.50
\ No newline at end of file