Progress on WriterMode. Project export package now create

deterministically-ordered JSON. Should make nicer diffs.
This commit is contained in:
Zukero
2016-12-15 19:16:53 +01:00
parent 32711449b2
commit 6ac332834d
55 changed files with 248 additions and 182 deletions

View File

@@ -29,7 +29,9 @@
package tiled.core;
import java.awt.Rectangle;
import java.util.*;
import java.util.Iterator;
import java.util.Properties;
import java.util.Vector;
/**
* The Map class is the focal point of the <code>tiled.core</code> package.

View File

@@ -28,10 +28,12 @@
package tiled.core;
import java.awt.*;
import java.util.Properties;
import java.awt.Image;
import java.awt.Rectangle;
import java.io.File;
import java.io.IOException;
import java.util.Properties;
import javax.imageio.ImageIO;
/**

View File

@@ -33,8 +33,8 @@ import java.awt.Shape;
import java.awt.geom.Area;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Rectangle2D;
import java.util.LinkedList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
/**

View File

@@ -28,7 +28,6 @@
package tiled.core;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.Properties;

View File

@@ -38,7 +38,6 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

View File

@@ -30,14 +30,32 @@ package tiled.io;
import java.awt.Color;
import java.awt.Rectangle;
import java.io.*;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.nio.charset.Charset;
import java.util.*;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Properties;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.Vector;
import java.util.zip.DeflaterOutputStream;
import java.util.zip.GZIPOutputStream;
import tiled.core.*;
import tiled.core.AnimatedTile;
import tiled.core.Map;
import tiled.core.MapLayer;
import tiled.core.MapObject;
import tiled.core.ObjectGroup;
import tiled.core.Sprite;
import tiled.core.Tile;
import tiled.core.TileLayer;
import tiled.core.TileSet;
import tiled.io.xml.XMLWriter;
import tiled.util.Base64;

View File

@@ -28,9 +28,8 @@
package tiled.io.xml;
import java.lang.String;
import java.io.Writer;
import java.io.IOException;
import java.io.Writer;
import java.util.Stack;
/**

View File

@@ -29,7 +29,6 @@
package tiled.util;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.image.BufferedImage;
/**

View File

@@ -33,6 +33,7 @@ import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import javax.imageio.ImageIO;
/**

View File

@@ -29,7 +29,6 @@
package tiled.util;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.image.BufferedImage;
/**

View File

@@ -27,10 +27,10 @@
package tiled.view;
import tiled.core.TileLayer;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.*;
import java.awt.image.BufferedImageOp;
import tiled.core.TileLayer;
/**
* An interface defining methods to render a map.

View File

@@ -27,14 +27,15 @@
package tiled.view;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import tiled.core.Map;
import tiled.core.Tile;
import tiled.core.TileLayer;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.image.BufferedImageOp;
/**
* The orthogonal map renderer. This is the most basic map renderer, dealing
* with maps that use rectangular tiles.

View File

@@ -4,7 +4,7 @@ import java.awt.Image;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -32,7 +32,7 @@ public abstract class GameDataElement implements ProjectTreeNode, Serializable {
public boolean writable = false;
//List of objects whose transition to "linked" state made them point to this instance.
private Map<GameDataElement, Integer> backlinks = new HashMap<GameDataElement, Integer>();
private Map<GameDataElement, Integer> backlinks = new LinkedHashMap<GameDataElement, Integer>();
public String id = null;

View File

@@ -9,7 +9,7 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -31,7 +31,7 @@ import com.gpl.rpg.atcontentstudio.model.maps.Worldmap;
import com.gpl.rpg.atcontentstudio.model.maps.WorldmapSegment;
import com.gpl.rpg.atcontentstudio.model.sprites.SpriteSheetSet;
import com.gpl.rpg.atcontentstudio.model.sprites.Spritesheet;
import com.gpl.rpg.atcontentstudio.model.tools.WriterModeDataSet;
import com.gpl.rpg.atcontentstudio.model.tools.writermode.WriterModeDataSet;
import com.gpl.rpg.atcontentstudio.ui.DefaultIcons;
public class GameSource implements ProjectTreeNode, Serializable {
@@ -135,7 +135,7 @@ public class GameSource implements ProjectTreeNode, Serializable {
for (int i = 0; i < arraysList.getLength(); i++) {
Element arrayNode = (Element) arraysList.item(i);
String name = arrayNode.getAttribute("name");
List<String> arrayContents = new LinkedList<String>();
List<String> arrayContents = new ArrayList<String>();
NodeList arrayItems = arrayNode.getElementsByTagName("item");
if (arrayItems != null) {
for (int j = 0; j < arrayItems.getLength(); j++) {

View File

@@ -9,7 +9,9 @@ import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -44,7 +46,7 @@ import com.gpl.rpg.atcontentstudio.model.maps.Worldmap;
import com.gpl.rpg.atcontentstudio.model.maps.WorldmapSegment;
import com.gpl.rpg.atcontentstudio.model.saves.SavedGamesSet;
import com.gpl.rpg.atcontentstudio.model.sprites.Spritesheet;
import com.gpl.rpg.atcontentstudio.model.tools.WriterModeData;
import com.gpl.rpg.atcontentstudio.model.tools.writermode.WriterModeData;
import com.gpl.rpg.atcontentstudio.ui.DefaultIcons;
import com.gpl.rpg.atcontentstudio.ui.WorkerDialog;
import com.gpl.rpg.atcontentstudio.utils.FileUtils;
@@ -1018,8 +1020,8 @@ public class Project implements ProjectTreeNode, Serializable {
@SuppressWarnings("rawtypes")
public void writeAltered(GameDataCategory<? extends JSONElement> altered, GameDataCategory<? extends JSONElement> source, Class<? extends JSONElement> gdeClass, File targetFolder) {
Set<String> alteredFileNames = new HashSet<String>();
Map<String, List<Map>> toWrite = new HashMap<String, List<Map>>();
Set<String> alteredFileNames = new LinkedHashSet<String>();
Map<String, List<Map>> toWrite = new LinkedHashMap<String, List<Map>>();
for (JSONElement gde : altered) {
alteredFileNames.add(gde.jsonFile.getName());
}

View File

@@ -9,6 +9,7 @@ import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -21,8 +22,8 @@ import com.gpl.rpg.atcontentstudio.Notification;
import com.gpl.rpg.atcontentstudio.io.SettingsSave;
import com.gpl.rpg.atcontentstudio.model.GameSource.Type;
import com.gpl.rpg.atcontentstudio.model.gamedata.GameDataSet;
import com.gpl.rpg.atcontentstudio.ui.WorkerDialog;
import com.gpl.rpg.atcontentstudio.ui.ProjectsTree.ProjectsTreeModel;
import com.gpl.rpg.atcontentstudio.ui.WorkerDialog;
public class Workspace implements ProjectTreeNode, Serializable {

View File

@@ -5,7 +5,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -264,7 +264,7 @@ public class ActorCondition extends JSONElement {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Map toJson() {
Map jsonAC = new HashMap();
Map jsonAC = new LinkedHashMap();
jsonAC.put("id", this.id);
if (this.icon_id != null) jsonAC.put("iconID", this.icon_id);
if (this.display_name != null) jsonAC.put("name", this.display_name);
@@ -272,10 +272,10 @@ public class ActorCondition extends JSONElement {
if (this.positive != null && this.positive == 1) jsonAC.put("positive", this.positive);
if (this.stacking != null && this.stacking == 1) jsonAC.put("stacking", this.stacking);
if (this.round_effect != null) {
Map jsonRound = new HashMap();
Map jsonRound = new LinkedHashMap();
if (this.round_effect.visual_effect != null) jsonRound.put("visualEffectID", this.round_effect.visual_effect);
if (this.round_effect.hp_boost_min != null || this.round_effect.hp_boost_max != null) {
Map jsonHP = new HashMap();
Map jsonHP = new LinkedHashMap();
if (this.round_effect.hp_boost_min != null) jsonHP.put("min", this.round_effect.hp_boost_min);
else jsonHP.put("min", 0);
if (this.round_effect.hp_boost_max != null) jsonHP.put("max", this.round_effect.hp_boost_max);
@@ -283,7 +283,7 @@ public class ActorCondition extends JSONElement {
jsonRound.put("increaseCurrentHP", jsonHP);
}
if (this.round_effect.ap_boost_min != null || this.round_effect.ap_boost_max != null) {
Map jsonAP = new HashMap();
Map jsonAP = new LinkedHashMap();
if (this.round_effect.ap_boost_min != null) jsonAP.put("min", this.round_effect.ap_boost_min);
else jsonAP.put("min", 0);
if (this.round_effect.ap_boost_max != null) jsonAP.put("max", this.round_effect.ap_boost_max);
@@ -293,10 +293,10 @@ public class ActorCondition extends JSONElement {
jsonAC.put("roundEffect", jsonRound);
}
if (this.full_round_effect != null) {
Map jsonFullRound = new HashMap();
Map jsonFullRound = new LinkedHashMap();
if (this.full_round_effect.visual_effect != null) jsonFullRound.put("visualEffectID", this.full_round_effect.visual_effect);
if (this.full_round_effect.hp_boost_min != null || this.full_round_effect.hp_boost_max != null) {
Map jsonHP = new HashMap();
Map jsonHP = new LinkedHashMap();
if (this.full_round_effect.hp_boost_min != null) jsonHP.put("min", this.full_round_effect.hp_boost_min);
else jsonHP.put("min", 0);
if (this.full_round_effect.hp_boost_max != null) jsonHP.put("max", this.full_round_effect.hp_boost_max);
@@ -304,7 +304,7 @@ public class ActorCondition extends JSONElement {
jsonFullRound.put("increaseCurrentHP", jsonHP);
}
if (this.full_round_effect.ap_boost_min != null || this.full_round_effect.ap_boost_max != null) {
Map jsonAP = new HashMap();
Map jsonAP = new LinkedHashMap();
if (this.full_round_effect.ap_boost_min != null) jsonAP.put("min", this.full_round_effect.ap_boost_min);
else jsonAP.put("min", 0);
if (this.full_round_effect.ap_boost_max != null) jsonAP.put("max", this.full_round_effect.ap_boost_max);
@@ -314,10 +314,10 @@ public class ActorCondition extends JSONElement {
jsonAC.put("fullRoundEffect", jsonFullRound);
}
if (this.constant_ability_effect != null) {
Map jsonAbility = new HashMap();
Map jsonAbility = new LinkedHashMap();
if (this.constant_ability_effect.increase_attack_chance != null) jsonAbility.put("increaseAttackChance", this.constant_ability_effect.increase_attack_chance);
if (this.constant_ability_effect.increase_damage_min != null || this.constant_ability_effect.increase_damage_max != null) {
Map jsonAD = new HashMap();
Map jsonAD = new LinkedHashMap();
if (this.constant_ability_effect.increase_damage_min != null) jsonAD.put("min", this.constant_ability_effect.increase_damage_min);
else jsonAD.put("min", 0);
if (this.constant_ability_effect.increase_damage_max != null) jsonAD.put("max", this.constant_ability_effect.increase_damage_max);

View File

@@ -7,7 +7,8 @@ import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -382,7 +383,7 @@ public class Dialogue extends JSONElement {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Map toJson() {
Map dialogueJson = new HashMap();
Map dialogueJson = new LinkedHashMap();
dialogueJson.put("id", this.id);
if (this.message != null) dialogueJson.put("message", this.message);
if (this.switch_to_npc != null) {
@@ -394,7 +395,7 @@ public class Dialogue extends JSONElement {
List repliesJson = new ArrayList();
dialogueJson.put("replies", repliesJson);
for (Reply reply : this.replies){
Map replyJson = new HashMap();
Map replyJson = new LinkedHashMap();
repliesJson.add(replyJson);
if (reply.text != null) replyJson.put("text", reply.text);
if (reply.next_phrase != null) {
@@ -406,7 +407,7 @@ public class Dialogue extends JSONElement {
List requirementsJson = new ArrayList();
replyJson.put("requires", requirementsJson);
for (Requirement requirement : reply.requirements) {
Map requirementJson = new HashMap();
Map requirementJson = new LinkedHashMap();
requirementsJson.add(requirementJson);
if (requirement.type != null) requirementJson.put("requireType", requirement.type.toString());
if (requirement.required_obj != null) {
@@ -426,7 +427,7 @@ public class Dialogue extends JSONElement {
List rewardsJson = new ArrayList();
dialogueJson.put("rewards", rewardsJson);
for (Reward reward : this.rewards) {
Map rewardJson = new HashMap();
Map rewardJson = new LinkedHashMap();
rewardsJson.add(rewardJson);
if (reward.type != null) rewardJson.put("rewardType", reward.type.toString());
if (reward.reward_obj != null) {

View File

@@ -5,8 +5,8 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -203,13 +203,13 @@ public class Droplist extends JSONElement {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Map toJson() {
Map droplistJson = new HashMap();
Map droplistJson = new LinkedHashMap();
droplistJson.put("id", this.id);
if (this.dropped_items != null) {
List droppedItemsJson = new ArrayList();
droplistJson.put("items", droppedItemsJson);
for (DroppedItem droppedItem : this.dropped_items) {
Map droppedItemJson = new HashMap();
Map droppedItemJson = new LinkedHashMap();
droppedItemsJson.add(droppedItemJson);
if (droppedItem.item != null) {
droppedItemJson.put("itemID", droppedItem.item.id);
@@ -218,7 +218,7 @@ public class Droplist extends JSONElement {
}
if (droppedItem.chance != null) droppedItemJson.put("chance", JSONElement.printJsonChance(droppedItem.chance));
if (droppedItem.quantity_min != null || droppedItem.quantity_max != null) {
Map quantityJson = new HashMap();
Map quantityJson = new LinkedHashMap();
droppedItemJson.put("quantity", quantityJson);
if (droppedItem.quantity_min != null) quantityJson.put("min", droppedItem.quantity_min);
else quantityJson.put("min", 0);

View File

@@ -9,7 +9,8 @@ import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -190,7 +191,7 @@ public class GameDataCategory<E extends JSONElement> extends ArrayList<E> implem
List<SaveEvent> events = new ArrayList<SaveEvent>();
GameDataCategory<? extends JSONElement> impactedCategory = null;
String impactedFileName = fileName;
Map<String, Integer> containedIds = new HashMap<String, Integer>();
Map<String, Integer> containedIds = new LinkedHashMap<String, Integer>();
for (JSONElement node : this) {
if (node.getDataType() == GameSource.Type.created && getProject().baseContent.gameData.getGameDataElement(node.getClass(), node.id) != null) {
if (getProject().alteredContent.gameData.getGameDataElement(node.getClass(), node.id) != null) {

View File

@@ -5,8 +5,8 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -492,7 +492,7 @@ public class Item extends JSONElement {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Map toJson() {
Map itemJson = new HashMap();
Map itemJson = new LinkedHashMap();
itemJson.put("id", this.id);
if (this.icon_id != null) itemJson.put("iconID", this.icon_id);
if (this.name != null) itemJson.put("name", this.name);
@@ -507,10 +507,10 @@ public class Item extends JSONElement {
}
if (this.description != null) itemJson.put("description", this.description);
if (this.equip_effect != null) {
Map equipEffectJson = new HashMap();
Map equipEffectJson = new LinkedHashMap();
itemJson.put("equipEffect", equipEffectJson);
if (this.equip_effect.damage_boost_min != null || this.equip_effect.damage_boost_max != null) {
Map damageJson = new HashMap();
Map damageJson = new LinkedHashMap();
equipEffectJson.put("increaseAttackDamage", damageJson);
if (this.equip_effect.damage_boost_min != null) damageJson.put("min", this.equip_effect.damage_boost_min);
else damageJson.put("min", 0);
@@ -532,7 +532,7 @@ public class Item extends JSONElement {
List conditionsJson = new ArrayList();
equipEffectJson.put("addedConditions", conditionsJson);
for (ConditionEffect condition : this.equip_effect.conditions) {
Map conditionJson = new HashMap();
Map conditionJson = new LinkedHashMap();
conditionsJson.add(conditionJson);
if (condition.condition != null) {
conditionJson.put("condition", condition.condition.id);
@@ -544,10 +544,10 @@ public class Item extends JSONElement {
}
}
if (this.hit_effect != null) {
Map hitEffectJson = new HashMap();
Map hitEffectJson = new LinkedHashMap();
itemJson.put("hitEffect", hitEffectJson);
if (this.hit_effect.hp_boost_min != null || this.hit_effect.hp_boost_max != null) {
Map hpJson = new HashMap();
Map hpJson = new LinkedHashMap();
hitEffectJson.put("increaseCurrentHP", hpJson);
if (this.hit_effect.hp_boost_min != null) hpJson.put("min", this.hit_effect.hp_boost_min);
else hpJson.put("min", 0);
@@ -555,7 +555,7 @@ public class Item extends JSONElement {
else hpJson.put("max", 0);
}
if (this.hit_effect.ap_boost_min != null || this.hit_effect.ap_boost_max != null) {
Map apJson = new HashMap();
Map apJson = new LinkedHashMap();
hitEffectJson.put("increaseCurrentAP", apJson);
if (this.hit_effect.ap_boost_min != null) apJson.put("min", this.hit_effect.ap_boost_min);
else apJson.put("min", 0);
@@ -566,7 +566,7 @@ public class Item extends JSONElement {
List conditionsSourceJson = new ArrayList();
hitEffectJson.put("conditionsSource", conditionsSourceJson);
for (TimedConditionEffect condition : this.hit_effect.conditions_source) {
Map conditionJson = new HashMap();
Map conditionJson = new LinkedHashMap();
conditionsSourceJson.add(conditionJson);
if (condition.condition != null) {
conditionJson.put("condition", condition.condition.id);
@@ -582,7 +582,7 @@ public class Item extends JSONElement {
List conditionsTargetJson = new ArrayList();
hitEffectJson.put("conditionsTarget", conditionsTargetJson);
for (TimedConditionEffect condition : this.hit_effect.conditions_target) {
Map conditionJson = new HashMap();
Map conditionJson = new LinkedHashMap();
conditionsTargetJson.add(conditionJson);
if (condition.condition != null) {
conditionJson.put("condition", condition.condition.id);
@@ -596,14 +596,14 @@ public class Item extends JSONElement {
}
}
if (this.kill_effect != null) {
Map killEffectJson = new HashMap();
Map killEffectJson = new LinkedHashMap();
if (this.category != null && this.category.action_type != null && this.category.action_type == ItemCategory.ActionType.equip) {
itemJson.put("killEffect", killEffectJson);
} else if (this.category != null && this.category.action_type != null && this.category.action_type == ItemCategory.ActionType.use) {
itemJson.put("useEffect", killEffectJson);
}
if (this.kill_effect.hp_boost_min != null || this.kill_effect.hp_boost_max != null) {
Map hpJson = new HashMap();
Map hpJson = new LinkedHashMap();
killEffectJson.put("increaseCurrentHP", hpJson);
if (this.kill_effect.hp_boost_min != null) hpJson.put("min", this.kill_effect.hp_boost_min);
else hpJson.put("min", 0);
@@ -611,7 +611,7 @@ public class Item extends JSONElement {
else hpJson.put("min", 0);
}
if (this.kill_effect.ap_boost_min != null || this.kill_effect.ap_boost_max != null) {
Map apJson = new HashMap();
Map apJson = new LinkedHashMap();
killEffectJson.put("increaseCurrentAP", apJson);
if (this.kill_effect.ap_boost_min != null) apJson.put("min", this.kill_effect.ap_boost_min);
else apJson.put("min", 0);
@@ -622,7 +622,7 @@ public class Item extends JSONElement {
List conditionsSourceJson = new ArrayList();
killEffectJson.put("conditionsSource", conditionsSourceJson);
for (TimedConditionEffect condition : this.kill_effect.conditions_source) {
Map conditionJson = new HashMap();
Map conditionJson = new LinkedHashMap();
conditionsSourceJson.add(conditionJson);
if (condition.condition != null) {
conditionJson.put("condition", condition.condition.id);

View File

@@ -5,7 +5,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -310,7 +310,7 @@ public class ItemCategory extends JSONElement {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Map toJson() {
Map itemCatJson = new HashMap();
Map itemCatJson = new LinkedHashMap();
itemCatJson.put("id", this.id);
if (this.name != null) itemCatJson.put("name", this.name);
if (this.action_type != null) itemCatJson.put("actionType", this.action_type.toString());

View File

@@ -5,8 +5,8 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -386,7 +386,7 @@ public class NPC extends JSONElement {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Map toJson() {
Map npcJson = new HashMap();
Map npcJson = new LinkedHashMap();
npcJson.put("id", this.id);
if (this.name != null) npcJson.put("name", this.name);
if (this.icon_id != null) npcJson.put("iconID", this.icon_id);
@@ -397,7 +397,7 @@ public class NPC extends JSONElement {
if (this.monster_class != null) npcJson.put("monsterClass", this.monster_class.toString());
if (this.movement_type != null) npcJson.put("movementAggressionType", this.movement_type.toString());
if (this.attack_damage_min != null || this.attack_damage_max != null) {
Map adJson = new HashMap();
Map adJson = new LinkedHashMap();
npcJson.put("attackDamage", adJson);
if (this.attack_damage_min != null) adJson.put("min", this.attack_damage_min);
else adJson.put("min", 0);
@@ -423,10 +423,10 @@ public class NPC extends JSONElement {
if (this.block_chance != null) npcJson.put("blockChance", this.block_chance);
if (this.damage_resistance != null) npcJson.put("damageResistance", this.damage_resistance);
if (this.hit_effect != null) {
Map hitEffectJson = new HashMap();
Map hitEffectJson = new LinkedHashMap();
npcJson.put("hitEffect", hitEffectJson);
if (this.hit_effect.hp_boost_min != null || this.hit_effect.hp_boost_max != null) {
Map hpJson = new HashMap();
Map hpJson = new LinkedHashMap();
hitEffectJson.put("increaseCurrentHP", hpJson);
if (this.hit_effect.hp_boost_min != null) hpJson.put("min", this.hit_effect.hp_boost_min);
else hpJson.put("min", 0);
@@ -434,7 +434,7 @@ public class NPC extends JSONElement {
else hpJson.put("max", 0);
}
if (this.hit_effect.ap_boost_min != null || this.hit_effect.ap_boost_max != null) {
Map apJson = new HashMap();
Map apJson = new LinkedHashMap();
hitEffectJson.put("increaseCurrentAP", apJson);
if (this.hit_effect.ap_boost_min != null) apJson.put("min", this.hit_effect.ap_boost_min);
else apJson.put("min", 0);
@@ -445,7 +445,7 @@ public class NPC extends JSONElement {
List conditionsSourceJson = new ArrayList();
hitEffectJson.put("conditionsSource", conditionsSourceJson);
for (TimedConditionEffect condition : this.hit_effect.conditions_source) {
Map conditionJson = new HashMap();
Map conditionJson = new LinkedHashMap();
conditionsSourceJson.add(conditionJson);
if (condition.condition != null) {
conditionJson.put("condition", condition.condition.id);
@@ -461,7 +461,7 @@ public class NPC extends JSONElement {
List conditionsTargetJson = new ArrayList();
hitEffectJson.put("conditionsTarget", conditionsTargetJson);
for (TimedConditionEffect condition : this.hit_effect.conditions_target) {
Map conditionJson = new HashMap();
Map conditionJson = new LinkedHashMap();
conditionsTargetJson.add(conditionJson);
if (condition.condition != null) {
conditionJson.put("condition", condition.condition.id);

View File

@@ -5,8 +5,8 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -180,7 +180,7 @@ public class Quest extends JSONElement {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Map toJson() {
Map questJson = new HashMap();
Map questJson = new LinkedHashMap();
questJson.put("id", this.id);
if (this.name != null) questJson.put("name", this.name);
if (this.visible_in_log != null) questJson.put("showInLog", this.visible_in_log);
@@ -188,7 +188,7 @@ public class Quest extends JSONElement {
List stagesJson = new ArrayList();
questJson.put("stages", stagesJson);
for (QuestStage stage : this.stages) {
Map stageJson = new HashMap();
Map stageJson = new LinkedHashMap();
stagesJson.add(stageJson);
if (stage.progress != null) stageJson.put("progress", stage.progress);
if (stage.log_text != null) stageJson.put("logText", stage.log_text);

View File

@@ -1,7 +1,7 @@
package com.gpl.rpg.atcontentstudio.model.gamedata;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -13,7 +13,7 @@ public class Requirement extends JSONElement {
private static final long serialVersionUID = 7295593297142310955L;
private static Map<RequirementType, List<RequirementType>> COMPATIBLE_TYPES = new HashMap<RequirementType, List<RequirementType>>();
private static Map<RequirementType, List<RequirementType>> COMPATIBLE_TYPES = new LinkedHashMap<RequirementType, List<RequirementType>>();
static {
List<RequirementType> questTypes = new ArrayList<RequirementType>();

View File

@@ -1,10 +1,8 @@
package com.gpl.rpg.atcontentstudio.model.maps;
import java.awt.Image;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
import com.gpl.rpg.atcontentstudio.model.gamedata.Requirement;
@@ -47,7 +45,7 @@ public class ReplaceArea extends MapObject {
for (Object s : obj.getProperties().keySet()) {
if (replacements == null) replacements = new LinkedList<ReplaceArea.Replacement>();
if (replacements == null) replacements = new ArrayList<ReplaceArea.Replacement>();
replacements.add(new Replacement(s.toString(), obj.getProperties().getProperty(s.toString())));
}
@@ -76,7 +74,7 @@ public class ReplaceArea extends MapObject {
}
public void addReplacement(ReplaceArea.Replacement repl) {
if (replacements == null) replacements = new LinkedList<ReplaceArea.Replacement>();
if (replacements == null) replacements = new ArrayList<ReplaceArea.Replacement>();
replacements.add(repl);
}

View File

@@ -10,6 +10,7 @@ import java.io.StringReader;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@@ -21,10 +22,10 @@ import tiled.io.TMXMapWriter;
import com.gpl.rpg.atcontentstudio.Notification;
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
import com.gpl.rpg.atcontentstudio.model.GameSource;
import com.gpl.rpg.atcontentstudio.model.SaveEvent;
import com.gpl.rpg.atcontentstudio.model.GameSource.Type;
import com.gpl.rpg.atcontentstudio.model.Project;
import com.gpl.rpg.atcontentstudio.model.ProjectTreeNode;
import com.gpl.rpg.atcontentstudio.model.SaveEvent;
import com.gpl.rpg.atcontentstudio.model.gamedata.GameDataSet;
import com.gpl.rpg.atcontentstudio.model.sprites.Spritesheet;
import com.gpl.rpg.atcontentstudio.ui.DefaultIcons;

View File

@@ -6,6 +6,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.ArrayList;
import java.util.List;
import javax.swing.tree.TreeNode;
@@ -13,11 +14,10 @@ import javax.swing.tree.TreeNode;
import com.gpl.rpg.atcontentstudio.Notification;
import com.gpl.rpg.atcontentstudio.model.GameSource;
import com.gpl.rpg.atcontentstudio.model.GameSource.Type;
import com.gpl.rpg.atcontentstudio.model.Project.ResourceSet;
import com.gpl.rpg.atcontentstudio.model.Project;
import com.gpl.rpg.atcontentstudio.model.Project.ResourceSet;
import com.gpl.rpg.atcontentstudio.model.ProjectTreeNode;
import com.gpl.rpg.atcontentstudio.model.gamedata.GameDataSet;
import com.gpl.rpg.atcontentstudio.model.gamedata.Item;
import com.gpl.rpg.atcontentstudio.ui.DefaultIcons;
public class TMXMapSet implements ProjectTreeNode {

View File

@@ -10,8 +10,8 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

View File

@@ -3,11 +3,8 @@ package com.gpl.rpg.atcontentstudio.model.maps;
import java.awt.Image;
import java.awt.Point;
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -69,7 +66,7 @@ public class WorldmapSegment extends GameDataElement {
String area;
if ((area = mapNode.getAttribute("area")) != null && !"".equals(area)) {
if (labelledMaps.get(area) == null) {
labelledMaps.put(area, new LinkedList<String>());
labelledMaps.put(area, new ArrayList<String>());
}
labelledMaps.get(area).add(mapNode.getAttribute("id"));
}

View File

@@ -5,6 +5,7 @@ import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.ArrayList;
import java.util.List;
import javax.swing.tree.TreeNode;

View File

@@ -7,7 +7,7 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -43,8 +43,8 @@ public class Spritesheet extends GameDataElement {
//Lazy initialization.
public BufferedImage spritesheet = null;
public Map<Integer, BufferedImage> cache_full_size = new HashMap<Integer, BufferedImage>();
public Map<Integer, Image> cache_icon = new HashMap<Integer, Image>();
public Map<Integer, BufferedImage> cache_full_size = new LinkedHashMap<Integer, BufferedImage>();
public Map<Integer, Image> cache_icon = new LinkedHashMap<Integer, Image>();
public Spritesheet(SpriteSheetSet parent, File f) {
this.spritesheetFile = f;

View File

@@ -1,14 +1,13 @@
package com.gpl.rpg.atcontentstudio.model.tools;
package com.gpl.rpg.atcontentstudio.model.tools.writermode;
import java.awt.Image;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -19,6 +18,7 @@ import com.gpl.rpg.atcontentstudio.Notification;
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
import com.gpl.rpg.atcontentstudio.model.Project;
import com.gpl.rpg.atcontentstudio.model.SaveEvent;
import com.gpl.rpg.atcontentstudio.model.gamedata.Dialogue;
import com.gpl.rpg.atcontentstudio.model.gamedata.GameDataSet;
import com.gpl.rpg.atcontentstudio.ui.DefaultIcons;
@@ -32,8 +32,8 @@ public class WriterModeData extends GameDataElement {
public String sketchName;
public List<String> rootsId = new LinkedList<String>();
public List<WriterDialogue> roots = new LinkedList<WriterDialogue>();
public List<String> rootsId = new ArrayList<String>();
public List<WriterDialogue> roots = new ArrayList<WriterDialogue>();
public WriterDialogue begin;
public Map<String, WriterDialogue> nodesById = new LinkedHashMap<String, WriterDialogue>();
@@ -76,8 +76,8 @@ public class WriterModeData extends GameDataElement {
public String id;
public String id_prefix;
public int index;
public List<WriterReply> replies = new LinkedList<WriterReply>();
public List<WriterReply> parents = new LinkedList<WriterReply>();
public List<WriterReply> replies = new ArrayList<WriterReply>();
public List<WriterReply> parents = new ArrayList<WriterReply>();
public WriterDialogue() {}
@@ -93,10 +93,14 @@ public class WriterModeData extends GameDataElement {
return "Dialogue "+id_prefix+index;
}
public String getID() {
return this.id != null ? this.id : this.id_prefix+this.index;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Map toJson() {
Map dialogueJson = new HashMap();
Map dialogueJson = new LinkedHashMap();
dialogueJson.put("id", id);
dialogueJson.put("id_prefix", id_prefix);
dialogueJson.put("index", index);
@@ -130,6 +134,22 @@ public class WriterModeData extends GameDataElement {
public boolean isSpecial() {return false;}
public Dialogue toDialogue(Map<WriterDialogue, Dialogue> visited){
if (visited.get(this) != null) return visited.get(this);
Dialogue dialogue = new Dialogue();
dialogue.state = GameDataElement.State.parsed;
visited.put(this, dialogue);
dialogue.id = getID();
dialogue.message = this.text;
if (this.replies != null && !this.replies.isEmpty()) {
dialogue.replies = new ArrayList<Dialogue.Reply>();
for (WriterReply wReply : this.replies) {
dialogue.replies.add(wReply.toReply(visited));
}
}
return dialogue;
}
}
@@ -188,7 +208,7 @@ public class WriterModeData extends GameDataElement {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Map toJson() {
Map replyJson = new HashMap();
Map replyJson = new LinkedHashMap();
replyJson.put("text", text);
replyJson.put("special", isSpecial());
if (next_dialogue != null) {
@@ -198,6 +218,20 @@ public class WriterModeData extends GameDataElement {
}
public boolean isSpecial() {return false;}
public Dialogue.Reply toReply(Map<WriterDialogue, Dialogue> visited) {
Dialogue.Reply reply = new Dialogue.Reply();
reply.text = this.text;
if (this.next_dialogue != null) {
this.next_dialogue.toDialogue(visited);
reply.next_phrase_id = this.next_dialogue.getID();
} else if (this.next_dialogue_id != null) {
reply.next_phrase_id = this.next_dialogue_id;
} else {
reply.next_phrase_id = "X";
}
return reply;
}
}
@@ -410,4 +444,10 @@ public class WriterModeData extends GameDataElement {
return null;
}
public Collection<Dialogue> toDialogue(){
Map<WriterModeData.WriterDialogue, Dialogue> visited = new LinkedHashMap<WriterModeData.WriterDialogue, Dialogue>();
begin.toDialogue(visited);
return visited.values();
}
}

View File

@@ -1,4 +1,4 @@
package com.gpl.rpg.atcontentstudio.model.tools;
package com.gpl.rpg.atcontentstudio.model.tools.writermode;
import java.awt.Image;
import java.io.File;
@@ -11,7 +11,7 @@ import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -23,10 +23,10 @@ import org.json.simple.parser.ParseException;
import com.gpl.rpg.atcontentstudio.Notification;
import com.gpl.rpg.atcontentstudio.io.JsonPrettyWriter;
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
import com.gpl.rpg.atcontentstudio.model.GameDataElement.State;
import com.gpl.rpg.atcontentstudio.model.GameSource;
import com.gpl.rpg.atcontentstudio.model.GameSource.Type;
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
import com.gpl.rpg.atcontentstudio.model.Project;
import com.gpl.rpg.atcontentstudio.model.ProjectTreeNode;
import com.gpl.rpg.atcontentstudio.model.SaveEvent;
@@ -42,7 +42,7 @@ public class WriterModeDataSet implements ProjectTreeNode, Serializable {
public GameSource parent;
public File writerFile;
List<WriterModeData> writerModeDataList = new LinkedList<WriterModeData>();
List<WriterModeData> writerModeDataList = new ArrayList<WriterModeData>();
public WriterModeDataSet(GameSource gameSource) {
this.parent = gameSource;
@@ -156,7 +156,7 @@ public class WriterModeDataSet implements ProjectTreeNode, Serializable {
@SuppressWarnings("rawtypes")
public void save(File jsonFile) {
List<Map> dataToSave = new LinkedList<Map>();
List<Map> dataToSave = new ArrayList<Map>();
for (WriterModeData data : writerModeDataList) {
if (data.jsonFile.equals(jsonFile)) {
dataToSave.add(data.toJson());
@@ -193,7 +193,7 @@ public class WriterModeDataSet implements ProjectTreeNode, Serializable {
}
public List<SaveEvent> attemptSave() {
List<SaveEvent> events = new LinkedList<SaveEvent>();
List<SaveEvent> events = new ArrayList<SaveEvent>();
for (WriterModeData data : writerModeDataList) {
if (data.state == State.created || data.state == State.modified) {
events.add(new SaveEvent(SaveEvent.Type.alsoSave, data));

View File

@@ -2,7 +2,7 @@ package com.gpl.rpg.atcontentstudio.ui;
import java.awt.Image;
import java.io.IOException;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.imageio.ImageIO;
@@ -11,8 +11,8 @@ import com.gpl.rpg.atcontentstudio.Notification;
public class DefaultIcons {
private static Map<String, Image> imageCache = new HashMap<String, Image>();
private static Map<String, Image> iconCache = new HashMap<String, Image>();
private static Map<String, Image> imageCache = new LinkedHashMap<String, Image>();
private static Map<String, Image> iconCache = new LinkedHashMap<String, Image>();
private static String MAIN_ICON_RES = "/com/gpl/rpg/atcontentstudio/img/andorstrainer.png";

View File

@@ -3,7 +3,7 @@ package com.gpl.rpg.atcontentstudio.ui;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeListener;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.swing.Action;
@@ -22,7 +22,7 @@ import com.gpl.rpg.atcontentstudio.model.maps.TMXMap;
import com.gpl.rpg.atcontentstudio.model.maps.WorldmapSegment;
import com.gpl.rpg.atcontentstudio.model.saves.SavedGame;
import com.gpl.rpg.atcontentstudio.model.sprites.Spritesheet;
import com.gpl.rpg.atcontentstudio.model.tools.WriterModeData;
import com.gpl.rpg.atcontentstudio.model.tools.writermode.WriterModeData;
import com.gpl.rpg.atcontentstudio.ui.gamedataeditors.ActorConditionEditor;
import com.gpl.rpg.atcontentstudio.ui.gamedataeditors.DialogueEditor;
import com.gpl.rpg.atcontentstudio.ui.gamedataeditors.DroplistEditor;
@@ -41,7 +41,7 @@ public class EditorsArea extends JPanel {
private static final long serialVersionUID = 8801849846876081538L;
private Map<Object, Editor> editors = new HashMap<Object, Editor>();
private Map<Object, Editor> editors = new LinkedHashMap<Object, Editor>();
private JideTabbedPane tabHolder;
public EditorsArea() {

View File

@@ -4,8 +4,8 @@ import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -33,7 +33,7 @@ public class NotificationsPane extends JList {
public static final String warn_img_name = "/com/gpl/rpg/atcontentstudio/img/warn.png";
public static final String error_img_name = "/com/gpl/rpg/atcontentstudio/img/error.png";
public static final Map<Notification.Type, Icon> icons = new HashMap<Notification.Type, Icon>(Notification.Type.values().length);
public static final Map<Notification.Type, Icon> icons = new LinkedHashMap<Notification.Type, Icon>(Notification.Type.values().length);
static {
try {

View File

@@ -9,7 +9,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import javax.swing.ComboBoxModel;
@@ -67,7 +67,7 @@ public class ProjectCreationWizard extends JDialog {
return Project.ResourceSet.values()[index];
}
List<ListDataListener> listeners = new LinkedList<ListDataListener>();
List<ListDataListener> listeners = new ArrayList<ListDataListener>();
@Override
public void addListDataListener(ListDataListener l) {

View File

@@ -37,7 +37,7 @@ import com.gpl.rpg.atcontentstudio.model.maps.TMXMap;
import com.gpl.rpg.atcontentstudio.model.maps.WorldmapSegment;
import com.gpl.rpg.atcontentstudio.model.saves.SavedGame;
import com.gpl.rpg.atcontentstudio.model.sprites.Spritesheet;
import com.gpl.rpg.atcontentstudio.model.tools.WriterModeData;
import com.gpl.rpg.atcontentstudio.model.tools.writermode.WriterModeData;
import com.jidesoft.swing.TreeSearchable;
public class ProjectsTree extends JPanel {
@@ -241,6 +241,10 @@ public class ProjectsTree extends JPanel {
addNextSeparator = true;
popupMenu.add(new JMenuItem(actions.testWriter));
}
if (actions.testCommitWriter.isEnabled()) {
addNextSeparator = true;
popupMenu.add(new JMenuItem(actions.testCommitWriter));
}
if (addNextSeparator) {
popupMenu.add(new JSeparator());
addNextSeparator = false;

View File

@@ -5,9 +5,9 @@ import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

View File

@@ -34,7 +34,7 @@ import com.gpl.rpg.atcontentstudio.model.maps.TMXMap;
import com.gpl.rpg.atcontentstudio.model.maps.WorldmapSegment;
import com.gpl.rpg.atcontentstudio.model.saves.SavedGame;
import com.gpl.rpg.atcontentstudio.model.sprites.Spritesheet;
import com.gpl.rpg.atcontentstudio.model.tools.WriterModeData;
import com.gpl.rpg.atcontentstudio.model.tools.writermode.WriterModeData;
public class StudioFrame extends JFrame {

View File

@@ -1,29 +1,26 @@
package com.gpl.rpg.atcontentstudio.ui;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Collection;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.swing.Action;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
import javax.swing.tree.TreePath;
import bsh.util.JConsole;
import com.gpl.rpg.atcontentstudio.ATContentStudio;
import com.gpl.rpg.atcontentstudio.model.ClosedProject;
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
@@ -32,16 +29,16 @@ import com.gpl.rpg.atcontentstudio.model.Project;
import com.gpl.rpg.atcontentstudio.model.ProjectTreeNode;
import com.gpl.rpg.atcontentstudio.model.SaveEvent;
import com.gpl.rpg.atcontentstudio.model.Workspace;
import com.gpl.rpg.atcontentstudio.model.gamedata.Dialogue;
import com.gpl.rpg.atcontentstudio.model.gamedata.GameDataCategory;
import com.gpl.rpg.atcontentstudio.model.gamedata.JSONElement;
import com.gpl.rpg.atcontentstudio.model.maps.TMXMap;
import com.gpl.rpg.atcontentstudio.model.maps.TMXMapSet;
import com.gpl.rpg.atcontentstudio.model.saves.SavedGamesSet;
import com.gpl.rpg.atcontentstudio.model.tools.WriterModeData;
import com.gpl.rpg.atcontentstudio.model.tools.writermode.WriterModeData;
import com.gpl.rpg.atcontentstudio.ui.tools.BeanShellView;
import com.gpl.rpg.atcontentstudio.ui.tools.ItemsTableView;
import com.gpl.rpg.atcontentstudio.ui.tools.NPCsTableView;
import com.gpl.rpg.atcontentstudio.ui.tools.writermode.WriterModeEditor;
public class WorkspaceActions {
@@ -340,6 +337,23 @@ public class WorkspaceActions {
}
};
public ATCSAction testCommitWriter = new ATCSAction("Export dialogue sketch", "Exports the dialogue sketch as real JSON data dialogues") {
public void actionPerformed(ActionEvent e) {
if (selectedNode == null || selectedNode.getProject() == null || !(selectedNode instanceof WriterModeData)) return;
WriterModeData wData = (WriterModeData)selectedNode;
Collection<Dialogue> exported = wData.toDialogue();
for (Dialogue dialogue : exported) {
selectedNode.getProject().createElement(dialogue);
}
for (Dialogue dialogue : exported) {
dialogue.link();
}
};
public void selectionChanged(ProjectTreeNode selectedNode, TreePath[] selectedPaths) {
setEnabled(selectedNode != null && selectedNode instanceof WriterModeData);
}
};
List<ATCSAction> actions = new ArrayList<WorkspaceActions.ATCSAction>();
public WorkspaceActions() {
@@ -358,6 +372,7 @@ public class WorkspaceActions {
actions.add(showAbout);
actions.add(exitATCS);
actions.add(testWriter);
actions.add(testCommitWriter);
selectionChanged(null, null);
}
@@ -389,7 +404,7 @@ public class WorkspaceActions {
@Override
public void actionPerformed(ActionEvent e) {};
public Map<String, Object> values = new HashMap<String, Object>();
public Map<String, Object> values = new LinkedHashMap<String, Object>();
@Override
public Object getValue(String key) {

View File

@@ -15,16 +15,9 @@ import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import com.gpl.rpg.atcontentstudio.ATContentStudio;
import com.gpl.rpg.atcontentstudio.model.GameSource;
import com.gpl.rpg.atcontentstudio.model.Project;
import com.gpl.rpg.atcontentstudio.model.GameDataElement.State;
import com.gpl.rpg.atcontentstudio.model.gamedata.ActorCondition;
import com.gpl.rpg.atcontentstudio.model.gamedata.Item;
import com.gpl.rpg.atcontentstudio.model.gamedata.ItemCategory;
import com.gpl.rpg.atcontentstudio.model.gamedata.NPC;
import com.gpl.rpg.atcontentstudio.model.gamedata.Quest;
import com.gpl.rpg.atcontentstudio.model.tools.WriterModeData;
import com.gpl.rpg.atcontentstudio.ui.JSONCreationWizard.DataType;
import com.gpl.rpg.atcontentstudio.model.Project;
import com.gpl.rpg.atcontentstudio.model.tools.writermode.WriterModeData;
import com.jidesoft.swing.JideBoxLayout;
public class WriterSketchCreationWizard extends JDialog {

View File

@@ -11,6 +11,7 @@ import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.List;
import javax.swing.DefaultListCellRenderer;

View File

@@ -4,6 +4,7 @@ import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.List;
import javax.swing.DefaultListCellRenderer;

View File

@@ -5,7 +5,7 @@ import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -40,7 +40,7 @@ public abstract class JSONElementEditor extends Editor {
private static final long serialVersionUID = -5889046987755079563L;
Map<String, JPanel> editorTabs = new HashMap<String, JPanel>();
Map<String, JPanel> editorTabs = new LinkedHashMap<String, JPanel>();
JideTabbedPane editorTabsHolder;
RSyntaxTextArea jsonEditorPane;

View File

@@ -5,6 +5,7 @@ import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.List;
import javax.swing.DefaultListCellRenderer;

View File

@@ -5,6 +5,7 @@ import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.List;
import javax.swing.BorderFactory;

View File

@@ -20,9 +20,8 @@ import java.awt.event.MouseMotionAdapter;
import java.awt.event.MouseMotionListener;
import java.awt.image.BufferedImageOp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -109,7 +108,7 @@ public class TMXMapEditor extends Editor {
private static final long serialVersionUID = -3079451876618342442L;
Map<String, JPanel> editorTabs = new HashMap<String, JPanel>();
Map<String, JPanel> editorTabs = new LinkedHashMap<String, JPanel>();
JideTabbedPane editorTabsHolder;
private RSyntaxTextArea editorPane;
@@ -871,7 +870,7 @@ public class TMXMapEditor extends Editor {
return index;
}
List<TreeModelListener> listeners = new LinkedList<TreeModelListener>();
List<TreeModelListener> listeners = new ArrayList<TreeModelListener>();
@Override
public void addTreeModelListener(TreeModelListener l) {
@@ -1093,7 +1092,7 @@ public class TMXMapEditor extends Editor {
ReplaceArea area;
boolean modelForSource = false;
public List<String> availableLayers = new LinkedList<String>();
public List<String> availableLayers = new ArrayList<String>();
public String selected;
@@ -2057,7 +2056,7 @@ public class TMXMapEditor extends Editor {
}
for (ReplaceArea.Replacement repl : area.replacements) {
if (replacementsForLayer.get(repl.sourceLayer) == null) {
replacementsForLayer.put(repl.sourceLayer, new LinkedList<ReplaceArea>());
replacementsForLayer.put(repl.sourceLayer, new ArrayList<ReplaceArea>());
}
replacementsForLayer.get(repl.sourceLayer).add(area);
}

View File

@@ -10,7 +10,7 @@ import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import javax.swing.ButtonGroup;
@@ -291,7 +291,7 @@ public class WorldMapEditor extends Editor {
if (map.labelledMaps.get(selectedLabel) != null) {
map.labelledMaps.get(selectedLabel).clear();
} else {
map.labelledMaps.put(selectedLabel, new LinkedList<String>());
map.labelledMaps.put(selectedLabel, new ArrayList<String>());
}
for (String s : mapView.selected) {
map.labelledMaps.get(selectedLabel).add(s);
@@ -346,7 +346,7 @@ public class WorldMapEditor extends Editor {
wiz.addCreationListener(new WorldmapLabelEditionWizard.CreationCompletedListener() {
@Override
public void labelCreated(NamedArea created) {
worldmap.labelledMaps.put(created.id, new LinkedList<String>());
worldmap.labelledMaps.put(created.id, new ArrayList<String>());
worldmap.labelledMaps.get(created.id).addAll(mapView.selected);
mapView.revalidate();
mapView.repaint();

View File

@@ -14,9 +14,9 @@ import java.awt.Shape;
import java.awt.font.FontRenderContext;
import java.awt.font.GlyphVector;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -45,7 +45,7 @@ public class WorldMapView extends JComponent implements Scrollable {
Project proj;
public Map<String, Rectangle> mapLocations = new HashMap<String, Rectangle>();
public Map<String, Rectangle> mapLocations = new LinkedHashMap<String, Rectangle>();
public Set<String> selected = new HashSet<String>();

View File

@@ -7,8 +7,8 @@ import java.awt.Image;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -34,11 +34,11 @@ public class SpriteChooser extends JDialog {
private static final int STD_HEIGHT = 32;
private static final int MAX_PER_ROW = 10;
public static Map<Project, Map<Spritesheet.Category, SpriteChooser>> cache = new HashMap<Project, Map<Spritesheet.Category,SpriteChooser>>();
public static Map<Project, Map<Spritesheet.Category, SpriteChooser>> cache = new LinkedHashMap<Project, Map<Spritesheet.Category,SpriteChooser>>();
public static SpriteChooser getChooser(Project proj, Spritesheet.Category category) {
if (cache.get(proj) == null) {
cache.put(proj, new HashMap<Spritesheet.Category, SpriteChooser>());
cache.put(proj, new LinkedHashMap<Spritesheet.Category, SpriteChooser>());
}
if (cache.get(proj).get(category) == null) {
cache.get(proj).put(category, new SpriteChooser(proj, category));

View File

@@ -8,9 +8,9 @@ import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -50,7 +50,7 @@ public class SpritesheetEditor extends Editor {
private static final long serialVersionUID = 3956109815682889863L;
Map<String, JPanel> editorTabs = new HashMap<String, JPanel>();
Map<String, JPanel> editorTabs = new LinkedHashMap<String, JPanel>();
JideTabbedPane editorTabsHolder;
private JSpinner widthField;

View File

@@ -7,10 +7,9 @@ import java.awt.event.ActionEvent;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.geom.Point2D;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.swing.AbstractAction;
@@ -42,9 +41,7 @@ import prefuse.data.FilteredSpanningTree;
import prefuse.data.Graph;
import prefuse.data.Node;
import prefuse.data.Schema;
import prefuse.data.SpanningTree;
import prefuse.data.Tree;
import prefuse.data.expression.BooleanLiteral;
import prefuse.data.expression.ColumnExpression;
import prefuse.render.DefaultRendererFactory;
import prefuse.render.EdgeRenderer;
@@ -57,12 +54,12 @@ import prefuse.visual.EdgeItem;
import prefuse.visual.VisualItem;
import prefuse.visual.expression.InGroupPredicate;
import com.gpl.rpg.atcontentstudio.model.tools.WriterModeData;
import com.gpl.rpg.atcontentstudio.model.tools.WriterModeData.EmptyReply;
import com.gpl.rpg.atcontentstudio.model.tools.WriterModeData.SpecialDialogue;
import com.gpl.rpg.atcontentstudio.model.tools.WriterModeData.WriterDialogue;
import com.gpl.rpg.atcontentstudio.model.tools.WriterModeData.WriterNode;
import com.gpl.rpg.atcontentstudio.model.tools.WriterModeData.WriterReply;
import com.gpl.rpg.atcontentstudio.model.tools.writermode.WriterModeData;
import com.gpl.rpg.atcontentstudio.model.tools.writermode.WriterModeData.EmptyReply;
import com.gpl.rpg.atcontentstudio.model.tools.writermode.WriterModeData.SpecialDialogue;
import com.gpl.rpg.atcontentstudio.model.tools.writermode.WriterModeData.WriterDialogue;
import com.gpl.rpg.atcontentstudio.model.tools.writermode.WriterModeData.WriterNode;
import com.gpl.rpg.atcontentstudio.model.tools.writermode.WriterModeData.WriterReply;
import com.gpl.rpg.atcontentstudio.ui.DefaultIcons;
import com.gpl.rpg.atcontentstudio.ui.Editor;
@@ -115,7 +112,7 @@ public class WriterModeEditor extends Editor {
private static final long serialVersionUID = -7992763190713052045L;
private MyGraph graph;
private Map<WriterModeData.WriterNode, Node> cells = new HashMap<WriterModeData.WriterNode, Node>();
private Map<WriterModeData.WriterNode, Node> cells = new LinkedHashMap<WriterModeData.WriterNode, Node>();
private Node nullNode = null;
private Edge pendingEdge = null;

View File

@@ -4,13 +4,6 @@ import java.util.BitSet;
import java.util.Iterator;
import java.util.LinkedList;
import prefuse.data.Edge;
import prefuse.data.Graph;
import prefuse.data.Node;
import prefuse.data.Schema;
import prefuse.data.Table;
import prefuse.data.Tree;
import prefuse.data.Tuple;
import prefuse.data.tuple.TupleManager;
import prefuse.visual.tuple.TableEdgeItem;