Done work on shipWarfareGUi, shortened what needed to be shortened.

This commit is contained in:
KahootChampion
2019-04-11 22:27:27 -06:00
parent 0b5df085bf
commit b4f9ce761c

View File

@@ -476,13 +476,11 @@ public class ShipWarfareGUI extends Player {
primaryStage.setTitle("Ship Warfare"); primaryStage.setTitle("Ship Warfare");
primaryStage.setScene(scene); primaryStage.setScene(scene);
primaryStage.show(); primaryStage.show();
continueButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
/** /**
* Continue Button, engages in run logic and graphical interface * Continue Button, engages in run logic and graphical interface
* @param event, once button is clicked, executes graphical information * @param event, once button is clicked, executes graphical information
*/ */
public void handle(ActionEvent event) { continueButton.setOnAction(event -> {
shotsFired.stop(); shotsFired.stop();
/** /**
@@ -493,18 +491,14 @@ public class ShipWarfareGUI extends Player {
shop.initializeShop(primaryStage); shop.initializeShop(primaryStage);
primaryStage.show(); primaryStage.show();
}
}); });
//Flee //Flee
runButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
/** /**
* Run Button, engages in run logic and graphical interface * Run Button, engages in run logic and graphical interface
* @param event, once button is clicked, executes graphical information * @param event, once button is clicked, executes graphical information
*/ */
public void handle(ActionEvent event) { runButton.setOnAction(event -> {
userAttacks = false; userAttacks = false;
report.setVisible(true); report.setVisible(true);
@@ -537,17 +531,14 @@ public class ShipWarfareGUI extends Player {
} }
}
}); });
//Fight //Fight
fightButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
/** /**
* Fight Button, engages in fight logic and graphical interface * Fight Button, engages in fight logic and graphical interface
* @param event, once button is clicked, executes graphical information * @param event, once button is clicked, executes graphical information
*/ */
public void handle(ActionEvent event) { fightButton.setOnAction(event -> {
userAttacks = true; userAttacks = true;
wipeWithTitle(report); wipeWithTitle(report);
@@ -573,13 +564,23 @@ public class ShipWarfareGUI extends Player {
playerShoots(getGuns()); playerShoots(getGuns());
shotsFired.setOnFinished(new EventHandler<ActionEvent>() {
@Override
/** /**
* When the user is completed their volley this information will be accessed * When the user is completed their volley this information will be accessed
* @param event, once the shots fired transition is completed, execute graphical information * @param event, once the shots fired transition is completed, execute graphical information
*/ */
public void handle(ActionEvent event) { shootingAnimation(usAgainstEnemyDivisor, cannon);
});
}
/**
* Shows the animation of ships being destroyed and our ship being hit
* @param usAgainstEnemyDivisor divisor for us against enemy
* @param cannon circle node for displaying cannon fire
*/
public void shootingAnimation(HBox usAgainstEnemyDivisor, Circle cannon) {
shotsFired.setOnFinished(event1 -> {
shotsFired.stop(); shotsFired.stop();
if (!winOrLose) { if (!winOrLose) {
shipsRetaliate(); shipsRetaliate();
@@ -591,13 +592,11 @@ public class ShipWarfareGUI extends Player {
shotsFired.stop(); shotsFired.stop();
} }
enemyShots.setOnFinished(new EventHandler<ActionEvent>() {
@Override
/** /**
* When the user is completed their volley, this information will be accessed * When the user is completed their volley, this information will be accessed
* @param event, once the enemy shots transition is completed, execute graphical information * @param event, once the enemy shots transition is completed, execute graphical information
*/ */
public void handle(ActionEvent event) { enemyShots.setOnFinished(event11 -> {
fightButton.setVisible(true); fightButton.setVisible(true);
runButton.setVisible(true); runButton.setVisible(true);
report.setVisible(true); report.setVisible(true);
@@ -612,15 +611,8 @@ public class ShipWarfareGUI extends Player {
usAgainstEnemyDivisor.setVisible(false); usAgainstEnemyDivisor.setVisible(false);
} }
}
}); });
}
}); });
}
});
} }
} }