feat: Started implementing Strings
This commit is contained in:
5
pom.xml
5
pom.xml
@@ -15,6 +15,11 @@
|
|||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<version>2.17.0</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import cz.jull.surroundings.ForestType;
|
|||||||
import cz.jull.surroundings.PathType;
|
import cz.jull.surroundings.PathType;
|
||||||
import cz.jull.surroundings.SoilType;
|
import cz.jull.surroundings.SoilType;
|
||||||
import cz.jull.surroundings.WaterType;
|
import cz.jull.surroundings.WaterType;
|
||||||
|
import cz.jull.tui.Strings;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -25,14 +26,24 @@ public class Game {
|
|||||||
@Getter
|
@Getter
|
||||||
private WaterType waterType;
|
private WaterType waterType;
|
||||||
|
|
||||||
|
private Strings strings;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final List<Item> buildings = new ArrayList<>();
|
private final List<Item> buildings = new ArrayList<>();
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private Market market;
|
private Market market;
|
||||||
|
|
||||||
|
public Game(Strings strings) {
|
||||||
|
this.strings = strings;
|
||||||
|
}
|
||||||
|
|
||||||
public void play() {
|
public void play() {
|
||||||
|
System.out.println(strings.getWelcome());
|
||||||
generateStats();
|
generateStats();
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
|
||||||
|
}
|
||||||
// TODO the whole game
|
// TODO the whole game
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
package cz.jull;
|
package cz.jull;
|
||||||
|
|
||||||
|
import cz.jull.tui.Strings;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) throws IOException {
|
||||||
Game game = new Game();
|
Strings strings = Strings.load();
|
||||||
|
Game game = new Game(strings);
|
||||||
game.play();
|
game.play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,17 @@
|
|||||||
package cz.jull.tui;
|
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