feat: Started implementing Strings

This commit is contained in:
2025-05-19 11:01:15 +02:00
parent 7dbd198e84
commit 8c74441e70
5 changed files with 39 additions and 3 deletions

View File

@@ -15,6 +15,11 @@
</properties>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>

View File

@@ -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<Item> 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
}

View File

@@ -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();
}
}

View File

@@ -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);
}
}

3
strings.json Normal file
View File

@@ -0,0 +1,3 @@
{
"welcome": "Welcome"
}