From 1d5e5aa70660d5a43aa80307f759040dd6d78cac Mon Sep 17 00:00:00 2001 From: Siddhant Dewani Date: Sun, 10 Mar 2019 21:11:49 -0600 Subject: [PATCH 1/5] Fixed bank and loanshark --- src/TaipanShopGUI.java | 4 ++-- src/bankGUI.java | 21 +++++++++++---------- src/loanSharkGUI.java | 12 ++++++------ 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/TaipanShopGUI.java b/src/TaipanShopGUI.java index fbf07a9..2822951 100644 --- a/src/TaipanShopGUI.java +++ b/src/TaipanShopGUI.java @@ -491,7 +491,7 @@ public class TaipanShopGUI { bankButton.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { - bankGUI bank = new bankGUI(); + bankGUI bank = new bankGUI(player); bank.initializeBank(stage); stage.show(); } @@ -520,7 +520,7 @@ public class TaipanShopGUI { loanButton.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { - loanSharkGUI loan = new loanSharkGUI(); + loanSharkGUI loan = new loanSharkGUI(player); loan.initializeLoanShark(stage); stage.show(); } diff --git a/src/bankGUI.java b/src/bankGUI.java index 4818102..5c0ad4d 100644 --- a/src/bankGUI.java +++ b/src/bankGUI.java @@ -12,7 +12,7 @@ import javafx.scene.layout.VBox; import javafx.stage.Stage; public class bankGUI{ - private Player player = new Player(); + private Player player; /** * setter method that takes in a Player object as an argument. * @@ -36,19 +36,19 @@ public class bankGUI{ * //* @param player object of the class Player */ - //public bankGUI(Player player){ - // Player playerDummy = new Player(player); - // this.player = playerDummy; - //} + public bankGUI(Player player){ + Player playerDummy = new Player(player); + this.player = playerDummy; + } public Stage initializeBank(Stage primaryStage) { primaryStage.setTitle("Bank"); //Declaring each Layout BorderPane brdr1 = new BorderPane(); - HBox hbx1 = new HBox(10); - HBox hbx2 = new HBox(10); - VBox vbx1 = new VBox(10); + HBox hbx1 = new HBox(30); + HBox hbx2 = new HBox(30); + VBox vbx1 = new VBox(30); //Declaring all Variables Label l1 = new Label("Player: " + player.getName()); @@ -88,11 +88,11 @@ public class bankGUI{ brdr1.setTop(vbx1); // Set the event handler when the deposit button is clicked - boolean keepGoing = true; b1.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { int withdraw = Integer.parseInt(txtField1.getText()); + System.out.println(withdraw); if(withdraw <= player.getBank()){ player.setMoney(withdraw + player.getMoney()); player.setBank(player.getBank()-withdraw); @@ -111,6 +111,7 @@ public class bankGUI{ @Override public void handle(ActionEvent event) { int deposit = Integer.parseInt(txtField1.getText()); + System.out.println(deposit); if(deposit <= player.getMoney()){ player.setBank(deposit + player.getBank()); player.setMoney(player.getMoney()-deposit); @@ -146,7 +147,7 @@ public class bankGUI{ public void start(Stage primaryStage) { - bankGUI bank = new bankGUI(); + bankGUI bank = new bankGUI(player); bank.initializeBank(primaryStage); primaryStage.show(); } diff --git a/src/loanSharkGUI.java b/src/loanSharkGUI.java index c1dc880..4c335cd 100644 --- a/src/loanSharkGUI.java +++ b/src/loanSharkGUI.java @@ -12,7 +12,7 @@ import javafx.scene.layout.VBox; import javafx.stage.Stage; public class loanSharkGUI{ - private Player player = new Player(); + private Player player; /** * setter method that takes in a Player object as an argument. * @@ -36,10 +36,10 @@ public class loanSharkGUI{ * //* @param player object of the class Player */ - //public loanSharkGUI(Player player){ - // Player playerDummy = new Player(player); - // this.player = playerDummy; - //} + public loanSharkGUI(Player player){ + Player playerDummy = new Player(player); + this.player = playerDummy; + } public Stage initializeLoanShark(Stage primaryStage) { primaryStage.setTitle("Loan Shark"); @@ -151,7 +151,7 @@ public class loanSharkGUI{ public void start(Stage primaryStage) { - loanSharkGUI loan = new loanSharkGUI(); + loanSharkGUI loan = new loanSharkGUI(player); loan.initializeLoanShark(primaryStage); primaryStage.show(); } From 13f30b681a852c593fad3836fa23195806ac7645 Mon Sep 17 00:00:00 2001 From: Vikramb987 <47336882+Vikramb987@users.noreply.github.com> Date: Sun, 10 Mar 2019 21:12:26 -0600 Subject: [PATCH 2/5] Update TaipanShopGUI.java made it so that certain buttons are invisible in certain locations. --- src/TaipanShopGUI.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/TaipanShopGUI.java b/src/TaipanShopGUI.java index 2822951..7c794cf 100644 --- a/src/TaipanShopGUI.java +++ b/src/TaipanShopGUI.java @@ -491,7 +491,7 @@ public class TaipanShopGUI { bankButton.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { - bankGUI bank = new bankGUI(player); + bankGUI bank = new bankGUI(); bank.initializeBank(stage); stage.show(); } @@ -520,7 +520,7 @@ public class TaipanShopGUI { loanButton.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { - loanSharkGUI loan = new loanSharkGUI(player); + loanSharkGUI loan = new loanSharkGUI(); loan.initializeLoanShark(stage); stage.show(); } @@ -754,6 +754,7 @@ public class TaipanShopGUI { stage.setResizable(false); stage.setScene(root); + buttonSetup("reset"); updatePrices(); defaultTextOut(); updateStage(); From 461171ff469a9db0d1450b0ac9d57434f16c356d Mon Sep 17 00:00:00 2001 From: Vikram Date: Mon, 25 Feb 2019 19:42:37 -0700 Subject: [PATCH 3/5] minor changes. Still in progress. --- src/Player.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Player.java b/src/Player.java index 8ff4e2b..8542fd6 100644 --- a/src/Player.java +++ b/src/Player.java @@ -444,6 +444,20 @@ public class Player { public void gameOver(){ System.out.flush(); System.out.println("Game over"); - System.exit(0); + } + + public boolean playAgain(){ + Scanner input = new Scanner(System.in); + System.out.println("Would you like to play again? Y/N"); + while(true){ + String response = input.nextLine(); + if(response.equalsIgnoreCase("Y")){ + return true; + }else if(response.equalsIgnoreCase("N")){ + System.exit(0); + }else{ + System.out.println("That is not a valid input."); + } + } } } From 0c5317cf6fbacb52d9b18abde01bcc5ea44c3086 Mon Sep 17 00:00:00 2001 From: Vikramb987 <47336882+Vikramb987@users.noreply.github.com> Date: Sun, 10 Mar 2019 21:15:38 -0600 Subject: [PATCH 4/5] Update TaipanShopGUI.java fixed to adapt to loanshark --- src/TaipanShopGUI.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TaipanShopGUI.java b/src/TaipanShopGUI.java index 7c794cf..55a2b0a 100644 --- a/src/TaipanShopGUI.java +++ b/src/TaipanShopGUI.java @@ -491,7 +491,7 @@ public class TaipanShopGUI { bankButton.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { - bankGUI bank = new bankGUI(); + bankGUI bank = new bankGUI(getPlayer()); bank.initializeBank(stage); stage.show(); } @@ -520,7 +520,7 @@ public class TaipanShopGUI { loanButton.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { - loanSharkGUI loan = new loanSharkGUI(); + loanSharkGUI loan = new loanSharkGUI(getPlayer()); loan.initializeLoanShark(stage); stage.show(); } From ffb77b14a013f26d65fbd3c24d6fb1f194b5f9f5 Mon Sep 17 00:00:00 2001 From: Vikram Date: Sun, 10 Mar 2019 21:49:50 -0600 Subject: [PATCH 5/5] some changes... --- .idea/misc.xml | 2 +- .idea/workspace.xml | 268 ++++++++++++++++++++++++++++------------- src/Player.java | 18 +-- src/StartGUI.java | 10 +- src/TaipanShop.java | 61 +++++++++- src/TaipanShopGUI.java | 27 +++-- src/TravelGUI.java | 23 ++-- 7 files changed, 276 insertions(+), 133 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index c496ad9..fa20b13 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -9,7 +9,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 4d27f11..ccfdf14 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,7 +2,12 @@ + + + + + @@ -17,10 +22,82 @@ - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -29,28 +106,10 @@ - + - - - - - - - - - - - - - - - - - - - - + + @@ -66,10 +125,6 @@ - numOfLittyShips - delay - Hp - shipwarfare destroyPeasa destr destro @@ -96,6 +151,10 @@ continue cashTex cashTe + 10000 + too + shipstatusstr + shipstatus HP @@ -122,16 +181,17 @@ - -