Develope game branch #33

Merged
schrom01 merged 23 commits from develope_Game_branch into main 2022-05-12 13:44:47 +02:00
2 changed files with 13 additions and 9 deletions
Showing only changes of commit d3a4b4cc87 - Show all commits

View File

@ -84,11 +84,11 @@ public class FactoryDecorator implements IsObservable{
List<List<Game>> gameList = tournamentDecorator.getTournament().getGameList();
List<GameDecorator> gameDecorators = new ArrayList<>();
List<GameDecorator> gameDecoratorsList = new ArrayList<>();
double gameBoxHeight = 0;
double spacingFactor = 0;
for (int i = 0; i < gameList.size(); i++) {
List<GameDecorator> newGameDecorators = new ArrayList<>();
List<GameDecorator> newGameDecoratorsList = new ArrayList<>();
VBox vBox = new VBox();
if(treeView){
vBox.setAlignment(Pos.CENTER);
@ -99,13 +99,13 @@ public class FactoryDecorator implements IsObservable{
spacingFactor = spacingFactor * 2 + 1;
for (int j = 0; j < gameList.get(i).size(); j++) {
GameDecorator gameDecorator = new GameDecorator(gameList.get(i).get(j));
newGameDecorators.add(gameDecorator);
GameController controller = openGameView(vBox,gameDecorator);
newGameDecoratorsList.add(gameDecorator);
GameController gameController = openGameView(vBox,gameDecorator);
if(i>0){
controller.addListener(gameDecorators.get(j*2));
controller.addListener(gameDecorators.get(j*2+1));
gameController.addListener(gameDecoratorsList.get(j*2));
gameController.addListener(gameDecoratorsList.get(j*2+1));
} else if(gameBoxHeight == 0) {
gameBoxHeight = controller.getGameBoxHeigth();
gameBoxHeight = gameController.getGameBoxHeigth();
}
gameDecorator.addListener(new IsObserver() {
@Override
@ -113,14 +113,14 @@ public class FactoryDecorator implements IsObservable{
tournamentDecorator.saveTournament();
}
});
controller.loadContent();
gameController.loadContent();
}
hBoxCenter.getChildren().add(vBox);
if(treeView){
if(i+1 < gameList.size())
hBoxCenter.getChildren().add(drawLines(vBox, gameBoxHeight, 30));
}
gameDecorators = newGameDecorators;
gameDecoratorsList = newGameDecoratorsList;
}
}

View File

@ -27,9 +27,13 @@ public class GameDecorator implements IsObservable{
public void saveGameResult(String points1, String points2){
if(points1.length() > 0){
game.setPoints1(Integer.parseInt(points1));
} else {
game.setPoints1(0);
}
if(points2.length() > 0) {
game.setPoints2(Integer.parseInt(points2));
} else {
game.setPoints2(0);
}
informListener();
}