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

add(ui): add map forge scenes #63

parent 86798e71
No related branches found
No related tags found
5 merge requests!74V1,!73Initial commit,!71Merge DataBase into Development,!10Mergin ui into development,!9Merging ui into development
Showing
with 216 additions and 5 deletions
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="b0fb4bdd-29b1-4f86-bd7c-f8c039cc32f2" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/src/main/java/de/hdm_stuttgart/battlearena/Controller/MainMenuController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/de/hdm_stuttgart/battlearena/Controller/MainMenuController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/de/hdm_stuttgart/battlearena/Controller/MenuBorderPaneController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/de/hdm_stuttgart/battlearena/Controller/MenuBorderPaneController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/fxml/MainMenu.fxml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/fxml/MainMenu.fxml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/fxml/MenuBorderPane.fxml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/fxml/MenuBorderPane.fxml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/fxml/Multiplayer.fxml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/fxml/Multiplayer.fxml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/styles/style.css" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/styles/style.css" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="ProjectColorInfo">{
&quot;customColor&quot;: &quot;&quot;,
&quot;associatedIndex&quot;: 5
}</component>
<component name="ProjectId" id="2Zs6XcL7ZlzU8xTNH2hOhkYjatb" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;,
&quot;git-widget-placeholder&quot;: &quot;ui&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
}
}</component>
<component name="RunManager">
<configuration name="Main" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="de.hdm_stuttgart.battlearena.Main.Main" />
<module name="BattleArena" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="b0fb4bdd-29b1-4f86-bd7c-f8c039cc32f2" name="Changes" comment="" />
<created>1703198483742</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1703198483742</updated>
<workItem from="1703198485662" duration="453000" />
<workItem from="1703342937046" duration="2000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
</project>
\ No newline at end of file
package de.hdm_stuttgart.battlearena.Controller;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.geometry.Rectangle2D;
import javafx.scene.control.TableView;
import javafx.scene.layout.VBox;
import javafx.stage.Screen;
import java.net.URL;
import java.util.ResourceBundle;
public class CommunityMapController implements Initializable {
@FXML
private VBox parent;
@FXML
private TableView tableView;
Rectangle2D screen = Screen.getPrimary().getVisualBounds();
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
tableView.setOnMouseClicked(mouseEvent -> System.out.println(tableView.getWidth()));
setTableView();
}
private void setTableView() {
tableView.setMinHeight(screen.getHeight() * 0.69);
tableView.setMinWidth(screen.getWidth() * 0.66);
}
// TODO: create map preview
public void back() {
parent.getChildren().clear();
parent.getChildren().add(new SceneLoader().loadScene("MapForge"));
}
}
......@@ -25,13 +25,16 @@ public class MainMenuController implements Initializable {
public void playScene() {
switchScene("Play");
}
public void mapScene() {
switchScene("MapForge");
}
public void statisticsScene() {
switchScene("Statistics");
}
public void settingsScene() {
switchScene("Options");
switchScene("Settings");
}
public void exit() {
......
package de.hdm_stuttgart.battlearena.Controller;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.layout.VBox;
import java.io.IOException;
import java.util.Objects;
public class MapForgeController {
@FXML
private VBox parent;
SceneLoader sceneLoader = new SceneLoader();
public void mapEditorScene() {
try {
parent.getScene().setRoot(FXMLLoader.load(Objects.requireNonNull(getClass().getResource("/fxml/PlayerCreateScene.fxml"))));
MusicPlayerSingleton.getInstance().getMediaPlayer().dispose();
} catch (IOException e) {
throw new RuntimeException();
}
}
public void communityMapScene() {
switchScene("CommunityMaps");
}
public void updateMapScene() {
try {
parent.getScene().setRoot(FXMLLoader.load(Objects.requireNonNull(getClass().getResource("/fxml/PlayerCreateScene.fxml"))));
MusicPlayerSingleton.getInstance().getMediaPlayer().dispose();
} catch (IOException e) {
throw new RuntimeException();
}
}
public void back() {
switchScene("MainMenu");
}
private void switchScene(String name) {
parent.getChildren().clear();
parent.getChildren().add(sceneLoader.loadScene(name));
}
}
......@@ -50,6 +50,7 @@ public class MenuBorderPaneController implements Initializable {
private void easterEgg() {
btnRight.setOnMouseClicked(mouseEvent -> {
System.out.println(center.getWidth());
musicCounter++;
switch (musicCounter) {
case 5:
......
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<VBox fx:id="parent" alignment="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.CommunityMapController">
<children>
<TableView fx:id="tableView" editable="true" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" VBox.vgrow="ALWAYS">
<columns>
<TableColumn editable="false" prefWidth="75.0" text="ID" />
<TableColumn editable="false" prefWidth="75.0" text="Name" />
<TableColumn editable="false" prefWidth="75.0" text="Width" />
<TableColumn editable="false" prefWidth="75.0" text="Height" />
<TableColumn editable="false" prefWidth="75.0" text="Downloads" />
</columns>
<columnResizePolicy>
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
</columnResizePolicy>
</TableView>
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" spacing="20.0" VBox.vgrow="ALWAYS">
<children>
<Button mnemonicParsing="false" onAction="#back" text="Back" />
<Button mnemonicParsing="false" text="Load" />
</children>
</HBox>
</children>
</VBox>
......@@ -15,7 +15,7 @@
<Insets top="20.0" />
</VBox.margin>
</Button>
<Button mnemonicParsing="false" text="Map Creator" VBox.vgrow="ALWAYS" />
<Button mnemonicParsing="false" onAction="#mapScene" text="Map Forge" VBox.vgrow="ALWAYS" />
<Button mnemonicParsing="false" onAction="#statisticsScene" text="Statistics" VBox.vgrow="ALWAYS" />
<Button mnemonicParsing="false" onAction="#settingsScene" text="Settings" />
<Button fx:id="exitButton" alignment="CENTER" mnemonicParsing="false" onAction="#exit" text="Exit" />
......
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?>
<VBox fx:id="parent" alignment="CENTER" prefHeight="400.0" prefWidth="600.0" spacing="50.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hdm_stuttgart.battlearena.Controller.MapForgeController">
<children>
<Pane VBox.vgrow="ALWAYS" />
<Button mnemonicParsing="false" onAction="#mapEditorScene" text="Map Editor" />
<Button mnemonicParsing="false" onAction="#communityMapScene" text="Community Maps" />
<Button mnemonicParsing="false" onAction="#updateMapScene" text="Update Core Maps" />
<Button mnemonicParsing="false" onAction="#back" text="Back" />
<Pane VBox.vgrow="ALWAYS" />
<Pane VBox.vgrow="ALWAYS" />
</children>
</VBox>
......@@ -34,6 +34,6 @@
</Button>
</left>
<center>
<StackPane fx:id="center" prefHeight="150.0" prefWidth="200.0" BorderPane.alignment="CENTER" />
<StackPane fx:id="center" BorderPane.alignment="CENTER" />
</center>
</BorderPane>
......@@ -7,7 +7,7 @@
<VBox fx:id="parent" alignment="CENTER" prefHeight="400.0" prefWidth="600.0" spacing="50.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hdm_stuttgart.battlearena.Controller.MultiplayerController">
<children>
<Pane maxHeight="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS" />
<Pane VBox.vgrow="ALWAYS" />
<Button mnemonicParsing="false" onAction="#multiplayerCreateScene" text="Create" VBox.vgrow="ALWAYS">
<VBox.margin>
<Insets top="20.0" />
......
......@@ -131,4 +131,6 @@
.skinSelection:pressed {
-fx-background-color: rgba(255, 255, 255, 0.3);
}
\ No newline at end of file
}
/* TODO: set tableView style*/
\ No newline at end of file
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