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
This commit is contained in:
@@ -164,6 +164,7 @@ public class BankGUI extends Player{
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Scene scene = new Scene(brdr1, 600, 480);
|
Scene scene = new Scene(brdr1, 600, 480);
|
||||||
|
scene.getStylesheets().add("styleguide.css");
|
||||||
primaryStage.setScene(scene);
|
primaryStage.setScene(scene);
|
||||||
return primaryStage;
|
return primaryStage;
|
||||||
}
|
}
|
||||||
|
|||||||
33
src/FileSaving.java
Normal file
33
src/FileSaving.java
Normal file
@@ -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){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -98,6 +98,7 @@ public class GameEndGUI extends Player{
|
|||||||
netWorth.setText("Net Worth: " + netWorthInt);
|
netWorth.setText("Net Worth: " + netWorthInt);
|
||||||
|
|
||||||
Scene root = new Scene(borderPane, 600, 480);
|
Scene root = new Scene(borderPane, 600, 480);
|
||||||
|
root.getStylesheets().add("styleguide.css");
|
||||||
|
|
||||||
stage.setTitle("End Game Stats");
|
stage.setTitle("End Game Stats");
|
||||||
stage.setResizable(false);
|
stage.setResizable(false);
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ public class LoanSharkGUI extends Player {
|
|||||||
|
|
||||||
//Setting the Scene and displaying it
|
//Setting the Scene and displaying it
|
||||||
Scene scene = new Scene(brdr1, 600, 480);
|
Scene scene = new Scene(brdr1, 600, 480);
|
||||||
|
scene.getStylesheets().add("styleguide.css");
|
||||||
primaryStage.setScene(scene);
|
primaryStage.setScene(scene);
|
||||||
//primaryStage.show();
|
//primaryStage.show();
|
||||||
return primaryStage;
|
return primaryStage;
|
||||||
|
|||||||
@@ -506,7 +506,7 @@ public class ShipWarfareGUI extends Player{
|
|||||||
|
|
||||||
|
|
||||||
Scene root = new Scene(BorderPane, 600, 480);
|
Scene root = new Scene(BorderPane, 600, 480);
|
||||||
|
root.getStylesheets().add("styleguide.css");
|
||||||
stage.setTitle("Ship");
|
stage.setTitle("Ship");
|
||||||
stage.setResizable(false);
|
stage.setResizable(false);
|
||||||
stage.setScene(root);
|
stage.setScene(root);
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ public class StartGUI extends Player{
|
|||||||
private HBox hBox = new HBox();
|
private HBox hBox = new HBox();
|
||||||
private TextField nameField = new TextField();
|
private TextField nameField = new TextField();
|
||||||
private Button startButton = new Button();
|
private Button startButton = new Button();
|
||||||
|
private Button continueButton = new Button();
|
||||||
private VBox vBox = new VBox();
|
private VBox vBox = new VBox();
|
||||||
private Label choiceLabel = new Label();
|
private Label choiceLabel = new Label();
|
||||||
private RadioButton gunChoice = new RadioButton();
|
private RadioButton gunChoice = new RadioButton();
|
||||||
@@ -93,6 +94,13 @@ public class StartGUI extends Player{
|
|||||||
startButton.setMnemonicParsing(false);
|
startButton.setMnemonicParsing(false);
|
||||||
startButton.setText("Start");
|
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.
|
* 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(nameField);
|
||||||
hBox.getChildren().add(startButton);
|
hBox.getChildren().add(startButton);
|
||||||
|
hBox.getChildren().add(continueButton);
|
||||||
vBox.getChildren().add(choiceLabel);
|
vBox.getChildren().add(choiceLabel);
|
||||||
vBox.getChildren().add(gunChoice);
|
vBox.getChildren().add(gunChoice);
|
||||||
vBox.getChildren().add(cashChoice);
|
vBox.getChildren().add(cashChoice);
|
||||||
@@ -207,6 +216,7 @@ public class StartGUI extends Player{
|
|||||||
});
|
});
|
||||||
|
|
||||||
Scene root = new Scene(borderPane, 600, 480);
|
Scene root = new Scene(borderPane, 600, 480);
|
||||||
|
root.getStylesheets().add("styleguide.css");
|
||||||
|
|
||||||
stage.setTitle("Start");
|
stage.setTitle("Start");
|
||||||
stage.setResizable(false);
|
stage.setResizable(false);
|
||||||
|
|||||||
@@ -744,9 +744,22 @@ public class TaipanShopGUI extends Player{
|
|||||||
|
|
||||||
Scene root = new Scene(anchorPane, 600, 480);
|
Scene root = new Scene(anchorPane, 600, 480);
|
||||||
|
|
||||||
|
root.getStylesheets().add("styleguide.css");
|
||||||
stage.setTitle("Shop");
|
stage.setTitle("Shop");
|
||||||
stage.setResizable(false);
|
stage.setResizable(false);
|
||||||
stage.setScene(root);
|
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.
|
// general updates to the buttons, user stats/inventory, and text.
|
||||||
buttonSetup("reset");
|
buttonSetup("reset");
|
||||||
|
|||||||
@@ -328,6 +328,7 @@ public class TravelGUI extends Player{
|
|||||||
anchorPane.getChildren().add(gridPane);
|
anchorPane.getChildren().add(gridPane);
|
||||||
|
|
||||||
Scene root = new Scene(anchorPane, 600, 480);
|
Scene root = new Scene(anchorPane, 600, 480);
|
||||||
|
root.getStylesheets().add("styleguide.css");
|
||||||
|
|
||||||
stage.setTitle("Travel");
|
stage.setTitle("Travel");
|
||||||
stage.setResizable(false);
|
stage.setResizable(false);
|
||||||
|
|||||||
@@ -581,7 +581,7 @@ public class WarehouseGUI extends Player{
|
|||||||
vBox1.getChildren().add(vacantWarehouse);
|
vBox1.getChildren().add(vacantWarehouse);
|
||||||
|
|
||||||
Scene root = new Scene(borderPane, 600, 480);
|
Scene root = new Scene(borderPane, 600, 480);
|
||||||
|
root.getStylesheets().add("styleguide.css");
|
||||||
stage.setTitle("Warehouse");
|
stage.setTitle("Warehouse");
|
||||||
stage.setResizable(false);
|
stage.setResizable(false);
|
||||||
stage.setScene(root);
|
stage.setScene(root);
|
||||||
|
|||||||
8
src/styleguide.css
Normal file
8
src/styleguide.css
Normal file
@@ -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;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user