Develope game branch #33

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

View File

@ -83,10 +83,14 @@ public class FactoryDecorator implements IsObservable{
List<List<Game>> gameList = tournamentDecorator.getTournament().getGameList();
List<GameDecorator> gameDecorators = new ArrayList<>();
double gameBoxHeight = 0;
double spacingFactor = 0;
for (int i = 0; i < gameList.size(); i++) {
List<GameDecorator> newGameDecorators = new ArrayList<>();
VBox vBox = new VBox();
vBox.setAlignment(Pos.CENTER);
vBox.setSpacing(gameBoxHeight * spacingFactor);
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);
@ -94,6 +98,8 @@ public class FactoryDecorator implements IsObservable{
if(i>0){
controller.addListener(gameDecorators.get(j*2));
controller.addListener(gameDecorators.get(j*2+1));
} else if(gameBoxHeight == 0) {
gameBoxHeight = controller.getGameBoxHeigth();
}
gameDecorator.addListener(new IsObserver() {
@Override

View File

@ -7,11 +7,15 @@ import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
public class GameController extends FXController{
private GameDecorator gameDecorator;
@FXML
private VBox mainVBox;
@FXML
private Label participantNameOne;
@ -27,12 +31,15 @@ public class GameController extends FXController{
@FXML
private TextField pointsTeamTwo;
@FXML
void saveGamerResult(ActionEvent event) {
gameDecorator.saveGame(pointsTeamOne.getText(), pointsTeamTwo.getText(), placesChoiceBox.getValue());
}
public double getGameBoxHeigth(){
return mainVBox.getPrefHeight();
}
@Override
public void loadContent() {
participantNameOne.setText(gameDecorator.getParticipantOne());

View File

@ -8,7 +8,9 @@
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<VBox alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="200.0" prefWidth="200.0" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.projekt2.turnierverwaltung.main.gameScheduleView.GameController">
<VBox alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="200.0" prefWidth="200.0" style="-fx-border-color: black; -fx-border-insets: 2; -fx-border-width: 3;" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.projekt2.turnierverwaltung.main.gameScheduleView.GameController">
<children>
<VBox fx:id="mainVBox" alignment="CENTER" prefHeight="200.0" prefWidth="100.0">
<children>
<Label fx:id="participantNameOne" text="Participant One" />
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
@ -52,3 +54,5 @@
</Button>
</children>
</VBox>
</children>
</VBox>

View File

@ -4,7 +4,7 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.2" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.projekt2.turnierverwaltung.main.gameScheduleView.GameScheduleController">
<BorderPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.2" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.projekt2.turnierverwaltung.main.gameScheduleView.GameScheduleController">
<top>
<HBox alignment="TOP_RIGHT" prefHeight="100.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<children>
@ -28,6 +28,10 @@
</HBox>
</top>
<center>
<HBox fx:id="hBoxCenter" prefHeight="324.0" prefWidth="600.0" BorderPane.alignment="CENTER" />
<ScrollPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<content>
<HBox fx:id="hBoxCenter" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="324.0" prefWidth="600.0" spacing="100.0" />
</content>
</ScrollPane>
</center>
</BorderPane>