v0.4.5 to cope with changes to spawnareas definition in game code.

replaced gcode references by github repo.
This commit is contained in:
Zukero
2016-07-18 18:55:16 +02:00
parent 2a06002b51
commit 830e9de56b
6 changed files with 31 additions and 10 deletions

View File

@@ -18,7 +18,7 @@ import com.gpl.rpg.atcontentstudio.ui.WorkspaceSelector;
public class ATContentStudio {
public static final String APP_NAME = "Andor's Trail Content Studio";
public static final String APP_VERSION = "v0.4.4";
public static final String APP_VERSION = "v0.4.5";
public static boolean STARTED = false;
public static StudioFrame frame = null;

View File

@@ -35,7 +35,7 @@ public class KeyArea extends MapObject {
oldSchoolRequirement = false;
}
requirement = new Requirement();
requirement.type = Requirement.RequirementType.valueOf(requireType);
if (requireType != null) requirement.type = Requirement.RequirementType.valueOf(requireType);
requirement.required_obj_id = requireId;
if (requireValue != null) requirement.required_value = Integer.parseInt(requireValue);
requirement.state = GameDataElement.State.parsed;

View File

@@ -13,6 +13,7 @@ public class SpawnArea extends MapObject {
public int quantity = 1;
public int spawnchance = 10;
public boolean active = true;
public String spawngroup_id;
public List<NPC> spawnGroup = new ArrayList<NPC>();
public SpawnArea(tiled.core.MapObject obj) {
@@ -25,12 +26,17 @@ public class SpawnArea extends MapObject {
if (obj.getProperties().getProperty("active") != null) {
this.active = Boolean.parseBoolean(obj.getProperties().getProperty("active"));
}
if (obj.getProperties().getProperty("spawngroup") != null) {
this.spawngroup_id = obj.getProperties().getProperty("spawngroup");
} else if (obj.getName() != null ){
this.spawngroup_id = obj.getName();
}
}
@Override
public void link() {
if (name != null) {
spawnGroup = parentMap.getProject().getSpawnGroup(name);
if (spawngroup_id != null) {
spawnGroup = parentMap.getProject().getSpawnGroup(spawngroup_id);
} else {
spawnGroup = new ArrayList<NPC>();
}
@@ -65,6 +71,9 @@ public class SpawnArea extends MapObject {
@Override
public void savePropertiesInTmxObject(tiled.core.MapObject tmxObject) {
if (spawngroup_id != null) {
tmxObject.getProperties().setProperty("spawngroup", spawngroup_id);
}
if (quantity != 1) {
tmxObject.getProperties().setProperty("quantity", Integer.toString(quantity));
}

View File

@@ -36,7 +36,7 @@ public class AboutEditor extends Editor {
"<br/>" +
"Play <a href=\"https://play.google.com/store/apps/details?id=com.gpl.rpg.AndorsTrail\">Andor's Trail</a> for free on your Android device.<br/>" +
"Visit <a href=\"http://andorstrail.com/\">the official forum</a> to give or receive help.<br/>" +
"Open the project's <a href=\"https://code.google.com/p/andors-trail/\">Google Code page</a> to check out the game's source code.<br/>" +
"Open the project's <a href=\"https://github.com/Zukero/andors-trail/\">GitHub project page</a> to check out the game's source code.<br/>" +
"<br/>" +
"For content creation help, make sure to use the following resources:<br/>" +
"<a href=\"http://andorstrail.com/viewtopic.php?f=6&t=4560\">The contribution guide on the forums</a><br/>" +

View File

@@ -370,7 +370,7 @@ public class WorkspaceActions {
}
@Override
public void putValue(String key, Object value) {
public synchronized void putValue(String key, Object value) {
PropertyChangeEvent event = new PropertyChangeEvent(this, key, values.get(key), value);
values.put(key, value);
for (PropertyChangeListener l : listeners) {
@@ -379,7 +379,7 @@ public class WorkspaceActions {
}
@Override
public void setEnabled(boolean b) {
public synchronized void setEnabled(boolean b) {
PropertyChangeEvent event = new PropertyChangeEvent(this, "enabled", isEnabled(), b);
enabled = b;
for (PropertyChangeListener l : listeners) {
@@ -395,12 +395,12 @@ public class WorkspaceActions {
private Set<PropertyChangeListener> listeners = new HashSet<PropertyChangeListener>();
@Override
public void addPropertyChangeListener(PropertyChangeListener listener) {
public synchronized void addPropertyChangeListener(PropertyChangeListener listener) {
listeners.add(listener);
}
@Override
public void removePropertyChangeListener(PropertyChangeListener listener) {
public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
listeners.remove(listener);
}

View File

@@ -147,6 +147,7 @@ public class TMXMapEditor extends Editor {
private JComboBox evaluateTriggerBox;
private JSpinner quantityField;
private JCheckBox activeForNewGame;
private JTextField spawngroupField;
private JList npcList;
private SpawnGroupNpcListModel npcListModel;
@@ -546,7 +547,8 @@ public class TMXMapEditor extends Editor {
} else if (selected instanceof SignArea) {
dialogueBox = addDialogueBox(pane, ((TMXMap)target).getProject(), "Message: ", ((SignArea)selected).dialogue, ((TMXMap)target).writable, listener);
} else if (selected instanceof SpawnArea) {
areaField = addTextField(pane, "Spawn group ID: ", ((SpawnArea)selected).name, ((TMXMap)target).writable, listener);
areaField = addTextField(pane, "Spawn area ID: ", ((SpawnArea)selected).name, ((TMXMap)target).writable, listener);
spawngroupField = addTextField(pane, "Spawn group ID: ", ((SpawnArea)selected).spawngroup_id, ((TMXMap)target).writable, listener);
quantityField = addIntegerField(pane, "Number of spawned NPCs: ", ((SpawnArea)selected).quantity, false, ((TMXMap)target).writable, listener);
activeForNewGame = addBooleanBasedCheckBox(pane, "Active in a new game: ", ((SpawnArea)selected).active, ((TMXMap)target).writable, listener);
npcListModel = new SpawnGroupNpcListModel((SpawnArea) selected);
@@ -1690,6 +1692,16 @@ public class TMXMapEditor extends Editor {
tmxViewer.revalidate();
tmxViewer.repaint();
} else if (source == areaField) {
if (selectedMapObject instanceof SpawnArea) {
SpawnArea area = (SpawnArea)selectedMapObject;
area.name = (String) value;
groupObjectsListModel.objectChanged(area);
} else if (selectedMapObject instanceof MapChange) {
MapChange area = (MapChange) selectedMapObject;
area.name = (String) value;
groupObjectsListModel.objectChanged(area);
}
} else if (source == spawngroupField) {
if (selectedMapObject instanceof SpawnArea) {
SpawnArea area = (SpawnArea)selectedMapObject;
if (area.spawnGroup != null && !area.spawnGroup.isEmpty()) {