From e6e1f02ea9c36249062733d5995befdbc27c65d5 Mon Sep 17 00:00:00 2001 From: Solargale Date: Sat, 23 Mar 2019 03:37:41 -0600 Subject: [PATCH] File saving is work in progress Added a css file for the game Made it so that you can press enter to continue forwars Made folder for both images and save files --- src/BankGUI.java | 1 + src/FileSaving.java | 33 +++++++++++++++++++++++++++++++++ src/GameEndGUI.java | 1 + src/LoanSharkGUI.java | 1 + src/ShipWarfareGUI.java | 2 +- src/StartGUI.java | 10 ++++++++++ src/TaipanShopGUI.java | 13 +++++++++++++ src/TravelGUI.java | 1 + src/WarehouseGUI.java | 2 +- src/styleguide.css | 8 ++++++++ 10 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 src/FileSaving.java create mode 100644 src/styleguide.css diff --git a/src/BankGUI.java b/src/BankGUI.java index c03e0cb..0c41604 100644 --- a/src/BankGUI.java +++ b/src/BankGUI.java @@ -164,6 +164,7 @@ public class BankGUI extends Player{ * */ Scene scene = new Scene(brdr1, 600, 480); + scene.getStylesheets().add("styleguide.css"); primaryStage.setScene(scene); return primaryStage; } diff --git a/src/FileSaving.java b/src/FileSaving.java new file mode 100644 index 0000000..d4b4cb7 --- /dev/null +++ b/src/FileSaving.java @@ -0,0 +1,33 @@ +import java.io.*; + +public class FileSaving extends Player { + InputStream in = null; + BufferedReader reader = null; + OutputStream out = null; + + public Boolean loadFile() { + try { + in = new FileInputStream("src/saves/playerSave.txt"); + reader = new BufferedReader(new InputStreamReader(in)); + + //Returns true if there is a save file + return true; + } + catch (Exception e){ + //returns false if there isn't a save file + return false; + } + } + + public void saveFile(){ + try{ + out = new FileOutputStream("src/saves/playerSave.txt"); + } + catch (Exception e){ + + } + + } + + +} diff --git a/src/GameEndGUI.java b/src/GameEndGUI.java index ea2703a..9b6770a 100644 --- a/src/GameEndGUI.java +++ b/src/GameEndGUI.java @@ -98,6 +98,7 @@ public class GameEndGUI extends Player{ netWorth.setText("Net Worth: " + netWorthInt); Scene root = new Scene(borderPane, 600, 480); + root.getStylesheets().add("styleguide.css"); stage.setTitle("End Game Stats"); stage.setResizable(false); diff --git a/src/LoanSharkGUI.java b/src/LoanSharkGUI.java index 63afba0..5a936f0 100644 --- a/src/LoanSharkGUI.java +++ b/src/LoanSharkGUI.java @@ -155,6 +155,7 @@ public class LoanSharkGUI extends Player { //Setting the Scene and displaying it Scene scene = new Scene(brdr1, 600, 480); + scene.getStylesheets().add("styleguide.css"); primaryStage.setScene(scene); //primaryStage.show(); return primaryStage; diff --git a/src/ShipWarfareGUI.java b/src/ShipWarfareGUI.java index 98cb807..5fdad76 100644 --- a/src/ShipWarfareGUI.java +++ b/src/ShipWarfareGUI.java @@ -506,7 +506,7 @@ public class ShipWarfareGUI extends Player{ Scene root = new Scene(BorderPane, 600, 480); - + root.getStylesheets().add("styleguide.css"); stage.setTitle("Ship"); stage.setResizable(false); stage.setScene(root); diff --git a/src/StartGUI.java b/src/StartGUI.java index ad9107c..8fe02f1 100644 --- a/src/StartGUI.java +++ b/src/StartGUI.java @@ -23,6 +23,7 @@ public class StartGUI extends Player{ private HBox hBox = new HBox(); private TextField nameField = new TextField(); private Button startButton = new Button(); + private Button continueButton = new Button(); private VBox vBox = new VBox(); private Label choiceLabel = new Label(); private RadioButton gunChoice = new RadioButton(); @@ -93,6 +94,13 @@ public class StartGUI extends Player{ startButton.setMnemonicParsing(false); startButton.setText("Start"); + /** + * Creates a button with text "Continue" + * + */ + continueButton.setMnemonicParsing(false); + continueButton.setText("Continue Save"); + /** * Creates a VBox at the left of center of the borderpane. * @@ -164,6 +172,7 @@ public class StartGUI extends Player{ */ hBox.getChildren().add(nameField); hBox.getChildren().add(startButton); + hBox.getChildren().add(continueButton); vBox.getChildren().add(choiceLabel); vBox.getChildren().add(gunChoice); vBox.getChildren().add(cashChoice); @@ -207,6 +216,7 @@ public class StartGUI extends Player{ }); Scene root = new Scene(borderPane, 600, 480); + root.getStylesheets().add("styleguide.css"); stage.setTitle("Start"); stage.setResizable(false); diff --git a/src/TaipanShopGUI.java b/src/TaipanShopGUI.java index 94bc09a..1880bd3 100644 --- a/src/TaipanShopGUI.java +++ b/src/TaipanShopGUI.java @@ -744,9 +744,22 @@ public class TaipanShopGUI extends Player{ Scene root = new Scene(anchorPane, 600, 480); + root.getStylesheets().add("styleguide.css"); stage.setTitle("Shop"); stage.setResizable(false); stage.setScene(root); + buyButton.setFocusTraversable(false); + sellButton.setFocusTraversable(false); + bankButton.setFocusTraversable(false); + loanButton.setFocusTraversable(false); + generalButton.setFocusTraversable(false); + armsButton.setFocusTraversable(false); + silkButton.setFocusTraversable(false); + opiumButton.setFocusTraversable(false); + sellButton.setFocusTraversable(false); + retireButton.setFocusTraversable(false); + cargoButton.setFocusTraversable(false); + quitButton.setFocusTraversable(false); // general updates to the buttons, user stats/inventory, and text. buttonSetup("reset"); diff --git a/src/TravelGUI.java b/src/TravelGUI.java index d12c53c..f535895 100644 --- a/src/TravelGUI.java +++ b/src/TravelGUI.java @@ -328,6 +328,7 @@ public class TravelGUI extends Player{ anchorPane.getChildren().add(gridPane); Scene root = new Scene(anchorPane, 600, 480); + root.getStylesheets().add("styleguide.css"); stage.setTitle("Travel"); stage.setResizable(false); diff --git a/src/WarehouseGUI.java b/src/WarehouseGUI.java index cff2c1d..f041af1 100644 --- a/src/WarehouseGUI.java +++ b/src/WarehouseGUI.java @@ -581,7 +581,7 @@ public class WarehouseGUI extends Player{ vBox1.getChildren().add(vacantWarehouse); Scene root = new Scene(borderPane, 600, 480); - + root.getStylesheets().add("styleguide.css"); stage.setTitle("Warehouse"); stage.setResizable(false); stage.setScene(root); diff --git a/src/styleguide.css b/src/styleguide.css new file mode 100644 index 0000000..e2716e0 --- /dev/null +++ b/src/styleguide.css @@ -0,0 +1,8 @@ +.text-field:focused{ + -fx-faint-focus-color: transparent; + -fx-focus-color:rgba(0,0,0,0.2); +} + +.button:default{ + -fx-default-button: #e5f8ff; +} \ No newline at end of file