diff --git a/src/main/java/galaxyoyo/unknown/api/editor/EditorAPI.java b/src/main/java/galaxyoyo/unknown/api/editor/EditorAPI.java index f652587..cee093b 100644 --- a/src/main/java/galaxyoyo/unknown/api/editor/EditorAPI.java +++ b/src/main/java/galaxyoyo/unknown/api/editor/EditorAPI.java @@ -32,7 +32,7 @@ public class EditorAPI } } - return RawMap.create(cases); + return RawMap.create(cases, width, height); } private static Gson createGson() diff --git a/src/main/java/galaxyoyo/unknown/api/editor/RawMap.java b/src/main/java/galaxyoyo/unknown/api/editor/RawMap.java index a01f397..7c5fad9 100644 --- a/src/main/java/galaxyoyo/unknown/api/editor/RawMap.java +++ b/src/main/java/galaxyoyo/unknown/api/editor/RawMap.java @@ -5,16 +5,30 @@ import java.util.List; public class RawMap { private List cases; + private int width; + private int height; public List getCases() { return cases; } - public static RawMap create(List cases) + public int getWidth() + { + return width; + } + + public int getHeight() + { + return height; + } + + public static RawMap create(List cases, int width, int height) { RawMap rm = new RawMap(); rm.cases = cases; + rm.width = width; + rm.height = height; return rm; } } diff --git a/src/main/java/galaxyoyo/unknown/editor/Map.java b/src/main/java/galaxyoyo/unknown/editor/Map.java index 9af4503..1ff0853 100644 --- a/src/main/java/galaxyoyo/unknown/editor/Map.java +++ b/src/main/java/galaxyoyo/unknown/editor/Map.java @@ -13,11 +13,16 @@ import java.util.List; public class Map { private final EditorFrame frame; + private int width; + private int height; private List cases = new ArrayList(); private java.util.Map casesMap = new HashMap(); public Map(RawMap raw) { + this.width = raw.getWidth(); + this.height = raw.getHeight(); + for (RawCase rc : raw.getCases()) { cases.add(Case.create(rc.getPosX(), rc.getPosY(), SpriteRegister.getCategory(rc.getCoucheOne().getPrimaryIndex()).get(rc.getCoucheOne().getSecondaryIndex()), SpriteRegister.getCategory(rc.getCoucheTwo().getPrimaryIndex()).get(rc.getCoucheTwo().getSecondaryIndex()), SpriteRegister.getCategory(rc.getCoucheThree().getPrimaryIndex()).get(rc.getCoucheThree().getSecondaryIndex()))); @@ -33,6 +38,16 @@ public class Map return frame; } + public int getWidth() + { + return width; + } + + public int getHeight() + { + return height; + } + public Case getCase(int x, int y) { if (casesMap.isEmpty())