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.setScene(scene);
primaryStage.show();
continueButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
/**
* Continue Button, engages in run logic and graphical interface
* @param event, once button is clicked, executes graphical information
*/
public void handle(ActionEvent event) {
continueButton.setOnAction(event -> {
shotsFired.stop();
/**
@@ -493,18 +491,14 @@ public class ShipWarfareGUI extends Player {
shop.initializeShop(primaryStage);
primaryStage.show();
}
});
//Flee
runButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
/**
* Run Button, engages in run logic and graphical interface
* @param event, once button is clicked, executes graphical information
*/
public void handle(ActionEvent event) {
runButton.setOnAction(event -> {
userAttacks = false;
report.setVisible(true);
@@ -537,17 +531,14 @@ public class ShipWarfareGUI extends Player {
}
}
});
//Fight
fightButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
/**
* Fight Button, engages in fight logic and graphical interface
* @param event, once button is clicked, executes graphical information
*/
public void handle(ActionEvent event) {
fightButton.setOnAction(event -> {
userAttacks = true;
wipeWithTitle(report);
@@ -573,13 +564,23 @@ public class ShipWarfareGUI extends Player {
playerShoots(getGuns());
shotsFired.setOnFinished(new EventHandler<ActionEvent>() {
@Override
/**
* When the user is completed their volley this information will be accessed
* @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();
if (!winOrLose) {
shipsRetaliate();
@@ -591,13 +592,11 @@ public class ShipWarfareGUI extends Player {
shotsFired.stop();
}
enemyShots.setOnFinished(new EventHandler<ActionEvent>() {
@Override
/**
* When the user is completed their volley, this information will be accessed
* @param event, once the enemy shots transition is completed, execute graphical information
*/
public void handle(ActionEvent event) {
enemyShots.setOnFinished(event11 -> {
fightButton.setVisible(true);
runButton.setVisible(true);
report.setVisible(true);
@@ -612,15 +611,8 @@ public class ShipWarfareGUI extends Player {
usAgainstEnemyDivisor.setVisible(false);
}
}
});
}
});
}
});
}
}