|
|
|
@ -8,6 +8,7 @@ import javafx.collections.ListChangeListener;
|
|
|
|
import javafx.collections.ObservableList;
|
|
|
|
import javafx.collections.ObservableList;
|
|
|
|
import javafx.fxml.FXML;
|
|
|
|
import javafx.fxml.FXML;
|
|
|
|
import javafx.geometry.Insets;
|
|
|
|
import javafx.geometry.Insets;
|
|
|
|
|
|
|
|
import javafx.scene.Node;
|
|
|
|
import javafx.scene.control.*;
|
|
|
|
import javafx.scene.control.*;
|
|
|
|
import javafx.scene.image.ImageView;
|
|
|
|
import javafx.scene.image.ImageView;
|
|
|
|
import javafx.scene.layout.AnchorPane;
|
|
|
|
import javafx.scene.layout.AnchorPane;
|
|
|
|
@ -95,12 +96,28 @@ public class InGameLobbyController extends Controller {
|
|
|
|
importer.read(asset);
|
|
|
|
importer.read(asset);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void resetLobby(){
|
|
|
|
|
|
|
|
int count = 0;
|
|
|
|
|
|
|
|
for (Label label: allPlayerLabels){
|
|
|
|
|
|
|
|
label.setText("Player " + count + 1);
|
|
|
|
|
|
|
|
count ++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Node> nodeCopy = new ArrayList(playerContainer.getChildren());
|
|
|
|
|
|
|
|
for (Node node: nodeCopy){
|
|
|
|
|
|
|
|
if (node instanceof View3D){
|
|
|
|
|
|
|
|
playerContainer.getChildren().remove(node);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void populatePlayers(ListChangeListener.Change change){
|
|
|
|
private void populatePlayers(ListChangeListener.Change change){
|
|
|
|
|
|
|
|
|
|
|
|
Platform.runLater(
|
|
|
|
Platform.runLater(
|
|
|
|
() -> {
|
|
|
|
() -> {
|
|
|
|
while (change.next()){
|
|
|
|
while (change.next()){
|
|
|
|
if (change.wasAdded()){
|
|
|
|
if (change.wasAdded() || change.wasRemoved() || change.wasUpdated() || change.wasPermutated()){
|
|
|
|
try{
|
|
|
|
try{
|
|
|
|
|
|
|
|
resetLobby();
|
|
|
|
int count = 0;
|
|
|
|
int count = 0;
|
|
|
|
int row = 0;
|
|
|
|
int row = 0;
|
|
|
|
for (VisualiserBoat boat :this.visualiserRaceEvent.getVisualiserRaceState().getBoats()) {
|
|
|
|
for (VisualiserBoat boat :this.visualiserRaceEvent.getVisualiserRaceState().getBoats()) {
|
|
|
|
|