Merge branch 'develop' into Story1274_custom_boat_stats

# Conflicts:
#	src/main/java/seng302/model/ServerYacht.java
#	src/main/java/seng302/visualiser/controllers/dialogs/BoatCustomizeController.java
This commit is contained in:
Kusal Ekanayake
2017-09-23 14:48:50 +12:00
14 changed files with 55 additions and 79 deletions
@@ -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 = 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;
@@ -47,9 +46,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---------//
@@ -72,6 +70,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();
@@ -79,7 +79,6 @@ public class BoatCustomizeController implements Initializable{
});
submitBtn.setOnMouseEntered(e -> Sounds.playHoverSound());
}
/**
@@ -123,42 +122,34 @@ 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());
refreshStatBars(bo);
currentBoat = boatType;
displayCurrentBoat();
refreshStatBars(currentBoat);
}
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());
refreshStatBars(bo);
displayCurrentBoat();
refreshStatBars(currentBoat);
}
public void prevBoat() {
currentBoat = BoatMeshType.getPrevBoatType(currentBoat);
displayCurrentBoat();
refreshStatBars(currentBoat);
}
public void prevBoat(ActionEvent actionEvent) {
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());
refreshStatBars(bo);
}
private void RefreshBoat() {
private void refreshBoat() {
boatPane.getChildren().clear();
Group group = new Group();
boatPane.getChildren().add(group);