mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
307e79ecfc
When a user selects a different boat, it is sent to all other clients and updates accordingly. Boats are all shown with their correct models in game. #story[1274]
58 lines
1.6 KiB
Java
58 lines
1.6 KiB
Java
package seng302.visualiser.controllers.cells;
|
|
|
|
import javafx.fxml.FXML;
|
|
import javafx.scene.Group;
|
|
import javafx.scene.control.Label;
|
|
import javafx.scene.layout.GridPane;
|
|
import javafx.scene.layout.Pane;
|
|
import javafx.scene.paint.Color;
|
|
import seng302.visualiser.fxObjects.assets_3D.BoatMeshType;
|
|
import seng302.visualiser.fxObjects.assets_3D.BoatModel;
|
|
import seng302.visualiser.fxObjects.assets_3D.ModelFactory;
|
|
|
|
public class PlayerCell {
|
|
|
|
//--------FXML BEGIN--------//
|
|
@FXML
|
|
private Label playerName;
|
|
@FXML
|
|
private GridPane playerListCell;
|
|
@FXML
|
|
private Pane boatPane;
|
|
//---------FXML END---------//
|
|
|
|
private String name;
|
|
private Color boatColor;
|
|
private Integer playerId;
|
|
private BoatMeshType boatype;
|
|
|
|
public PlayerCell(Integer playerId, String playerName, Color color, String boatType) {
|
|
this.playerId = playerId;
|
|
this.name = playerName;
|
|
this.boatColor = color;
|
|
this.boatype = BoatMeshType.getBoatMeshType(boatType);
|
|
}
|
|
|
|
public void initialize() {
|
|
// Set Player Name
|
|
playerName.setText(name);
|
|
// 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);
|
|
group.getChildren().add(bo.getAssets());
|
|
}
|
|
|
|
public Integer getPlayerId() {
|
|
return playerId;
|
|
}
|
|
|
|
public String getPlayerName() {
|
|
return name;
|
|
}
|
|
|
|
public Color getBoatColor() {
|
|
return boatColor;
|
|
}
|
|
}
|