feat: Started implementing Strings
This commit is contained in:
5
pom.xml
5
pom.xml
@@ -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>
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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
3
strings.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"welcome": "Welcome"
|
||||
}
|
||||
Reference in New Issue
Block a user