-
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.
Added Checkstyle to StockTradingGameApp
- Loading branch information
Showing
1 changed file
with
38 additions
and
37 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 |
|---|---|---|
| @@ -1,49 +1,50 @@ | ||
| package View; | ||
|
|
||
| import javafx.application.Application; | ||
| import javafx.stage.Stage; | ||
| import Controller.StockFileHandler; | ||
| import Model.*; | ||
| import javafx.application.Application; | ||
| import javafx.stage.Stage; | ||
|
|
||
| import java.math.BigDecimal; | ||
|
|
||
| /** | ||
| * StockTradingGameApp class. | ||
| */ | ||
| public class StockTradingGameApp extends Application { | ||
| private Stage primaryStage; | ||
| private Exchange exchange; | ||
| private Player player; | ||
| private StockFileHandler fileHandler; | ||
|
|
||
| @Override | ||
| public void start(Stage primaryStage) { | ||
| this.primaryStage = primaryStage; | ||
| this.fileHandler = new StockFileHandler(); | ||
| private Stage primaryStage; | ||
| private Exchange exchange; | ||
| private Player player; | ||
| private StockFileHandler fileHandler; | ||
|
|
||
| @Override | ||
| public void start(Stage primaryStage) { | ||
| this.primaryStage = primaryStage; | ||
| this.fileHandler = new StockFileHandler(); | ||
|
|
||
| primaryStage.setTitle("Stock Trading Game"); | ||
| primaryStage.setWidth(1200); | ||
| primaryStage.setHeight(800); | ||
| primaryStage.setTitle("Stock Trading Game"); | ||
| primaryStage.setWidth(1200); | ||
| primaryStage.setHeight(800); | ||
|
|
||
| showGameSetup(); | ||
| primaryStage.show(); | ||
| } | ||
|
|
||
| private void showGameSetup() { | ||
| GameSetupScene setupScene = new GameSetupScene(this::startGame); | ||
| primaryStage.setScene(setupScene.getScene()); | ||
| } | ||
|
|
||
| private void startGame(GameSetupScene.StartGameData gameData) { | ||
| this.exchange = gameData.exchange; | ||
| this.player = new Player(gameData.playerName, gameData.startingCapital); | ||
| showGameSetup(); | ||
| primaryStage.show(); | ||
| } | ||
|
|
||
| private void showGameSetup() { | ||
| GameSetupScene setupScene = new GameSetupScene(this::startGame); | ||
| primaryStage.setScene(setupScene.getScene()); | ||
| } | ||
|
|
||
| private void startGame(GameSetupScene.StartGameData gameData) { | ||
| this.exchange = gameData.exchange; | ||
| this.player = new Player(gameData.playerName, gameData.startingCapital); | ||
|
|
||
| MainGameScene gameScene = new MainGameScene(exchange, player, this::endGame); | ||
| primaryStage.setScene(gameScene.getScene()); | ||
| } | ||
| MainGameScene gameScene = new MainGameScene(exchange, player, this::endGame); | ||
| primaryStage.setScene(gameScene.getScene()); | ||
| } | ||
|
|
||
| private void endGame() { | ||
| primaryStage.close(); | ||
| } | ||
| private void endGame() { | ||
| primaryStage.close(); | ||
| } | ||
|
|
||
| public static void main(String[] args) { | ||
| launch(args); | ||
| } | ||
| public static void main(String[] args) { | ||
| launch(args); | ||
| } | ||
| } |