Skip to content
Snippets Groups Projects
Commit a7023581 authored by Tran Peter's avatar Tran Peter
Browse files

update(ui): remove local create scene

parent 5589550f
No related branches found
No related tags found
4 merge requests!74V1,!73Initial commit,!71Merge DataBase into Development,!61Merge ui into deveolpment
Pipeline #60187 failed
package de.hdm_stuttgart.battlearena.Controller;
import de.hdm_stuttgart.battlearena.Controller.Utilities.SceneLoader;
import de.hdm_stuttgart.battlearena.Model.DataStorage.Classes.Persistence;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import javafx.scene.control.TitledPane;
import javafx.scene.control.ToggleButton;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.VBox;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.net.URL;
import java.util.ResourceBundle;
public class LocalCreateController implements Initializable {
@FXML
private VBox parent;
@FXML
private TitledPane roundsTitledPane;
@FXML
private ToggleGroup rounds;
@FXML
private Label errorMsg;
private final SceneLoader sceneLoader = new SceneLoader();
private static final Logger log = LogManager.getLogger(Persistence.class);
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
rounds.selectedToggleProperty().addListener((observableValue, oldToggle, newToggle) -> {
if (rounds.getSelectedToggle() != null) {
ToggleButton selected = (ToggleButton) rounds.getSelectedToggle();
roundsTitledPane.setText(selected.getText());
log.info("Match rounds: " + selected.getText());
}
});
// TODO: toggle for time and other items
}
@FXML
private void backButton() {
parent.getChildren().clear();
parent.getChildren().add(sceneLoader.loadScene("Play"));
}
@FXML
private void skinSelectionScene() {
if (rounds.getSelectedToggle() == null) {
errorMsg.setText("Please select round");
} else {
parent.getChildren().clear();
parent.getChildren().add(sceneLoader.loadScene("SkinSelection"));
}
}
}
......@@ -16,7 +16,7 @@ public class PlayController {
@FXML
private void localScene() {
switchScene("LocalCreate");
switchScene("SkinSelection");
}
@FXML
......
......@@ -84,7 +84,7 @@ public class SkinSelectionController implements Initializable {
@FXML
private void backButton() {
parent.getChildren().clear();
parent.getChildren().add(new SceneLoader().loadScene("LocalCreate"));
parent.getChildren().add(new SceneLoader().loadScene("Play"));
}
@FXML
......
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Accordion?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.RadioButton?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.control.ToggleButton?>
<?import javafx.scene.control.ToggleGroup?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Text?>
<VBox fx:id="parent" alignment="BOTTOM_CENTER" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hdm_stuttgart.battlearena.Controller.LocalCreateController">
<children>
<Pane VBox.vgrow="ALWAYS" />
<HBox alignment="CENTER" spacing="20.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Rounds:" />
<Accordion>
<panes>
<TitledPane fx:id="roundsTitledPane" text="Select">
<content>
<ScrollPane minViewportHeight="100.0">
<content>
<VBox fx:id="boxBox">
<children>
<ToggleButton mnemonicParsing="false" styleClass="roundsButton" text="1">
<toggleGroup>
<ToggleGroup fx:id="rounds" />
</toggleGroup>
<VBox.margin>
<Insets />
</VBox.margin>
</ToggleButton>
<ToggleButton mnemonicParsing="false" styleClass="roundsButton" text="2" toggleGroup="$rounds" />
<ToggleButton mnemonicParsing="false" styleClass="roundsButton" text="3" toggleGroup="$rounds" />
</children>
</VBox>
</content>
</ScrollPane>
</content>
</TitledPane>
</panes>
</Accordion>
</children>
<VBox.margin>
<Insets />
</VBox.margin>
</HBox>
<Pane VBox.vgrow="ALWAYS" />
<HBox alignment="CENTER" spacing="20.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Time:" />
<Accordion>
<panes>
<TitledPane animated="false" text="Select">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
</content>
</TitledPane>
</panes>
</Accordion>
</children>
</HBox>
<Pane VBox.vgrow="ALWAYS" />
<HBox alignment="TOP_CENTER" spacing="10.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Players:" />
<RadioButton mnemonicParsing="false" selected="true" text="2">
<toggleGroup>
<ToggleGroup fx:id="group31" />
</toggleGroup>
</RadioButton>
<RadioButton mnemonicParsing="false" text="3" toggleGroup="$group31" />
<RadioButton mnemonicParsing="false" text="4" toggleGroup="$group31" />
</children>
</HBox>
<Pane VBox.vgrow="ALWAYS" />
<HBox alignment="TOP_CENTER" spacing="10.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Text:" />
<RadioButton mnemonicParsing="false" text="Yes">
<toggleGroup>
<ToggleGroup fx:id="group1" />
</toggleGroup>
</RadioButton>
<RadioButton mnemonicParsing="false" selected="true" text="No" toggleGroup="$group1" />
</children>
</HBox>
<Pane VBox.vgrow="ALWAYS" />
<HBox alignment="TOP_CENTER" spacing="10.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Text:" />
<RadioButton mnemonicParsing="false" text="Yes">
<toggleGroup>
<ToggleGroup fx:id="group2" />
</toggleGroup>
</RadioButton>
<RadioButton mnemonicParsing="false" selected="true" text="No" toggleGroup="$group2" />
</children>
</HBox>
<Pane VBox.vgrow="ALWAYS" />
<HBox alignment="TOP_CENTER" spacing="10.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Text:" />
<RadioButton mnemonicParsing="false" text="Yes">
<toggleGroup>
<ToggleGroup fx:id="group3" />
</toggleGroup>
</RadioButton>
<RadioButton mnemonicParsing="false" selected="true" text="No" toggleGroup="$group3" />
</children>
</HBox>
<Pane VBox.vgrow="ALWAYS" />
<Label fx:id="errorMsg" />
<Pane VBox.vgrow="ALWAYS" />
<Button mnemonicParsing="false" onAction="#skinSelectionScene" text="Next" />
<Pane VBox.vgrow="ALWAYS" />
<Button mnemonicParsing="false" onAction="#backButton" text="Back">
<VBox.margin>
<Insets />
</VBox.margin>
</Button>
</children>
</VBox>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment