mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Review fixes for merge request.
PlayerCell now takes in the yacht for construction rather than taking in a whole lot of values extracted from the yacht Reduced boiler plate in BoatCustomizeController #story[1274]
This commit is contained in:
@@ -20,7 +20,7 @@ import java.util.Observer;
|
||||
*/
|
||||
public class ServerYacht {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(ClientYacht.class);
|
||||
private Logger logger = LoggerFactory.getLogger(ServerYacht.class);
|
||||
|
||||
public static final Double TURN_STEP = 5.0;
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ public class LobbyController implements Initializable {
|
||||
FXMLLoader loader = new FXMLLoader(
|
||||
getClass().getResource("/views/cells/PlayerCell.fxml"));
|
||||
|
||||
loader.setController(new PlayerCell(playerId, yacht.getBoatName(), yacht.getColour(), yacht.getBoatType()));
|
||||
loader.setController(new PlayerCell(playerId, yacht));
|
||||
|
||||
try {
|
||||
pane = loader.load();
|
||||
|
||||
@@ -6,6 +6,7 @@ import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.paint.Color;
|
||||
import seng302.model.ClientYacht;
|
||||
import seng302.visualiser.fxObjects.assets_3D.BoatMeshType;
|
||||
import seng302.visualiser.fxObjects.assets_3D.BoatModel;
|
||||
import seng302.visualiser.fxObjects.assets_3D.ModelFactory;
|
||||
@@ -24,13 +25,13 @@ public class PlayerCell {
|
||||
private String name;
|
||||
private Color boatColor;
|
||||
private Integer playerId;
|
||||
private BoatMeshType boatype;
|
||||
private BoatMeshType boatType;
|
||||
|
||||
public PlayerCell(Integer playerId, String playerName, Color color, String boatType) {
|
||||
public PlayerCell(Integer playerId, ClientYacht yacht) {
|
||||
this.playerId = playerId;
|
||||
this.name = playerName;
|
||||
this.boatColor = color;
|
||||
this.boatype = BoatMeshType.getBoatMeshType(boatType);
|
||||
this.name = yacht.getBoatName();
|
||||
this.boatColor = yacht.getColour();
|
||||
this.boatType = BoatMeshType.getBoatMeshType(yacht.getBoatType());
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
@@ -39,7 +40,7 @@ public class PlayerCell {
|
||||
// Add Rotating Boat to Player Cell with players color on it.
|
||||
Group group = new Group();
|
||||
boatPane.getChildren().add(group);
|
||||
BoatModel bo = ModelFactory.boatIconView(this.boatype, this.boatColor);
|
||||
BoatModel bo = ModelFactory.boatIconView(boatType, boatColor);
|
||||
group.getChildren().add(bo.getAssets());
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.jfoenix.controls.JFXTextField;
|
||||
import com.jfoenix.validation.RequiredFieldValidator;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.geometry.Insets;
|
||||
@@ -40,9 +39,8 @@ public class BoatCustomizeController implements Initializable{
|
||||
@FXML
|
||||
private Pane boatPane;
|
||||
@FXML
|
||||
void colorChanged(ActionEvent event) {
|
||||
Color color = colorPicker.getValue();
|
||||
RefreshBoat();
|
||||
void colorChanged() {
|
||||
refreshBoat();
|
||||
}
|
||||
//---------FXML END---------//
|
||||
|
||||
@@ -62,6 +60,8 @@ public class BoatCustomizeController implements Initializable{
|
||||
playerNameLengthValidator.setMessage("Player name too long.");
|
||||
|
||||
boatName.setValidators(playerNameLengthValidator, playerNameReqValidator);
|
||||
boatPane.setBackground(
|
||||
new Background(new BackgroundFill(Color.SKYBLUE, CornerRadii.EMPTY, Insets.EMPTY)));
|
||||
|
||||
submitBtn.setOnMouseReleased(event -> {
|
||||
Sounds.playButtonClick();
|
||||
@@ -69,7 +69,6 @@ public class BoatCustomizeController implements Initializable{
|
||||
});
|
||||
|
||||
submitBtn.setOnMouseEntered(e -> Sounds.playHoverSound());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,36 +112,30 @@ public class BoatCustomizeController implements Initializable{
|
||||
}
|
||||
|
||||
public void setCurrentBoat(String boatType) {
|
||||
Group group = new Group();
|
||||
this.currentBoat = BoatMeshType.getBoatMeshType(boatType);
|
||||
boatPane.setBackground(new Background(new BackgroundFill(Color.SKYBLUE, CornerRadii.EMPTY, Insets.EMPTY)));
|
||||
boatPane.getChildren().add(group);
|
||||
BoatModel bo = ModelFactory.boatCustomiseView(currentBoat, colorPicker.getValue());
|
||||
group.getChildren().add(bo.getAssets());
|
||||
group.getChildren().add(new PointLight());
|
||||
currentBoat = BoatMeshType.getBoatMeshType(boatType);
|
||||
displayCurrentBoat();
|
||||
}
|
||||
|
||||
public void nextBoat(ActionEvent actionEvent) {
|
||||
boatPane.getChildren().clear();
|
||||
Group group = new Group();
|
||||
boatPane.getChildren().add(group);
|
||||
public void nextBoat() {
|
||||
currentBoat = BoatMeshType.getNextBoatType(currentBoat);
|
||||
BoatModel bo = ModelFactory.boatCustomiseView(currentBoat, colorPicker.getValue());
|
||||
group.getChildren().add(bo.getAssets());
|
||||
group.getChildren().add(new PointLight());
|
||||
displayCurrentBoat();
|
||||
}
|
||||
|
||||
public void prevBoat(ActionEvent actionEvent) {
|
||||
public void prevBoat() {
|
||||
currentBoat = BoatMeshType.getPrevBoatType(currentBoat);
|
||||
displayCurrentBoat();
|
||||
}
|
||||
|
||||
private void displayCurrentBoat() {
|
||||
boatPane.getChildren().clear();
|
||||
Group group = new Group();
|
||||
boatPane.getChildren().add(group);
|
||||
currentBoat = BoatMeshType.getPrevBoatType(currentBoat);
|
||||
BoatModel bo = ModelFactory.boatCustomiseView(currentBoat, colorPicker.getValue());
|
||||
group.getChildren().add(bo.getAssets());
|
||||
group.getChildren().add(new PointLight());
|
||||
}
|
||||
|
||||
private void RefreshBoat() {
|
||||
private void refreshBoat() {
|
||||
boatPane.getChildren().clear();
|
||||
Group group = new Group();
|
||||
boatPane.getChildren().add(group);
|
||||
|
||||
Reference in New Issue
Block a user