Commit 3a6fb55f authored by Carl Johan Gützkow's avatar Carl Johan Gützkow 🎮
Browse files

feat: added sample armies to resources folder

parent 50939c3a
......@@ -19,7 +19,7 @@ import java.util.Random;
* meant to fight another army.
*
* @author Carl Gützkow
* @version 1.2 14.05.2022
* @version 1.3 17.05.2022
*/
public class Army {
......@@ -27,7 +27,7 @@ public class Army {
units are added and removed from the list
and the units inside can be indexed. */
private String name;
private final ObservableList<Unit> units;
private final List<Unit> units;
/**
* Instantiates a new Army.
......
......@@ -121,14 +121,16 @@ public class ArmyFileHandler {
*/
public String getFilePath(String fileChooserType) {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Select army from file");
fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("CSV", "*.csv"));
File file = null;
if (fileChooserType.equals("OPEN"))
if (fileChooserType.equals("OPEN")) {
fileChooser.setTitle("Select army from file");
file = fileChooser.showOpenDialog(App.getStage());
else if (fileChooserType.equals("SAVE"))
} else if (fileChooserType.equals("SAVE")) {
fileChooser.setTitle("Select directory to save army");
file = fileChooser.showSaveDialog(App.getStage());
}
if (file != null)
return file.getPath();
......
......@@ -95,7 +95,7 @@ public class App extends Application {
.setHeader("Scene could not be loaded in.\n" +
"Expand the \"Show details\" button to see full stack trace.\n" +
"Error message: " + e.getMessage())
.setMessage(e.getCause().toString())
.setMessage(e.getMessage())
.setListMessage(
Arrays.stream(e.getStackTrace())
.map(String::valueOf)
......
......@@ -2,9 +2,9 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.text.Font?>
<ScrollPane fitToHeight="true" fitToWidth="true" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" fx:controller="edu.ntnu.idatt2001.carljgu.client.EditArmyController" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
<HBox id="hboxRoot" alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308">
<VBox alignment="CENTER" maxWidth="1.7976931348623157E308" HBox.hgrow="ALWAYS">
......
Broken modern army
RangedUnit, artillery, 25
RangedUnit, artillery, 25
RangedUnit, artillery, 25
RangedUnit, artillery, 25
RangedUnit, gunner, 15
RangedUnit, gunner, 15
RangedUnit, gunner, 15
RangedUni, gunner, 15
RangedUnit, gunner 15
Unit, gunner, 15
RangedUnit gunner 15
RangedUnit, , 15
CavalryUnit, tank, 50
Commander, a broken leader, 100
\ No newline at end of file
Medieval army
InfantryUnit, knight, 20
InfantryUnit, knight, 20
InfantryUnit, knight, 20
InfantryUnit, big knight, 40
InfantryUnit, big knight, 40
RangedUnit, archer, 15
RangedUnit, archer, 15
CavalryUnit, knight on horse, 50
CommanderUnit, dark knight, 100
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment