-
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 pull request #55 from IDATT2003-gruppe06/dev
Merge into main
- Loading branch information
Showing
67 changed files
with
3,562 additions
and
279 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,3 +38,5 @@ build/ | |
|
|
||
| ### Mac OS ### | ||
| .DS_Store | ||
|
|
||
| shell.nix | ||
This file was deleted.
Oops, something went wrong.
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,11 @@ | ||
| Millions stock trading game | ||
|
|
||
| Made by: | ||
| - Nikolai Oliver Aasheim Lydvo | ||
| - Martin Olai Amundsen Henøen | ||
|
|
||
| How to run the game: | ||
| 1. Download the latest release | ||
| 2. Ensure you have Java 25 and the Maven commandline tool installed | ||
| 3. Navigate to the project root directory and run the command: "mvn javafx:run" | ||
| 4. Set up your game configuration and start game |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| package millions; | ||
|
|
||
| import java.math.BigDecimal; | ||
| import java.util.Objects; | ||
| import java.util.logging.Level; | ||
| import java.util.logging.Logger; | ||
| import javafx.application.Application; | ||
| import javafx.scene.Scene; | ||
| import javafx.scene.control.Alert; | ||
| import javafx.stage.Stage; | ||
| import millions.controller.GameController; | ||
| import millions.controller.fileIO.InvalidFormatException; | ||
| import millions.controller.fileIO.UncheckedFileNotFoundException; | ||
| import millions.view.ExitView; | ||
| import millions.view.GameView; | ||
| import millions.view.StartView; | ||
|
|
||
| /** Main JavaFX application entry point for the Millions stock trading game. */ | ||
| public class App extends Application { | ||
| private static final Logger logger = Logger.getLogger(App.class.getName()); | ||
| private static final String STYLESHEET = | ||
| Objects.requireNonNull(App.class.getResource("/styles/millions.css")).toExternalForm(); | ||
|
|
||
| @Override | ||
| public void start(Stage stage) { | ||
| GameController controller = new GameController(); | ||
| StartView startView = new StartView(stage); | ||
|
|
||
| startView | ||
| .getStartButton() | ||
| .setOnAction( | ||
| event -> { | ||
| try { | ||
| controller.startGame( | ||
| startView.getName(), | ||
| new BigDecimal(startView.getStartingAmount()), | ||
| startView.getSelectedFile().toPath(), | ||
| startView.getPreRunWeeks()); | ||
|
|
||
| GameView gameView = | ||
| new GameView( | ||
| controller, | ||
| () -> { | ||
| ExitView exitView = new ExitView(controller.getPlayer()); | ||
| exitView.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); | ||
| Scene exitScene = new Scene(exitView, 500, 400); | ||
| exitScene.getStylesheets().add(STYLESHEET); | ||
| stage.setScene(exitScene); | ||
| }); | ||
| controller.getPlayer().addListener(gameView); | ||
| controller.getExchange().addListener(gameView); | ||
|
|
||
| Scene gameScene = new Scene(gameView, 1920, 1080); | ||
| gameScene.getStylesheets().add(STYLESHEET); | ||
| stage.setScene(gameScene); | ||
| } catch (InvalidFormatException e) { | ||
| logger.log(Level.WARNING, "InvalidFormatException: " + e.getMessage()); | ||
|
|
||
| Alert alert = new Alert(Alert.AlertType.ERROR); | ||
| alert.setTitle("Error"); | ||
| alert.setHeaderText("Error with selected file"); | ||
| alert.setContentText( | ||
| e.getMessage() + "\nPlease control the format of the selected file"); | ||
|
|
||
| alert.showAndWait(); | ||
|
|
||
| } catch (UncheckedFileNotFoundException e) { | ||
| logger.log(Level.WARNING, "FileNotFoundException: " + e.getMessage()); | ||
|
|
||
| Alert alert = new Alert(Alert.AlertType.ERROR); | ||
| alert.setTitle("Error"); | ||
| alert.setHeaderText("Error with selected file"); | ||
| alert.setContentText(e.getMessage()); | ||
|
|
||
| alert.showAndWait(); | ||
|
|
||
| } catch (RuntimeException ex) { | ||
| logger.log(Level.SEVERE, ex.getMessage()); | ||
| System.exit(0); | ||
| } | ||
| }); | ||
|
|
||
| Scene scene = new Scene(startView, 400, 350); | ||
| scene.getStylesheets().add(STYLESHEET); | ||
| stage.setTitle("Millions"); | ||
| stage.setMinWidth(900); | ||
| stage.setMinHeight(600); | ||
| stage.setScene(scene); | ||
| stage.show(); | ||
| } | ||
|
|
||
| public static void main(String[] args) { | ||
| launch(args); | ||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.