Skip to content

Commit

Permalink
feat: Add Home button
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelSapula committed May 25, 2026
1 parent e9196e8 commit f1eebb7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void initializeGame() {

boolean loadResult = SessionManager.loadSession(model.getName().get());
if (loadResult) {
SceneManager.switchTo(SceneFactory.createExchangeView());
SceneManager.switchTo(SceneFactory.createExchangeView(true));
return;
} else {
model.isNewGame().set(true);
Expand Down Expand Up @@ -130,7 +130,7 @@ public void initializeGame() {
Exchange exchange = new Exchange(player.getName(), stocks);
SessionManager.newSession(player, exchange);
SessionManager.saveSession();
SceneManager.switchTo(SceneFactory.createExchangeView());
SceneManager.switchTo(SceneFactory.createExchangeView(true));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ public Parent createContent() {
*/
@Override
public Parent createNavigation() {
return UIFactory.createNavigation(" Newspaper", List.of());
return UIFactory.createNavigation(" Newspaper",
List.of("Home"),
() -> SceneManager.switchTo(SceneFactory.createExchangeView(false)));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public Parent createContent() {
@Override
public Parent createNavigation() {
return UIFactory.createNavigation("Portfolio",
List.of(" • Title"),
() -> System.out.println("Newspaper clicked"));
List.of("Home"),
() -> SceneManager.switchTo(SceneFactory.createExchangeView(false)));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ public Parent createContent() {
@Override
public Parent createNavigation() {
return UIFactory.createNavigation(title = new Label(),
List.of(" • Newspaper"),
List.of(
"Home",
" • Newspaper"),
() -> SceneManager.switchTo(SceneFactory.createExchangeView(false)),
() -> SceneManager.switchTo(SceneFactory.createNewspaperView(stockSymbol)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ public Parent createContent() {
*/
@Override
public Parent createNavigation() {
return UIFactory.createNavigation("Transactions", List.of());
return UIFactory.createNavigation("Transactions",
List.of("Home"),
() -> SceneManager.switchTo(SceneFactory.createExchangeView(false)));
}

/**
Expand Down

0 comments on commit f1eebb7

Please sign in to comment.