mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Fixed memory leak in UIScene
Fixed spelling errors in data Reworked save/load to get backward compatibility possibilities. added auto save and quick save. Fixed card downloads in shops/reward screens
This commit is contained in:
@@ -83,7 +83,11 @@ public class AdventureApplicationAdapter extends ApplicationAdapter {
|
||||
|
||||
private void storeScreen() {
|
||||
if(!(currentScene instanceof ForgeScene))
|
||||
lastScreenTexture = ScreenUtils.getFrameBufferTexture();
|
||||
{
|
||||
if(lastScreenTexture!=null)
|
||||
lastScreenTexture.getTexture().dispose();
|
||||
lastScreenTexture = ScreenUtils.getFrameBufferTexture();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package forge.adventure.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import forge.adventure.util.SaveFileContent;
|
||||
import forge.adventure.util.SaveFileData;
|
||||
|
||||
/**
|
||||
* Data class that will be used to read Json configuration files
|
||||
* BiomeSpriteData
|
||||
* contains the information for the sprites on the map like trees and rocks
|
||||
*/
|
||||
public class BiomeSpriteData implements Serializable {
|
||||
public class BiomeSpriteData implements SaveFileContent {
|
||||
public String name;
|
||||
public double startArea;
|
||||
public double endArea;
|
||||
@@ -18,4 +19,26 @@ public class BiomeSpriteData implements Serializable {
|
||||
public String key() {
|
||||
return "BiomeSprite&" + name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(SaveFileData data) {
|
||||
name=data.readString("name");
|
||||
startArea=data.readDouble("startArea");
|
||||
endArea=data.readDouble("endArea");
|
||||
density=data.readDouble("density");
|
||||
resolution=data.readDouble("resolution");;
|
||||
layer=data.readInt("layer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SaveFileData save() {
|
||||
SaveFileData data=new SaveFileData();
|
||||
data.store("name",name);
|
||||
data.store("startArea",startArea);
|
||||
data.store("endArea",endArea);
|
||||
data.store("density",density);
|
||||
data.store("resolution",resolution);
|
||||
data.store("layer",layer);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,8 +92,8 @@ public class DeckEditScene extends ForgeScene {
|
||||
|
||||
|
||||
|
||||
for (PaperCard card : AdventurePlayer.current().getCards())
|
||||
FModel.getQuest().getCards().addSingleCard(card, 1);
|
||||
for (Map.Entry<PaperCard, Integer> card : AdventurePlayer.current().getCards())
|
||||
FModel.getQuest().getCards().addSingleCard(card.getKey(), card.getValue());
|
||||
|
||||
|
||||
Deck deck = AdventurePlayer.current().getDeck();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package forge.adventure.scene;
|
||||
|
||||
import com.badlogic.gdx.Input;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||
import forge.adventure.AdventureApplicationAdapter;
|
||||
import forge.adventure.util.Current;
|
||||
@@ -37,5 +38,14 @@ public class InnScene extends UIScene {
|
||||
TextButton doneButton = ui.findActor("done");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyPressed(int keycode)
|
||||
{
|
||||
if (keycode == Input.Keys.ESCAPE)
|
||||
{
|
||||
done();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package forge.adventure.scene;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||
@@ -103,6 +104,15 @@ public class RewardScene extends UIScene {
|
||||
doneButton=ui.findActor("done");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyPressed(int keycode)
|
||||
{
|
||||
if (keycode == Input.Keys.ESCAPE)
|
||||
{
|
||||
done();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public void loadRewards(Array<Reward> newRewards, Type type, ShopActor shopActor)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package forge.adventure.scene;
|
||||
|
||||
import com.badlogic.gdx.Input;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||
@@ -36,6 +37,8 @@ public class SaveLoadScene extends UIScene {
|
||||
int currentSlot = -3;
|
||||
Image previewImage;
|
||||
TextButton saveLoadButton;
|
||||
TextButton quickSave;
|
||||
TextButton autoSave;
|
||||
|
||||
public SaveLoadScene() {
|
||||
super("ui/save_load.json");
|
||||
@@ -44,14 +47,15 @@ public class SaveLoadScene extends UIScene {
|
||||
|
||||
|
||||
|
||||
private void addSaveSlot(String name, int i) {
|
||||
private TextButton addSaveSlot(String name, int i) {
|
||||
layout.add(Controls.newLabel(name));
|
||||
TextButton button = Controls.newTextButton("...");
|
||||
button.addListener(new ClickListener() {
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
try {
|
||||
select(i);
|
||||
if(!button.isDisabled())
|
||||
select(i);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -60,6 +64,7 @@ public class SaveLoadScene extends UIScene {
|
||||
layout.add(button).expandX();
|
||||
buttons.put(i, button);
|
||||
layout.row();
|
||||
return button;
|
||||
|
||||
}
|
||||
|
||||
@@ -105,6 +110,15 @@ public class SaveLoadScene extends UIScene {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyPressed(int keycode)
|
||||
{
|
||||
if (keycode == Input.Keys.ESCAPE)
|
||||
{
|
||||
back();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public void save() {
|
||||
dialog.hide();
|
||||
if( WorldSave.getCurrentSave().save(textInput.getText(), currentSlot))
|
||||
@@ -157,6 +171,8 @@ public class SaveLoadScene extends UIScene {
|
||||
header.setText("Load game");
|
||||
saveLoadButton.setText("Load");
|
||||
}
|
||||
autoSave.setDisabled(save);
|
||||
quickSave.setDisabled(save);
|
||||
this.save = save;
|
||||
}
|
||||
|
||||
@@ -188,8 +204,8 @@ public class SaveLoadScene extends UIScene {
|
||||
header.setHeight(header.getHeight() * 2);
|
||||
layout.add(header).colspan(2).align(Align.center);
|
||||
layout.row();
|
||||
addSaveSlot("Auto save", -2);
|
||||
addSaveSlot("Quick save", -1);
|
||||
autoSave=addSaveSlot("Auto save", WorldSave.AUTO_SAVE_SLOT);
|
||||
quickSave=addSaveSlot("Quick save", WorldSave.QUICK_SAVE_SLOT);
|
||||
for (int i = 1; i < 11; i++)
|
||||
addSaveSlot("Slot:" + i, i);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package forge.adventure.scene;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
@@ -53,6 +54,15 @@ public class SettingsScene extends UIScene {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyPressed(int keycode)
|
||||
{
|
||||
if (keycode == Input.Keys.ESCAPE)
|
||||
{
|
||||
back();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public boolean back() {
|
||||
AdventureApplicationAdapter.instance.switchToLast();
|
||||
return true;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package forge.adventure.scene;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import forge.adventure.AdventureApplicationAdapter;
|
||||
import forge.adventure.world.WorldSave;
|
||||
@@ -18,7 +19,6 @@ public class StartScene extends UIScene {
|
||||
super("ui/start_menu.json");
|
||||
|
||||
}
|
||||
|
||||
public boolean NewGame() {
|
||||
AdventureApplicationAdapter.instance.switchScene(SceneType.NewGameScene.instance);
|
||||
return true;
|
||||
@@ -67,6 +67,16 @@ public class StartScene extends UIScene {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyPressed(int keycode)
|
||||
{
|
||||
if (keycode == Input.Keys.ESCAPE)
|
||||
{
|
||||
if(WorldSave.getCurrentSave().getWorld().getData() != null)
|
||||
Resume();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void resLoaded() {
|
||||
super.resLoaded();
|
||||
|
||||
@@ -47,9 +47,19 @@ public class UIScene extends Scene{
|
||||
{
|
||||
return ui;
|
||||
}
|
||||
public boolean keyPressed(int keycode)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void resLoaded() {
|
||||
stage = new Stage(new StretchViewport(GetIntendedWidth(), GetIntendedHeight()));
|
||||
stage = new Stage(new StretchViewport(GetIntendedWidth(), GetIntendedHeight())){
|
||||
|
||||
@Override
|
||||
public boolean keyUp(int keycode) {
|
||||
return keyPressed(keycode);
|
||||
}
|
||||
};
|
||||
ui = new UIActor(Config.instance().getFile(uiFile));
|
||||
screenImage=ui.findActor("lastScreen");
|
||||
stage.addActor(ui);
|
||||
@@ -75,6 +85,8 @@ public class UIScene extends Scene{
|
||||
potPixmap.fillRectangle(0,0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||
backgroundTexture = new TextureRegion(new Texture(potPixmap), 0, Gdx.graphics.getHeight(), Gdx.graphics.getWidth(), -Gdx.graphics.getHeight());
|
||||
screenImage.setDrawable(new TextureRegionDrawable(backgroundTexture));
|
||||
pixmap.dispose();
|
||||
potPixmap.dispose();
|
||||
}
|
||||
|
||||
super.enter();
|
||||
|
||||
@@ -57,6 +57,7 @@ public class GameHUD extends Stage {
|
||||
|
||||
addActor(ui);
|
||||
addActor(miniMapPlayer);
|
||||
WorldSave.getCurrentSave().onLoad(() -> enter());
|
||||
}
|
||||
|
||||
public static GameHUD getInstance() {
|
||||
@@ -94,10 +95,9 @@ public class GameHUD extends Stage {
|
||||
Texture miniMapTexture;
|
||||
public void enter() {
|
||||
|
||||
if(miniMapTexture==null)
|
||||
{
|
||||
miniMapTexture=new Texture(WorldSave.getCurrentSave().getWorld().getBiomeImage());
|
||||
}
|
||||
if(miniMapTexture!=null)
|
||||
miniMapTexture.dispose();
|
||||
miniMapTexture=new Texture(WorldSave.getCurrentSave().getWorld().getBiomeImage());
|
||||
|
||||
miniMap.setDrawable(new TextureRegionDrawable(miniMapTexture));
|
||||
avatar.setDrawable(new TextureRegionDrawable(Current.player().avatar()));
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package forge.adventure.stage;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input;
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
@@ -16,7 +14,6 @@ import forge.adventure.character.PlayerSprite;
|
||||
import forge.adventure.scene.Scene;
|
||||
import forge.adventure.scene.SceneType;
|
||||
import forge.adventure.world.WorldSave;
|
||||
import forge.adventure.world.WorldSaveHeader;
|
||||
|
||||
/**
|
||||
* Base class to render a player sprite on a map
|
||||
@@ -48,6 +45,13 @@ public abstract class GameStage extends Stage {
|
||||
|
||||
public GameStage() {
|
||||
super(new StretchViewport(Scene.GetIntendedWidth(), Scene.GetIntendedHeight(), new OrthographicCamera()));
|
||||
WorldSave.getCurrentSave().onLoad(() -> {
|
||||
if(player==null)
|
||||
return;
|
||||
foregroundSprites.removeActor(player);
|
||||
player=null;
|
||||
GetPlayer();
|
||||
});
|
||||
camera = (OrthographicCamera) getCamera();
|
||||
|
||||
backgroundSprites = new Group();
|
||||
@@ -157,6 +161,18 @@ public abstract class GameStage extends Stage {
|
||||
{
|
||||
player.getMovementDirection().y = -1;
|
||||
}
|
||||
if (keycode == Input.Keys.F5)//todo config
|
||||
{
|
||||
GetPlayer().storePos();
|
||||
WorldSave.getCurrentSave().header.createPreview();
|
||||
WorldSave.getCurrentSave().quickSave();
|
||||
|
||||
}
|
||||
if (keycode == Input.Keys.F8)//todo config
|
||||
{
|
||||
WorldSave.getCurrentSave().quickLoad();
|
||||
enter();
|
||||
}
|
||||
if (keycode == Input.Keys.F12)
|
||||
{
|
||||
debugCollision(true);
|
||||
@@ -258,15 +274,8 @@ public abstract class GameStage extends Stage {
|
||||
}
|
||||
|
||||
public void openMenu() {
|
||||
Pixmap pixmap = Pixmap.createFromFrameBuffer(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||
Pixmap scaled = new Pixmap(WorldSaveHeader.previewImageWidth, (int) (WorldSaveHeader.previewImageWidth / (Scene.GetIntendedWidth() / (float) Scene.GetIntendedHeight())), Pixmap.Format.RGB888);
|
||||
scaled.drawPixmap(pixmap,
|
||||
0, 0, pixmap.getWidth(), pixmap.getHeight(),
|
||||
0, 0, scaled.getWidth(), scaled.getHeight());
|
||||
pixmap.dispose();
|
||||
if (WorldSave.getCurrentSave().header.preview != null)
|
||||
WorldSave.getCurrentSave().header.preview.dispose();
|
||||
WorldSave.getCurrentSave().header.preview = scaled;
|
||||
|
||||
WorldSave.getCurrentSave().header.createPreview();
|
||||
AdventureApplicationAdapter.instance.switchScene(SceneType.StartScene.instance);
|
||||
}
|
||||
|
||||
|
||||
@@ -128,17 +128,45 @@ public class WorldBackground extends Actor {
|
||||
public void initialize() {
|
||||
tileSize = WorldSave.getCurrentSave().getWorld().getTileSize();
|
||||
chunkSize = WorldSave.getCurrentSave().getWorld().getChunkSize();
|
||||
if(chunks!=null)
|
||||
{
|
||||
stage.GetSpriteGroup().clear();
|
||||
for(int i=0;i<chunks.length;i++)
|
||||
for(int j=0;j<chunks[i].length;j++)
|
||||
if(chunks[i][j]!=null)
|
||||
chunks[i][j].dispose();
|
||||
}
|
||||
chunks = new Texture[WorldSave.getCurrentSave().getWorld().getWidthInTiles()][WorldSave.getCurrentSave().getWorld().getHeightInTiles()];
|
||||
ArrayList[][] createChunks = new ArrayList[WorldSave.getCurrentSave().getWorld().getWidthInTiles()][WorldSave.getCurrentSave().getWorld().getHeightInTiles()];
|
||||
chunksSprites = createChunks;
|
||||
ArrayList[][] createSprites = new ArrayList[WorldSave.getCurrentSave().getWorld().getWidthInTiles()][WorldSave.getCurrentSave().getWorld().getHeightInTiles()];
|
||||
chunksSpritesBackground = createSprites;
|
||||
Pixmap loadPix = new Pixmap(chunkSize * tileSize, chunkSize * tileSize, Pixmap.Format.RGB565);
|
||||
loadPix.setColor(0.5f, 0.5f, 0.5f, 1);
|
||||
loadPix.fill();
|
||||
loadingTexture = new Texture(loadPix);
|
||||
|
||||
|
||||
if(loadingTexture==null)
|
||||
{
|
||||
Pixmap loadPix = new Pixmap(chunkSize * tileSize, chunkSize * tileSize, Pixmap.Format.RGB565);
|
||||
loadPix.setColor(0.5f, 0.5f, 0.5f, 1);
|
||||
loadPix.fill();
|
||||
loadingTexture = new Texture(loadPix);
|
||||
}
|
||||
|
||||
|
||||
for (int x = -1; x < 2; x++) {
|
||||
for (int y = -1; y < 2; y++) {
|
||||
Point point = new Point(currentChunkX + x, currentChunkY + y);
|
||||
if (point.y < 0 || point.x < 0 || point.y >= chunks[0].length || point.x >= chunks.length)
|
||||
continue;
|
||||
loadChunk(point.x, point.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
super.clear();
|
||||
initialize();
|
||||
}
|
||||
int transChunkToWorld(int xy) {
|
||||
return xy * tileSize * chunkSize;
|
||||
}
|
||||
|
||||
@@ -8,8 +8,11 @@ import forge.adventure.character.CharacterSprite;
|
||||
import forge.adventure.character.EnemySprite;
|
||||
import forge.adventure.data.BiomeData;
|
||||
import forge.adventure.data.EnemyData;
|
||||
import forge.adventure.data.WorldData;
|
||||
import forge.adventure.scene.*;
|
||||
import forge.adventure.util.Current;
|
||||
import forge.adventure.util.SaveFileContent;
|
||||
import forge.adventure.util.SaveFileData;
|
||||
import forge.adventure.world.World;
|
||||
import forge.adventure.world.WorldSave;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
@@ -22,7 +25,7 @@ import java.util.Random;
|
||||
/**
|
||||
* Stage for the over world. Will handle monster spawns
|
||||
*/
|
||||
public class WorldStage extends GameStage {
|
||||
public class WorldStage extends GameStage implements SaveFileContent {
|
||||
|
||||
private static WorldStage instance=null;
|
||||
protected EnemySprite currentMob;
|
||||
@@ -75,6 +78,7 @@ public class WorldStage extends GameStage {
|
||||
AdventureApplicationAdapter.instance.switchScene(SceneType.DuelScene.instance);
|
||||
});
|
||||
currentMob = mob;
|
||||
WorldSave.getCurrentSave().autoSave();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -224,7 +228,6 @@ public class WorldStage extends GameStage {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setBounds(WorldSave.getCurrentSave().getWorld().getWidthInPixels(), WorldSave.getCurrentSave().getWorld().getHeightInPixels());
|
||||
}
|
||||
|
||||
@@ -232,4 +235,55 @@ public class WorldStage extends GameStage {
|
||||
public void leave() {
|
||||
GetPlayer().storePos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(SaveFileData data) {
|
||||
try {
|
||||
for(Pair<Float, EnemySprite> enemy:enemies)
|
||||
foregroundSprites.removeActor(enemy.getValue());
|
||||
enemies.clear();
|
||||
background.clear();
|
||||
|
||||
|
||||
List<Float> timeouts= (List<Float>) data.readObject("timeouts");
|
||||
List<String> names = (List<String>) data.readObject("names");
|
||||
List<Float> x = (List<Float>) data.readObject("x");
|
||||
List<Float> y = (List<Float>) data.readObject("y");
|
||||
for(int i=0;i<timeouts.size();i++)
|
||||
{
|
||||
EnemySprite sprite = new EnemySprite(WorldData.getEnemy(names.get(i)));
|
||||
sprite.setX(x.get(i));
|
||||
sprite.setY(y.get(i));
|
||||
enemies.add(Pair.of(timeouts.get(i),sprite));
|
||||
foregroundSprites.addActor(sprite);
|
||||
}
|
||||
globalTimer=data.readFloat("globalTimer");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SaveFileData save() {
|
||||
SaveFileData data=new SaveFileData();
|
||||
List<Float> timeouts=new ArrayList<>();
|
||||
List<String> names=new ArrayList<>();
|
||||
List<Float> x=new ArrayList<>();
|
||||
List<Float> y=new ArrayList<>();
|
||||
for(Pair<Float, EnemySprite> enemy:enemies)
|
||||
{
|
||||
timeouts.add(enemy.getKey());
|
||||
names.add(enemy.getValue().getData().name);
|
||||
x.add(enemy.getValue().getX());
|
||||
y.add(enemy.getValue().getY());
|
||||
}
|
||||
data.storeObject("timeouts",timeouts);
|
||||
data.storeObject("names",names);
|
||||
data.storeObject("x",x);
|
||||
data.storeObject("y",y);
|
||||
data.store("globalTimer",globalTimer);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ public class CardUtil {
|
||||
case MythicRare:
|
||||
return 500;
|
||||
default:
|
||||
return 90000;
|
||||
return 600;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
||||
|
||||
if(needsToBeDisposed)
|
||||
image.dispose();
|
||||
|
||||
}
|
||||
|
||||
public Reward getReward() {
|
||||
@@ -54,18 +55,9 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
||||
|
||||
@Override
|
||||
public void onImageFetched() {
|
||||
if(ImageCache.imageKeyFileExists(reward.getCard().getImageKey(false)))
|
||||
{
|
||||
setCardImage(ImageCache.getImage(reward.getCard().getImageKey(false),false));
|
||||
}
|
||||
setCardImage(ImageCache.getImage(reward.getCard().getImageKey(false),false));
|
||||
}
|
||||
|
||||
public enum Type
|
||||
{
|
||||
Shop,
|
||||
Loot
|
||||
|
||||
}
|
||||
public RewardActor(Reward reward,boolean flippable)
|
||||
{
|
||||
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
package forge.adventure.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
/**
|
||||
* Interface to save the content the the save game file
|
||||
*/
|
||||
public interface SaveFileContent {
|
||||
void writeToSaveFile(ObjectOutputStream saveFile) throws IOException ;
|
||||
void readFromSaveFile(ObjectInputStream saveFile) throws IOException, ClassNotFoundException;
|
||||
void load(SaveFileData data);
|
||||
SaveFileData save();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,325 @@
|
||||
package forge.adventure.util;
|
||||
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.badlogic.gdx.graphics.PixmapIO;
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class SaveFileData extends HashMap<String,byte[]>
|
||||
{
|
||||
public void store(String key,SaveFileData subData)
|
||||
{
|
||||
try {
|
||||
|
||||
ByteArrayOutputStream stream=new ByteArrayOutputStream();
|
||||
ObjectOutputStream objStream=new ObjectOutputStream(stream);
|
||||
objStream.writeObject(subData);
|
||||
objStream.flush();
|
||||
put(key,stream.toByteArray());
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void store(String key,float subData)
|
||||
{
|
||||
try {
|
||||
ByteArrayOutputStream stream=new ByteArrayOutputStream();
|
||||
ObjectOutputStream objStream=new ObjectOutputStream(stream);
|
||||
objStream.writeFloat(subData);
|
||||
objStream.flush();
|
||||
put(key,stream.toByteArray());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public void store(String key,double subData)
|
||||
{
|
||||
try {
|
||||
ByteArrayOutputStream stream=new ByteArrayOutputStream();
|
||||
ObjectOutputStream objStream=new ObjectOutputStream(stream);
|
||||
objStream.writeDouble(subData);
|
||||
objStream.flush();
|
||||
put(key,stream.toByteArray());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public void store(String key,int subData)
|
||||
{
|
||||
try {
|
||||
ByteArrayOutputStream stream=new ByteArrayOutputStream();
|
||||
ObjectOutputStream objStream=new ObjectOutputStream(stream);
|
||||
objStream.writeInt(subData);
|
||||
objStream.flush();
|
||||
put(key,stream.toByteArray());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public void store(String key,long subData)
|
||||
{
|
||||
try {
|
||||
ByteArrayOutputStream stream=new ByteArrayOutputStream();
|
||||
ObjectOutputStream objStream=new ObjectOutputStream(stream);
|
||||
objStream.writeLong(subData);
|
||||
objStream.flush();
|
||||
put(key,stream.toByteArray());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public void store(String key,boolean subData)
|
||||
{
|
||||
try {
|
||||
ByteArrayOutputStream stream=new ByteArrayOutputStream();
|
||||
ObjectOutputStream objStream=new ObjectOutputStream(stream);
|
||||
objStream.writeBoolean(subData);
|
||||
objStream.flush();
|
||||
put(key,stream.toByteArray());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public void store(String key, Pixmap pixmap)
|
||||
{
|
||||
try {
|
||||
ByteArrayOutputStream stream=new ByteArrayOutputStream();
|
||||
|
||||
PixmapIO.PNG png = new PixmapIO.PNG();
|
||||
png.setFlipY(false);
|
||||
png.write(stream, pixmap);
|
||||
stream.flush();
|
||||
put(key,stream.toByteArray());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public void storeObject(String key,Object subData)
|
||||
{
|
||||
try {
|
||||
ByteArrayOutputStream stream=new ByteArrayOutputStream();
|
||||
ObjectOutputStream objStream=new ObjectOutputStream(stream);
|
||||
objStream.writeObject(subData);
|
||||
objStream.flush();
|
||||
put(key,stream.toByteArray());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public void store(String key,String subData)
|
||||
{
|
||||
try {
|
||||
ByteArrayOutputStream stream=new ByteArrayOutputStream();
|
||||
ObjectOutputStream objStream=new ObjectOutputStream(stream);
|
||||
objStream.writeUTF(subData);
|
||||
objStream.flush();
|
||||
put(key,stream.toByteArray());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void store(String key, Vector2 vector) {
|
||||
|
||||
try {
|
||||
ByteArrayOutputStream stream=new ByteArrayOutputStream();
|
||||
ObjectOutputStream objStream=new ObjectOutputStream(stream);
|
||||
objStream.writeFloat(vector.x);
|
||||
objStream.writeFloat(vector.y);
|
||||
objStream.flush();
|
||||
put(key,stream.toByteArray());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public void store(String key, Rectangle rectangle) {
|
||||
|
||||
try {
|
||||
ByteArrayOutputStream stream=new ByteArrayOutputStream();
|
||||
ObjectOutputStream objStream=new ObjectOutputStream(stream);
|
||||
objStream.writeFloat(rectangle.x);
|
||||
objStream.writeFloat(rectangle.y);
|
||||
objStream.writeFloat(rectangle.width);
|
||||
objStream.writeFloat(rectangle.height);
|
||||
objStream.flush();
|
||||
put(key,stream.toByteArray());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public SaveFileData readSubData(String key)
|
||||
{
|
||||
if(!containsKey(key))
|
||||
return null;
|
||||
try {
|
||||
|
||||
ByteArrayInputStream stream=new ByteArrayInputStream(get(key));
|
||||
ObjectInputStream objStream=new ObjectInputStream(stream);
|
||||
return (SaveFileData)objStream.readObject();
|
||||
|
||||
} catch (IOException | ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public Object readObject(String key)
|
||||
{
|
||||
if(!containsKey(key))
|
||||
return null;
|
||||
try {
|
||||
|
||||
ByteArrayInputStream stream=new ByteArrayInputStream(get(key));
|
||||
ObjectInputStream objStream=new ObjectInputStream(stream);
|
||||
return objStream.readObject();
|
||||
|
||||
} catch (IOException | ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public String readString(String key)
|
||||
{
|
||||
if(!containsKey(key))
|
||||
return null;
|
||||
try {
|
||||
|
||||
ByteArrayInputStream stream=new ByteArrayInputStream(get(key));
|
||||
ObjectInputStream objStream=new ObjectInputStream(stream);
|
||||
return objStream.readUTF();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public long readLong(String key) {
|
||||
if(!containsKey(key))
|
||||
return 0;
|
||||
try {
|
||||
|
||||
ByteArrayInputStream stream=new ByteArrayInputStream(get(key));
|
||||
ObjectInputStream objStream=new ObjectInputStream(stream);
|
||||
return objStream.readLong();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public float readFloat(String key)
|
||||
{
|
||||
if(!containsKey(key))
|
||||
return 0.0f;
|
||||
try {
|
||||
|
||||
ByteArrayInputStream stream=new ByteArrayInputStream(get(key));
|
||||
ObjectInputStream objStream=new ObjectInputStream(stream);
|
||||
return objStream.readFloat();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public double readDouble(String key)
|
||||
{
|
||||
if(!containsKey(key))
|
||||
return 0.0;
|
||||
try {
|
||||
|
||||
ByteArrayInputStream stream=new ByteArrayInputStream(get(key));
|
||||
ObjectInputStream objStream=new ObjectInputStream(stream);
|
||||
return objStream.readDouble();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
public Vector2 readVector2(String key)
|
||||
{
|
||||
if(!containsKey(key))
|
||||
return new Vector2();
|
||||
try {
|
||||
|
||||
ByteArrayInputStream stream=new ByteArrayInputStream(get(key));
|
||||
ObjectInputStream objStream=new ObjectInputStream(stream);
|
||||
float x= objStream.readFloat();
|
||||
float y= objStream.readFloat();
|
||||
return new Vector2(x,y);
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new Vector2();
|
||||
}
|
||||
public Rectangle readRectangle(String key)
|
||||
{
|
||||
if(!containsKey(key))
|
||||
return new Rectangle();
|
||||
try {
|
||||
|
||||
ByteArrayInputStream stream=new ByteArrayInputStream(get(key));
|
||||
ObjectInputStream objStream=new ObjectInputStream(stream);
|
||||
float x= objStream.readFloat();
|
||||
float y= objStream.readFloat();
|
||||
float width= objStream.readFloat();
|
||||
float height= objStream.readFloat();
|
||||
return new Rectangle(x,y,width,height);
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new Rectangle();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Pixmap readPixmap(String key)
|
||||
{
|
||||
if(!containsKey(key))
|
||||
return null;
|
||||
return new Pixmap(get(key), 0, get(key).length);
|
||||
}
|
||||
public int readInt(String key)
|
||||
{
|
||||
if(!containsKey(key))
|
||||
return 0;
|
||||
try {
|
||||
|
||||
ByteArrayInputStream stream=new ByteArrayInputStream(get(key));
|
||||
ObjectInputStream objStream=new ObjectInputStream(stream);
|
||||
return objStream.readInt();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public boolean readBool(String key)
|
||||
{
|
||||
if(!containsKey(key))
|
||||
return false;
|
||||
try {
|
||||
|
||||
ByteArrayInputStream stream=new ByteArrayInputStream(get(key));
|
||||
ObjectInputStream objStream=new ObjectInputStream(stream);
|
||||
return objStream.readBoolean();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -44,10 +44,10 @@ public abstract class Serializer {
|
||||
|
||||
}
|
||||
|
||||
public static void WritePixmap(ObjectOutputStream out, Pixmap pixmap, boolean b) throws IOException {
|
||||
public static void WritePixmap(ObjectOutputStream out, Pixmap pixmap, boolean flip) throws IOException {
|
||||
if (pixmap != null) {
|
||||
PixmapIO.PNG png = new PixmapIO.PNG();
|
||||
png.setFlipY(b);
|
||||
png.setFlipY(flip);
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
png.write(stream, pixmap);
|
||||
byte[] data = stream.toByteArray();
|
||||
|
||||
@@ -2,25 +2,19 @@ package forge.adventure.world;
|
||||
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.utils.Disposable;
|
||||
import com.google.common.collect.Lists;
|
||||
import forge.adventure.data.DifficultyData;
|
||||
import forge.adventure.data.HeroListData;
|
||||
import forge.adventure.util.Config;
|
||||
import forge.adventure.util.Reward;
|
||||
import forge.adventure.util.SaveFileContent;
|
||||
import forge.adventure.util.SignalList;
|
||||
import forge.adventure.util.*;
|
||||
import forge.deck.CardPool;
|
||||
import forge.deck.Deck;
|
||||
import forge.item.PaperCard;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Class that represents the player (not the player sprite)
|
||||
*/
|
||||
public class AdventurePlayer implements Serializable, Disposable, SaveFileContent {
|
||||
public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
private Deck deck;
|
||||
private int avatarIndex;
|
||||
private int heroRace;
|
||||
@@ -31,20 +25,25 @@ public class AdventurePlayer implements Serializable, Disposable, SaveFileConten
|
||||
private int gold=0;
|
||||
private int maxLife=20;
|
||||
private int life=20;
|
||||
private DifficultyData difficultyData;
|
||||
private final DifficultyData difficultyData=new DifficultyData();
|
||||
static public AdventurePlayer current()
|
||||
{
|
||||
return WorldSave.currentSave.getPlayer();
|
||||
}
|
||||
private List<PaperCard> cards=new ArrayList<>();
|
||||
private final CardPool cards=new CardPool();
|
||||
|
||||
public void create(String n, Deck startingDeck, boolean male, int race, int avatar,DifficultyData difficultyData) {
|
||||
|
||||
deck = startingDeck;
|
||||
gold =difficultyData.staringMoney;
|
||||
cards.addAll(deck.getAllCardsInASinglePool().toFlatList());
|
||||
cards.clear();
|
||||
cards.addAllFlat(deck.getAllCardsInASinglePool().toFlatList());
|
||||
maxLife=difficultyData.startingLife;
|
||||
this.difficultyData=difficultyData;
|
||||
this.difficultyData.startingLife=difficultyData.startingLife;
|
||||
this.difficultyData.staringMoney=difficultyData.staringMoney;
|
||||
this.difficultyData.startingDifficulty=difficultyData.startingDifficulty;
|
||||
this.difficultyData.name=difficultyData.name;
|
||||
this.difficultyData.enemyLifeFactor=difficultyData.enemyLifeFactor;
|
||||
life=maxLife;
|
||||
avatarIndex = avatar;
|
||||
heroRace = race;
|
||||
@@ -57,7 +56,7 @@ public class AdventurePlayer implements Serializable, Disposable, SaveFileConten
|
||||
public Deck getDeck() {
|
||||
return deck;
|
||||
}
|
||||
public List<PaperCard> getCards() {
|
||||
public CardPool getCards() {
|
||||
return cards;
|
||||
}
|
||||
|
||||
@@ -82,47 +81,71 @@ public class AdventurePlayer implements Serializable, Disposable, SaveFileConten
|
||||
this.worldPosY = worldPosY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToSaveFile(java.io.ObjectOutputStream out) throws IOException {
|
||||
|
||||
|
||||
out.writeUTF(name);
|
||||
out.writeFloat(worldPosX);
|
||||
out.writeFloat(worldPosY);
|
||||
out.writeInt(avatarIndex);
|
||||
out.writeInt(heroRace);
|
||||
out.writeBoolean(isFemale);
|
||||
out.writeInt(gold);
|
||||
out.writeInt(life);
|
||||
out.writeInt(maxLife);
|
||||
out.writeObject(deck);
|
||||
out.writeObject(cards);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromSaveFile(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||
name = in.readUTF();
|
||||
worldPosX = in.readFloat();
|
||||
worldPosY = in.readFloat();
|
||||
public void load(SaveFileData data) {
|
||||
|
||||
avatarIndex = in.readInt();
|
||||
heroRace = in.readInt();
|
||||
isFemale = in.readBoolean();
|
||||
gold = in.readInt();
|
||||
life = in.readInt();
|
||||
maxLife = in.readInt();
|
||||
deck = (Deck) in.readObject();
|
||||
cards = (List) in.readObject();
|
||||
this.difficultyData.startingLife=data.readInt("startingLife");
|
||||
this.difficultyData.staringMoney=data.readInt("staringMoney");
|
||||
this.difficultyData.startingDifficulty=data.readBool("startingDifficulty");
|
||||
this.difficultyData.name=data.readString("difficultyName");
|
||||
this.difficultyData.enemyLifeFactor=data.readFloat("enemyLifeFactor");
|
||||
|
||||
|
||||
name = data.readString("name");
|
||||
worldPosX = data.readFloat("worldPosX");
|
||||
worldPosY = data.readFloat("worldPosY");
|
||||
|
||||
avatarIndex = data.readInt("avatarIndex");
|
||||
heroRace = data.readInt("heroRace");
|
||||
isFemale = data.readBool("isFemale");
|
||||
gold = data.readInt("gold");
|
||||
life = data.readInt("life");
|
||||
maxLife = data.readInt("maxLife");
|
||||
|
||||
deck = new Deck(data.readString("deckName"));
|
||||
deck.getMain().addAll(CardPool.fromCardList(Lists.newArrayList((String[])data.readObject("deckCards"))));
|
||||
|
||||
cards.clear();
|
||||
cards.addAll(CardPool.fromCardList(Lists.newArrayList((String[])data.readObject("cards"))));
|
||||
|
||||
onLifeTotalChangeList.emit();
|
||||
onGoldChangeList.emit();
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
@Override
|
||||
public SaveFileData save() {
|
||||
SaveFileData data= new SaveFileData();
|
||||
|
||||
|
||||
data.store("startingLife",this.difficultyData.startingLife);
|
||||
data.store("staringMoney",this.difficultyData.staringMoney);
|
||||
data.store("startingDifficulty",this.difficultyData.startingDifficulty);
|
||||
data.store("difficultyName",this.difficultyData.name);
|
||||
data.store("enemyLifeFactor",this.difficultyData.enemyLifeFactor);
|
||||
|
||||
|
||||
data.store("name",name);
|
||||
data.store("worldPosX",worldPosX);
|
||||
data.store("worldPosY",worldPosY);
|
||||
data.store("avatarIndex",avatarIndex);
|
||||
data.store("heroRace",heroRace);
|
||||
data.store("isFemale",isFemale);
|
||||
data.store("gold",gold);
|
||||
data.store("life",life);
|
||||
data.store("maxLife",maxLife);
|
||||
data.store("deckName",deck.getName());
|
||||
|
||||
|
||||
data.storeObject("deckCards",deck.getMain().toCardList("\n").split("\n"));
|
||||
data.storeObject("cards",cards.toCardList("\n").split("\n"));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String spriteName() {
|
||||
return HeroListData.getHero(heroRace, isFemale);
|
||||
}
|
||||
|
||||
@@ -7,11 +7,8 @@ import com.badlogic.gdx.utils.Array;
|
||||
import forge.adventure.data.PointOfInterestData;
|
||||
import forge.adventure.util.Config;
|
||||
import forge.adventure.util.SaveFileContent;
|
||||
import forge.adventure.util.Serializer;
|
||||
import forge.adventure.util.SaveFileData;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
@@ -21,23 +18,28 @@ public class PointOfInterest implements SaveFileContent {
|
||||
|
||||
|
||||
@Override
|
||||
public void writeToSaveFile(ObjectOutputStream saveFile) throws IOException {
|
||||
saveFile.writeUTF(data.name);
|
||||
Serializer.writeVector(saveFile,position);
|
||||
Serializer.writeRectangle(saveFile,rectangle);
|
||||
saveFile.writeInt(spriteIndex);
|
||||
public void load(SaveFileData saveFileData) {
|
||||
|
||||
data=PointOfInterestData.getPointOfInterest(saveFileData.readString("name"));
|
||||
position.set(saveFileData.readVector2("position"));
|
||||
rectangle.set(saveFileData.readRectangle("rectangle"));
|
||||
spriteIndex=saveFileData.readInt("spriteIndex");
|
||||
|
||||
|
||||
oldMapId="";
|
||||
Array<Sprite> textureAtlas = Config.instance().getAtlas(this.data.spriteAtlas).createSprites(this.data.sprite);
|
||||
sprite = textureAtlas.get(spriteIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromSaveFile(ObjectInputStream saveFile) throws IOException {
|
||||
String name= saveFile.readUTF();
|
||||
data=PointOfInterestData.getPointOfInterest(name);
|
||||
Serializer.readVector(saveFile,position);
|
||||
Serializer.readRectangle(saveFile,rectangle);
|
||||
spriteIndex=saveFile.readInt();
|
||||
oldMapId="";
|
||||
Array<Sprite> textureAtlas = Config.instance().getAtlas(data.spriteAtlas).createSprites(data.sprite);
|
||||
sprite = textureAtlas.get(spriteIndex);
|
||||
public SaveFileData save() {
|
||||
|
||||
SaveFileData data=new SaveFileData();
|
||||
data.store("name",this.data.name);
|
||||
data.store("position",position);
|
||||
data.store("rectangle",rectangle);
|
||||
data.store("spriteIndex",spriteIndex);
|
||||
return data;
|
||||
}
|
||||
|
||||
PointOfInterestData data;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package forge.adventure.world;
|
||||
|
||||
import forge.adventure.util.SaveFileContent;
|
||||
import forge.adventure.util.SaveFileData;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -48,42 +46,48 @@ public class PointOfInterestMap implements SaveFileContent {
|
||||
return mapObjects[chunkX][chunkY];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToSaveFile(ObjectOutputStream saveFile) throws IOException {
|
||||
saveFile.writeInt(numberOfChunksX);
|
||||
saveFile.writeInt(numberOfChunksY);
|
||||
saveFile.writeInt(tileSize);
|
||||
saveFile.writeInt(chunkSize);
|
||||
for (int x = 0; x < numberOfChunksX; x++) {
|
||||
for (int y = 0; y < numberOfChunksY; y++) {
|
||||
saveFile.writeInt(mapObjects[x][y].size());
|
||||
for(PointOfInterest poi:mapObjects[x][y])
|
||||
{
|
||||
poi.writeToSaveFile(saveFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromSaveFile(ObjectInputStream saveFile) throws IOException, ClassNotFoundException {
|
||||
numberOfChunksX=saveFile.readInt();
|
||||
numberOfChunksY=saveFile.readInt();
|
||||
tileSize=saveFile.readInt();
|
||||
chunkSize=saveFile.readInt();
|
||||
public void load(SaveFileData data) {
|
||||
numberOfChunksX=data.readInt("numberOfChunksX");
|
||||
numberOfChunksY=data.readInt("numberOfChunksY");
|
||||
tileSize=data.readInt("tileSize");
|
||||
chunkSize=data.readInt("chunkSize");
|
||||
|
||||
mapObjects = new List[numberOfChunksX][numberOfChunksY];
|
||||
for (int x = 0; x < numberOfChunksX; x++) {
|
||||
for (int y = 0; y < numberOfChunksY; y++) {
|
||||
mapObjects[x][y] = new ArrayList();
|
||||
int arraySize=saveFile.readInt();
|
||||
int arraySize=data.readInt("mapObjects["+x +"]["+y+"]");
|
||||
for(int i=0;i<arraySize;i++)
|
||||
{
|
||||
PointOfInterest pointsOfInterest=new PointOfInterest();
|
||||
pointsOfInterest.readFromSaveFile(saveFile);
|
||||
pointsOfInterest.load(data.readSubData("mapObjects["+x +"]["+y+"]["+i+"]"));
|
||||
mapObjects[x][y].add(pointsOfInterest);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SaveFileData save() {
|
||||
SaveFileData data=new SaveFileData();
|
||||
|
||||
data.store("numberOfChunksX",numberOfChunksX);
|
||||
data.store("numberOfChunksY",numberOfChunksY);
|
||||
data.store("tileSize",tileSize);
|
||||
data.store("chunkSize",chunkSize);
|
||||
data.store("numberOfChunksX",numberOfChunksX);
|
||||
|
||||
for (int x = 0; x < numberOfChunksX; x++) {
|
||||
for (int y = 0; y < numberOfChunksY; y++) {
|
||||
data.store("mapObjects["+x +"]["+y+"]",mapObjects[x][y].size());
|
||||
for(int i=0;i<mapObjects[x][y].size();i++)
|
||||
{
|
||||
data.store("mapObjects["+x +"]["+y+"]["+i+"]",mapObjects[x][y].get(i).save());
|
||||
}
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@ package forge.adventure.world;
|
||||
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import forge.adventure.data.BiomeSpriteData;
|
||||
import forge.adventure.util.SaveFileContent;
|
||||
import forge.adventure.util.SaveFileData;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -13,10 +13,37 @@ import java.util.List;
|
||||
/**
|
||||
* Class that hold all sprites as a list for each chunk
|
||||
*/
|
||||
public class SpritesDataMap implements Serializable {
|
||||
public class SpritesDataMap implements SaveFileContent {
|
||||
public class BiomeSpriteDataMap extends HashMap<Integer, BiomeSpriteData> implements SaveFileContent
|
||||
{
|
||||
@Override
|
||||
public void load(SaveFileData data) {
|
||||
clear();
|
||||
List<Integer> keyList=(List<Integer>)data.readObject("keyList");
|
||||
for(Integer key:keyList)
|
||||
{
|
||||
BiomeSpriteData biomeData=new BiomeSpriteData();
|
||||
biomeData.load(data.readSubData(key.toString()));
|
||||
put(key,biomeData);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SaveFileData save() {
|
||||
|
||||
SaveFileData data = new SaveFileData();
|
||||
List<Integer> keyList=new ArrayList<>();
|
||||
for(Entry<Integer, BiomeSpriteData> entry:this.entrySet())
|
||||
{
|
||||
keyList.add(entry.getKey());
|
||||
data.store(entry.getKey().toString(),entry.getValue().save());
|
||||
}
|
||||
data.storeObject("keyList",keyList);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
private final int numberOfChunks;
|
||||
HashMap<Integer, BiomeSpriteData> objectData = new HashMap<>();
|
||||
BiomeSpriteDataMap objectData = new BiomeSpriteDataMap();
|
||||
HashMap<String, Integer> objectKeys = new HashMap<>();
|
||||
int tileSize;
|
||||
int chunkSize;
|
||||
@@ -34,25 +61,7 @@ public class SpritesDataMap implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
private void writeObject(java.io.ObjectOutputStream out) throws IOException {
|
||||
|
||||
out.writeObject(mapObjects);
|
||||
out.writeObject(objectData);
|
||||
out.writeObject(objectKeys);
|
||||
out.writeInt(tileSize);
|
||||
out.writeInt(chunkSize);
|
||||
}
|
||||
|
||||
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||
|
||||
mapObjects = (List<Pair<Vector2, Integer>>[][]) in.readObject();
|
||||
objectData = (HashMap<Integer, BiomeSpriteData>) in.readObject();
|
||||
objectKeys = (HashMap<String, Integer>) in.readObject();
|
||||
tileSize = in.readInt();
|
||||
chunkSize = in.readInt();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public BiomeSpriteData get(int id) {
|
||||
return objectData.get(id);
|
||||
@@ -86,4 +95,28 @@ public class SpritesDataMap implements Serializable {
|
||||
return new ArrayList<>();
|
||||
return mapObjects[chunkX][chunkY];
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void load(SaveFileData data) {
|
||||
|
||||
objectData.load(data.readSubData("objectData"));
|
||||
mapObjects = (List<Pair<Vector2, Integer>>[][])data.readObject("mapObjects");
|
||||
objectKeys = (HashMap<String, Integer>)data.readObject("objectKeys");
|
||||
tileSize = data.readInt("tileSize");
|
||||
chunkSize = data.readInt("chunkSize");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SaveFileData save() {
|
||||
SaveFileData data=new SaveFileData();
|
||||
data.store("objectData",objectData.save());
|
||||
data.storeObject("mapObjects",mapObjects);
|
||||
data.storeObject("objectKeys",objectKeys);
|
||||
data.store("tileSize",tileSize);
|
||||
data.store("chunkSize",chunkSize);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,10 +13,9 @@ import forge.adventure.scene.Scene;
|
||||
import forge.adventure.util.Config;
|
||||
import forge.adventure.util.Paths;
|
||||
import forge.adventure.util.SaveFileContent;
|
||||
import forge.adventure.util.Serializer;
|
||||
import forge.adventure.util.SaveFileData;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -39,6 +38,7 @@ public class World implements Disposable, SaveFileContent {
|
||||
private BiomeTexture[] biomeTexture;
|
||||
private long seed;
|
||||
private final Random random = new Random();
|
||||
private boolean worldDataLoaded=false;
|
||||
|
||||
public Random getRandom()
|
||||
{
|
||||
@@ -48,49 +48,65 @@ public class World implements Disposable, SaveFileContent {
|
||||
return (int) (Math.log(Long.highestOneBit(biome)) / Math.log(2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToSaveFile(java.io.ObjectOutputStream out) throws IOException {
|
||||
|
||||
|
||||
Serializer.WritePixmap(out, biomeImage);
|
||||
out.writeObject(biomeMap);
|
||||
out.writeObject(terrainMap);
|
||||
out.writeInt(width);
|
||||
out.writeInt(height);
|
||||
out.writeObject(mapObjectIds);
|
||||
mapPoiIds.writeToSaveFile(out);
|
||||
out.writeLong(seed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromSaveFile(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||
public void loadWorldData()
|
||||
{
|
||||
if(worldDataLoaded)
|
||||
return;
|
||||
|
||||
FileHandle handle = Config.instance().getFile(Paths.WORLD);
|
||||
String rawJson = handle.readString();
|
||||
data = (new Json()).fromJson(WorldData.class, rawJson);
|
||||
this.data = (new Json()).fromJson(WorldData.class, rawJson);
|
||||
biomeTexture = new BiomeTexture[data.GetBiomes().size() + 1];
|
||||
|
||||
if (biomeImage != null) biomeImage.dispose();
|
||||
biomeImage = Serializer.ReadPixmap(in);
|
||||
biomeMap = (long[][]) in.readObject();
|
||||
terrainMap = (int[][]) in.readObject();
|
||||
width = in.readInt();
|
||||
height = in.readInt();
|
||||
mapObjectIds = (SpritesDataMap) in.readObject();
|
||||
if(mapPoiIds==null)mapPoiIds=new PointOfInterestMap(1,1,1,1);
|
||||
mapPoiIds.readFromSaveFile(in);
|
||||
seed = in.readLong();
|
||||
int biomeIndex=0;
|
||||
for (BiomeData biome : data.GetBiomes()) {
|
||||
|
||||
biomeTexture = new BiomeTexture[data.GetBiomes().size()+1];
|
||||
for(int i = 0; i<data.GetBiomes().size(); i++)
|
||||
{
|
||||
biomeTexture[i] = new BiomeTexture(data.GetBiomes().get(i), data.tileSize);
|
||||
biomeTexture[biomeIndex] = new BiomeTexture(biome, data.tileSize);
|
||||
biomeIndex++;
|
||||
}
|
||||
biomeTexture[data.GetBiomes().size()] = new BiomeTexture(data.roadTileset, data.tileSize);
|
||||
|
||||
|
||||
|
||||
biomeTexture[biomeIndex] = new BiomeTexture(data.roadTileset, data.tileSize);
|
||||
worldDataLoaded=true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(SaveFileData saveFileData) {
|
||||
|
||||
if(biomeImage!=null)
|
||||
biomeImage.dispose();
|
||||
|
||||
loadWorldData();
|
||||
|
||||
biomeImage=saveFileData.readPixmap("biomeImage");
|
||||
biomeMap=(long[][])saveFileData.readObject("biomeMap");
|
||||
terrainMap=(int[][])saveFileData.readObject("terrainMap");
|
||||
width=saveFileData.readInt("width");
|
||||
height=saveFileData.readInt("height");
|
||||
mapObjectIds = new SpritesDataMap(getChunkSize(), this.data.tileSize, this.data.width / getChunkSize());
|
||||
mapObjectIds.load(saveFileData.readSubData("mapObjectIds"));
|
||||
mapPoiIds = new PointOfInterestMap(getChunkSize(), this.data.tileSize, this.data.width / getChunkSize(),this.data.height / getChunkSize());
|
||||
mapPoiIds.load(saveFileData.readSubData("mapPoiIds"));
|
||||
seed=saveFileData.readLong("seed");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SaveFileData save() {
|
||||
|
||||
SaveFileData data=new SaveFileData();
|
||||
|
||||
data.store("biomeImage",biomeImage);
|
||||
data.storeObject("biomeMap",biomeMap);
|
||||
data.storeObject("terrainMap",terrainMap);
|
||||
data.store("width",width);
|
||||
data.store("height",height);
|
||||
data.store("mapObjectIds",mapObjectIds.save());
|
||||
data.store("mapPoiIds",mapPoiIds.save());
|
||||
data.store("seed",seed);
|
||||
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
public BiomeSpriteData getObject(int id) {
|
||||
return mapObjectIds.get(id);
|
||||
}
|
||||
@@ -201,9 +217,7 @@ public class World implements Disposable, SaveFileContent {
|
||||
|
||||
public World generateNew(long seed) {
|
||||
|
||||
FileHandle handle = Config.instance().getFile(Paths.WORLD);
|
||||
String rawJson = handle.readString();
|
||||
data = (new Json()).fromJson(WorldData.class, rawJson);
|
||||
loadWorldData();
|
||||
if(seed==0)
|
||||
{
|
||||
seed=random.nextLong();
|
||||
@@ -231,11 +245,9 @@ public class World implements Disposable, SaveFileContent {
|
||||
pix.fill();
|
||||
|
||||
int biomeIndex = -1;
|
||||
biomeTexture = new BiomeTexture[data.GetBiomes().size() + 1];
|
||||
for (BiomeData biome : data.GetBiomes()) {
|
||||
|
||||
biomeIndex++;
|
||||
biomeTexture[biomeIndex] = new BiomeTexture(biome, data.tileSize);
|
||||
int biomeXStart = (int) Math.round(biome.startPointX * (double) width);
|
||||
int biomeYStart = (int) Math.round(biome.startPointY * (double) height);
|
||||
int biomeWidth = (int) Math.round(biome.width * (double) width);
|
||||
@@ -380,7 +392,6 @@ public class World implements Disposable, SaveFileContent {
|
||||
|
||||
biomeIndex++;
|
||||
pix.setColor(1, 1, 1, 1);
|
||||
biomeTexture[biomeIndex] = new BiomeTexture(data.roadTileset, data.tileSize);
|
||||
for (Pair<PointOfInterest, PointOfInterest> townPair : allSortedTowns) {
|
||||
|
||||
Vector2 currentPoint = townPair.getKey().getTilePosition(data.tileSize);
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package forge.adventure.world;
|
||||
|
||||
import forge.adventure.data.DifficultyData;
|
||||
import forge.adventure.stage.WorldStage;
|
||||
import forge.adventure.util.Config;
|
||||
import forge.adventure.util.SaveFileData;
|
||||
import forge.adventure.util.SignalList;
|
||||
import forge.deck.Deck;
|
||||
import forge.localinstance.properties.ForgeProfileProperties;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -16,16 +19,17 @@ import java.util.zip.InflaterInputStream;
|
||||
*/
|
||||
public class WorldSave {
|
||||
|
||||
static final int AUTO_SAVE_SLOT =-1;
|
||||
static final int QUICK_SAVE_SLOT =-2;
|
||||
static final int INVALID_SAVE_SLOT =-3;
|
||||
static WorldSave currentSave=new WorldSave();
|
||||
static final public int AUTO_SAVE_SLOT =-1;
|
||||
static final public int QUICK_SAVE_SLOT =-2;
|
||||
static final public int INVALID_SAVE_SLOT =-3;
|
||||
static final WorldSave currentSave=new WorldSave();
|
||||
public WorldSaveHeader header = new WorldSaveHeader();
|
||||
private final AdventurePlayer player=new AdventurePlayer();
|
||||
private final World world=new World();
|
||||
private final HashMap<String,PointOfInterestChanges> pointOfInterestChanges=new HashMap<>();
|
||||
|
||||
|
||||
private final SignalList onLoadList=new SignalList();
|
||||
|
||||
public final World getWorld()
|
||||
{
|
||||
@@ -36,6 +40,10 @@ public class WorldSave {
|
||||
return player;
|
||||
}
|
||||
|
||||
public void onLoad(Runnable run)
|
||||
{
|
||||
onLoadList.add(run);
|
||||
}
|
||||
public PointOfInterestChanges getPointOfInterestChanges(String id)
|
||||
{
|
||||
if(!pointOfInterestChanges.containsKey(id))
|
||||
@@ -53,8 +61,13 @@ public class WorldSave {
|
||||
ObjectInputStream oos = new ObjectInputStream(inf))
|
||||
{
|
||||
currentSave.header = (WorldSaveHeader) oos.readObject();
|
||||
currentSave.player.readFromSaveFile(oos);
|
||||
currentSave.world.readFromSaveFile(oos);
|
||||
SaveFileData mainData=(SaveFileData)oos.readObject();
|
||||
currentSave.player.load(mainData.readSubData("player"));
|
||||
currentSave.world.load(mainData.readSubData("world"));
|
||||
WorldStage.getInstance().load(mainData.readSubData("worldStage"));
|
||||
|
||||
currentSave.onLoadList.emit();
|
||||
|
||||
}
|
||||
} catch (ClassNotFoundException | IOException e) {
|
||||
e.printStackTrace();
|
||||
@@ -105,10 +118,19 @@ public class WorldSave {
|
||||
currentSave.player.create(name, starterDeck, male, race, avatarIndex,diff);
|
||||
currentSave.player.setWorldPosY((int) (currentSave.world.getData().playerStartPosY * currentSave.world.getData().height * currentSave.world.getTileSize()));
|
||||
currentSave.player.setWorldPosX((int) (currentSave.world.getData().playerStartPosX * currentSave.world.getData().width * currentSave.world.getTileSize()));
|
||||
currentSave.onLoadList.emit();
|
||||
return currentSave;
|
||||
//return currentSave = ret;
|
||||
}
|
||||
|
||||
public boolean autoSave() {
|
||||
return save("auto save",AUTO_SAVE_SLOT);
|
||||
}
|
||||
public boolean quickSave() {
|
||||
return save("quick save",QUICK_SAVE_SLOT);
|
||||
}
|
||||
public boolean quickLoad() {
|
||||
return load(QUICK_SAVE_SLOT);
|
||||
}
|
||||
public boolean save(String text, int currentSlot) {
|
||||
header.name = text;
|
||||
|
||||
@@ -121,8 +143,12 @@ public class WorldSave {
|
||||
ObjectOutputStream oos = new ObjectOutputStream(def))
|
||||
{
|
||||
oos.writeObject(header);
|
||||
player.writeToSaveFile(oos);
|
||||
world.writeToSaveFile(oos);
|
||||
SaveFileData mainData=new SaveFileData();
|
||||
mainData.store("player",currentSave.player.save());
|
||||
mainData.store("world",currentSave.world.save());
|
||||
mainData.store("worldStage", WorldStage.getInstance().save());
|
||||
|
||||
oos.writeObject(mainData);
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
@@ -132,11 +158,4 @@ public class WorldSave {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void dispose() {
|
||||
|
||||
header.dispose();
|
||||
player.dispose();
|
||||
world.dispose();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package forge.adventure.world;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.badlogic.gdx.utils.Disposable;
|
||||
import forge.adventure.scene.Scene;
|
||||
import forge.adventure.util.Serializer;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -27,6 +29,8 @@ public class WorldSaveHeader implements java.io.Serializable, Disposable {
|
||||
|
||||
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||
name = in.readUTF();
|
||||
if(preview!=null)
|
||||
preview.dispose();
|
||||
preview = Serializer.ReadPixmap(in);
|
||||
saveDate = (Date) in.readObject();
|
||||
|
||||
@@ -35,4 +39,16 @@ public class WorldSaveHeader implements java.io.Serializable, Disposable {
|
||||
public void dispose() {
|
||||
preview.dispose();
|
||||
}
|
||||
|
||||
public void createPreview() {
|
||||
Pixmap pixmap = Pixmap.createFromFrameBuffer(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||
Pixmap scaled = new Pixmap(WorldSaveHeader.previewImageWidth, (int) (WorldSaveHeader.previewImageWidth / (Scene.GetIntendedWidth() / (float) Scene.GetIntendedHeight())), Pixmap.Format.RGB888);
|
||||
scaled.drawPixmap(pixmap,
|
||||
0, 0, pixmap.getWidth(), pixmap.getHeight(),
|
||||
0, 0, scaled.getWidth(), scaled.getHeight());
|
||||
pixmap.dispose();
|
||||
if (preview != null)
|
||||
preview.dispose();
|
||||
preview = scaled;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"name":"Djinni",
|
||||
"name":"Djinn",
|
||||
"template":
|
||||
{
|
||||
"count":60,
|
||||
"colors":["Blue","Red"],
|
||||
"tribe":"Djinni",
|
||||
"tribe":"Djinn",
|
||||
"tribeCards":0.7,
|
||||
"tribeSynergyCards":0.0,
|
||||
"rares":0.5
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"activeFile": "map/swamp_town.tmx",
|
||||
"activeFile": "map/island_town.tmx",
|
||||
"expandedProjectPaths": [
|
||||
"map",
|
||||
"tileset",
|
||||
"map",
|
||||
"obj"
|
||||
],
|
||||
"file.lastUsedOpenFilter": "Alle Dateien (*)",
|
||||
@@ -33,10 +33,10 @@
|
||||
},
|
||||
"map/island_town.tmx": {
|
||||
"scale": 3,
|
||||
"selectedLayer": 2,
|
||||
"selectedLayer": 1,
|
||||
"viewCenter": {
|
||||
"x": 240,
|
||||
"y": 136
|
||||
"x": 251,
|
||||
"y": 73
|
||||
}
|
||||
},
|
||||
"map/mountain_town.tmx": {
|
||||
@@ -100,9 +100,9 @@
|
||||
"tileset/buildings.tsx",
|
||||
"tileset/main.tsx",
|
||||
"map/forest_town.tmx",
|
||||
"map/island_town.tmx",
|
||||
"map/mountain_town.tmx",
|
||||
"map/swamp_town.tmx",
|
||||
"map/plains_town.tmx",
|
||||
"map/swamp_town.tmx"
|
||||
"map/mountain_town.tmx",
|
||||
"map/island_town.tmx"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.5" tiledversion="1.7.2" orientation="orthogonal" renderorder="right-down" width="30" height="17" tilewidth="16" tileheight="16" infinite="0" nextlayerid="6" nextobjectid="48">
|
||||
<map version="1.5" tiledversion="1.7.1" orientation="orthogonal" renderorder="right-down" width="30" height="17" tilewidth="16" tileheight="16" infinite="0" nextlayerid="6" nextobjectid="48">
|
||||
<editorsettings>
|
||||
<export target="wastetown..tmx" format="tmx"/>
|
||||
</editorsettings>
|
||||
@@ -12,7 +12,7 @@
|
||||
</layer>
|
||||
<layer id="2" name="Ground" width="30" height="17">
|
||||
<data encoding="base64" compression="zlib">
|
||||
eJxjYBgFowA/KOWljz2T2BgYJkOxETtCXB8HmxxQRsAvZ9kJs2kBzrEj/J7LgWDncUDkCbmbXEArf2FLM/o4whNX/FIa19jsIpVNCchBisfzOOIXW1xTE9A63SKDEl4ETU97kcGovcQBAKfZHlY=
|
||||
eJxjYBgFowA/KOWljz2T2BgYJkOxETtCXB8HmxxQRsAvZ9kJs2kBzrEj/J7LgWDncUDkCbmbXEArf2FLM/o4whMmjk5TCxCKU3SaWiAHKR7PY4lfGA2LY1oAWqdbZFDCi6DpaS8yGLWXOAAAywwdJA==
|
||||
</data>
|
||||
</layer>
|
||||
<layer id="3" name="Foreground" width="30" height="17">
|
||||
@@ -20,22 +20,22 @@
|
||||
<property name="spriteLayer" type="bool" value="true"/>
|
||||
</properties>
|
||||
<data encoding="base64" compression="zlib">
|
||||
eJxjYKAfKORgYCgC4mIOOloKBPycDAwCQCzISV97KQVzBRgY5gnQ396dQDt3AbHeIAkvdyEGBg8hTDalIJeLPLlRQB7AFXe44peacY0MRuN2FKCDK+wMDFfZ6W/vQNSHIAAACK8NIg==
|
||||
eJxjYKAfKORgYCgC4mIOOloKBPycDAwCQCzISV97KQVzBRgY5gnQ396dQDt3AbHeIAkvdyEGBg8hTDalIJeLPLlRQB7AFXcwcXSaVmA0bkcBOrjCzsBwlZ3+9g5EfQgCABETDSI=
|
||||
</data>
|
||||
</layer>
|
||||
<layer id="5" name="AboveSprites" width="30" height="17">
|
||||
<data encoding="base64" compression="zlib">
|
||||
eJxjYBgFgxXMFWBgmCcw0K5AAG0hBgYdIUz2KBhaAFfc4Yrf0bgeBaNgeAEArncEPg==
|
||||
eJxjYBgFgxXMFWBgmCcw0K5AAG0hBgYdIUz2KBhaAFfcwcTR6VEwCkbB8AIAtDsEPg==
|
||||
</data>
|
||||
</layer>
|
||||
<objectgroup id="4" name="Objects">
|
||||
<object id="38" template="../obj/entry_up.tx" x="256" y="271"/>
|
||||
<object id="41" template="../obj/shop.tx" x="304" y="98"/>
|
||||
<object id="42" template="../obj/shop.tx" x="400" y="162"/>
|
||||
<object id="42" template="../obj/shop.tx" x="368" y="162"/>
|
||||
<object id="43" template="../obj/shop.tx" x="353" y="98"/>
|
||||
<object id="44" template="../obj/shop.tx" x="208" y="162"/>
|
||||
<object id="45" template="../obj/shop.tx" x="304" y="162"/>
|
||||
<object id="46" template="../obj/shop.tx" x="352" y="162"/>
|
||||
<object id="46" template="../obj/shop.tx" x="336" y="162"/>
|
||||
<object id="47" template="../obj/inn.tx" x="215" y="82"/>
|
||||
</objectgroup>
|
||||
</map>
|
||||
|
||||
@@ -23,6 +23,6 @@
|
||||
"height": 0.7,
|
||||
"color": "10a2e0",
|
||||
"spriteNames":["IslandTree","Coral","Shell"] ,
|
||||
"enemies":[ "Merfok","Merfok warrior","Merfok Avatar","Djinn","Blue Wiz1"] ,
|
||||
"enemies":[ "Merfolk","Merfolk warrior","Merfolk Avatar","Djinn","Blue Wiz1"] ,
|
||||
"pointsOfInterest":[ "Island Town"]
|
||||
}
|
||||
@@ -872,7 +872,7 @@
|
||||
{
|
||||
"name": "Djinn",
|
||||
"sprite": "sprites/djinn.atlas",
|
||||
"deck": "decks/Djinni.json",
|
||||
"deck": "decks/Djinn.json",
|
||||
"spawnRate": 0.2,
|
||||
"difficulty": 0.1,
|
||||
"speed": 30,
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
"maleAvatar":"Viashino_m"
|
||||
} ,
|
||||
{
|
||||
"name":"Drawf",
|
||||
"name":"Dwarf",
|
||||
"female":"sprites/heroes/dwarf_f.atlas",
|
||||
"male":"sprites/heroes/dwarf_m.atlas",
|
||||
"femaleAvatar":"Dwarf_f",
|
||||
|
||||
Reference in New Issue
Block a user