diff --git a/pom.xml b/pom.xml index 3bb56f6..f97ce02 100644 --- a/pom.xml +++ b/pom.xml @@ -15,6 +15,11 @@ + + com.fasterxml.jackson.core + jackson-databind + 2.17.0 + org.projectlombok lombok diff --git a/src/main/java/cz/jull/Game.java b/src/main/java/cz/jull/Game.java index 5bc337b..f5d45cf 100644 --- a/src/main/java/cz/jull/Game.java +++ b/src/main/java/cz/jull/Game.java @@ -5,6 +5,7 @@ import cz.jull.surroundings.ForestType; import cz.jull.surroundings.PathType; import cz.jull.surroundings.SoilType; import cz.jull.surroundings.WaterType; +import cz.jull.tui.Strings; import lombok.Getter; import java.util.ArrayList; @@ -25,14 +26,24 @@ public class Game { @Getter private WaterType waterType; + private Strings strings; + @Getter private final List buildings = new ArrayList<>(); @Getter private Market market; + public Game(Strings strings) { + this.strings = strings; + } + public void play() { + System.out.println(strings.getWelcome()); generateStats(); + for (int i = 0; i < 10; i++) { + + } // TODO the whole game } diff --git a/src/main/java/cz/jull/Main.java b/src/main/java/cz/jull/Main.java index 7e9918c..f2e09c3 100644 --- a/src/main/java/cz/jull/Main.java +++ b/src/main/java/cz/jull/Main.java @@ -1,8 +1,13 @@ package cz.jull; +import cz.jull.tui.Strings; + +import java.io.IOException; + public class Main { - public static void main(String[] args) { - Game game = new Game(); + public static void main(String[] args) throws IOException { + Strings strings = Strings.load(); + Game game = new Game(strings); game.play(); } } \ No newline at end of file diff --git a/src/main/java/cz/jull/tui/Strings.java b/src/main/java/cz/jull/tui/Strings.java index adc5488..db1b2eb 100644 --- a/src/main/java/cz/jull/tui/Strings.java +++ b/src/main/java/cz/jull/tui/Strings.java @@ -1,5 +1,17 @@ package cz.jull.tui; -public class Strings { +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.Getter; +import java.io.File; +import java.io.IOException; + +@Getter +public class Strings { + private String welcome; + + public static Strings load() throws IOException { + ObjectMapper objectMapper = new ObjectMapper(); + return objectMapper.readValue(new File("./strings.json"), Strings.class); + } } diff --git a/strings.json b/strings.json new file mode 100644 index 0000000..5e24f8e --- /dev/null +++ b/strings.json @@ -0,0 +1,3 @@ +{ + "welcome": "Welcome" +} \ No newline at end of file