mirror of
https://github.com/OMGeeky/ATCS.git
synced 2025-12-26 23:57:25 +01:00
Fixed NPC editor bug where inflicted actor conditions weren't managed
correctly. Fixed Worldmap saving and deletion (mostly the * management was crap) Fixed multi-selection deletion.
This commit is contained in:
@@ -35,6 +35,7 @@ import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
|
||||
import com.gpl.rpg.atcontentstudio.model.GameSource;
|
||||
import com.gpl.rpg.atcontentstudio.model.GameSource.Type;
|
||||
import com.gpl.rpg.atcontentstudio.model.Project;
|
||||
@@ -222,6 +223,7 @@ public class Worldmap extends ArrayList<WorldmapSegment> implements ProjectTreeN
|
||||
|
||||
for (WorldmapSegment segment : this) {
|
||||
root.appendChild(segment.toXmlElement(doc));
|
||||
segment.state = GameDataElement.State.saved;
|
||||
}
|
||||
|
||||
saveDocToFile(doc, worldmapFile);
|
||||
|
||||
@@ -140,14 +140,14 @@ public class ProjectsTree extends JPanel {
|
||||
projectsTree.addTreeSelectionListener(new TreeSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(TreeSelectionEvent e) {
|
||||
List<TreePath> newPaths = new ArrayList<TreePath>();
|
||||
for (TreePath path : e.getPaths()) {
|
||||
if (e.isAddedPath(path)) newPaths.add(path);
|
||||
}
|
||||
// List<TreePath> newPaths = new ArrayList<TreePath>();
|
||||
// for (TreePath path : e.getPaths()) {
|
||||
// if (e.isAddedPath(path)) newPaths.add(path);
|
||||
// }
|
||||
if (e.getPath() == null) {
|
||||
ATContentStudio.frame.actions.selectionChanged(null, newPaths.toArray(new TreePath[newPaths.size()]));
|
||||
ATContentStudio.frame.actions.selectionChanged(null, projectsTree.getSelectionPaths());
|
||||
} else {
|
||||
ATContentStudio.frame.actions.selectionChanged((ProjectTreeNode) e.getPath().getLastPathComponent(), newPaths.toArray(new TreePath[newPaths.size()]));
|
||||
ATContentStudio.frame.actions.selectionChanged((ProjectTreeNode) e.getPath().getLastPathComponent(), projectsTree.getSelectionPaths());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -31,8 +31,12 @@ 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.gamedata.Quest;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.QuestStage;
|
||||
import com.gpl.rpg.atcontentstudio.model.maps.TMXMap;
|
||||
import com.gpl.rpg.atcontentstudio.model.maps.TMXMapSet;
|
||||
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.tools.writermode.WriterModeData;
|
||||
import com.gpl.rpg.atcontentstudio.model.tools.writermode.WriterModeDataSet;
|
||||
@@ -122,19 +126,41 @@ public class WorkspaceActions {
|
||||
ATContentStudio.frame.closeEditor(element);
|
||||
element.childrenRemoved(new ArrayList<ProjectTreeNode>());
|
||||
if (element instanceof JSONElement) {
|
||||
@SuppressWarnings("unchecked")
|
||||
GameDataCategory<JSONElement> category = (GameDataCategory<JSONElement>) element.getParent();
|
||||
category.remove(element);
|
||||
if (impactedCategories.get(category) == null) {
|
||||
impactedCategories.put(category, new HashSet<File>());
|
||||
if (element.getParent() instanceof GameDataCategory<?>) {
|
||||
@SuppressWarnings("unchecked")
|
||||
GameDataCategory<JSONElement> category = (GameDataCategory<JSONElement>) element.getParent();
|
||||
category.remove(element);
|
||||
if (impactedCategories.get(category) == null) {
|
||||
impactedCategories.put(category, new HashSet<File>());
|
||||
}
|
||||
|
||||
GameDataElement newOne = element.getProject().getGameDataElement(((JSONElement)element).getClass(), element.id);
|
||||
if (element instanceof Quest) {
|
||||
for (QuestStage oldStage : ((Quest) element).stages) {
|
||||
QuestStage newStage = newOne != null ? ((Quest) newOne).getStage(oldStage.progress) : null;
|
||||
for (GameDataElement backlink : oldStage.getBacklinks()) {
|
||||
backlink.elementChanged(oldStage, newStage);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (GameDataElement backlink : element.getBacklinks()) {
|
||||
backlink.elementChanged(element, newOne);
|
||||
}
|
||||
impactedCategories.get(category).add(((JSONElement) element).jsonFile);
|
||||
}
|
||||
impactedCategories.get(category).add(((JSONElement) element).jsonFile);
|
||||
} else if (element instanceof TMXMap) {
|
||||
TMXMapSet parent = (TMXMapSet) element.getParent();
|
||||
parent.tmxMaps.remove(element);
|
||||
((TMXMap)element).delete();
|
||||
} else if (element instanceof WriterModeData) {
|
||||
WriterModeDataSet parent = (WriterModeDataSet) element.getParent();
|
||||
parent.writerModeDataList.remove(element);
|
||||
} else if (element instanceof WorldmapSegment) {
|
||||
if (element.getParent() instanceof Worldmap) {
|
||||
((Worldmap)element.getParent()).remove(element);
|
||||
element.save();
|
||||
for (GameDataElement backlink : element.getBacklinks()) {
|
||||
backlink.elementChanged(element, element.getProject().getWorldmapSegment(element.id));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
new Thread() {
|
||||
@@ -165,20 +191,48 @@ public class WorkspaceActions {
|
||||
@Override
|
||||
public void run() {
|
||||
node.childrenRemoved(new ArrayList<ProjectTreeNode>());
|
||||
if (node.getParent() instanceof GameDataCategory<?>) {
|
||||
((GameDataCategory<?>)node.getParent()).remove(node);
|
||||
List<SaveEvent> events = node.attemptSave();
|
||||
if (events == null || events.isEmpty()) {
|
||||
node.save();
|
||||
} else {
|
||||
new SaveItemsWizard(events, null).setVisible(true);
|
||||
if (node instanceof JSONElement) {
|
||||
if (node.getParent() instanceof GameDataCategory<?>) {
|
||||
((GameDataCategory<?>)node.getParent()).remove(node);
|
||||
List<SaveEvent> events = node.attemptSave();
|
||||
if (events == null || events.isEmpty()) {
|
||||
node.save();
|
||||
} else {
|
||||
new SaveItemsWizard(events, null).setVisible(true);
|
||||
}
|
||||
GameDataElement newOne = node.getProject().getGameDataElement(((JSONElement)node).getClass(), node.id);
|
||||
if (node instanceof Quest) {
|
||||
for (QuestStage oldStage : ((Quest) node).stages) {
|
||||
QuestStage newStage = newOne != null ? ((Quest) newOne).getStage(oldStage.progress) : null;
|
||||
for (GameDataElement backlink : oldStage.getBacklinks()) {
|
||||
backlink.elementChanged(oldStage, newStage);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (GameDataElement backlink : node.getBacklinks()) {
|
||||
backlink.elementChanged(node, newOne);
|
||||
}
|
||||
}
|
||||
// ((GameDataCategory<?>)node.getParent()).remove(node);
|
||||
// List<SaveEvent> events = node.attemptSave();
|
||||
// if (events == null || events.isEmpty()) {
|
||||
// node.save();
|
||||
// } else {
|
||||
// new SaveItemsWizard(events, null).setVisible(true);
|
||||
// }
|
||||
} else if (node instanceof TMXMap) {
|
||||
TMXMapSet parent = (TMXMapSet) node.getParent();
|
||||
parent.tmxMaps.remove(node);
|
||||
((TMXMap)node).delete();
|
||||
} else if (node instanceof WriterModeData) {
|
||||
WriterModeDataSet parent = (WriterModeDataSet) node.getParent();
|
||||
parent.writerModeDataList.remove(node);
|
||||
} else if (node instanceof WorldmapSegment) {
|
||||
if (node.getParent() instanceof Worldmap) {
|
||||
((Worldmap)node.getParent()).remove(node);
|
||||
node.save();
|
||||
for (GameDataElement backlink : node.getBacklinks()) {
|
||||
backlink.elementChanged(node, node.getProject().getWorldmapSegment(node.id));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
@@ -192,12 +246,9 @@ public class WorkspaceActions {
|
||||
for (TreePath selected : selectedPaths) {
|
||||
if (selected.getLastPathComponent() instanceof GameDataElement && ((GameDataElement)selected.getLastPathComponent()).writable) {
|
||||
elementsToDelete.add((GameDataElement) selected.getLastPathComponent());
|
||||
multiMode = true;
|
||||
} else {
|
||||
multiMode = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
multiMode = elementsToDelete.size() > 1;
|
||||
putValue(Action.NAME, "Delete all selected elements");
|
||||
setEnabled(multiMode);
|
||||
} else if (selectedNode instanceof GameDataElement && ((GameDataElement)selectedNode).writable) {
|
||||
|
||||
@@ -606,7 +606,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
hitEffect.ap_boost_max = (Integer) value;
|
||||
updateHit = true;
|
||||
} else if (source == hitSourceConditionsList) {
|
||||
//TODO
|
||||
updateHit = true;
|
||||
} else if (source == sourceConditionBox) {
|
||||
if (selectedHitEffectSourceCondition.condition != null) {
|
||||
selectedHitEffectSourceCondition.condition.removeBacklink(npc);
|
||||
@@ -629,7 +629,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
selectedHitEffectSourceCondition.chance = (Double) value;
|
||||
hitSourceConditionsListModel.itemChanged(selectedHitEffectSourceCondition);
|
||||
} else if (source == hitTargetConditionsList) {
|
||||
//TODO
|
||||
updateHit = true;
|
||||
} else if (source == targetConditionBox) {
|
||||
if (selectedHitEffectTargetCondition.condition != null) {
|
||||
selectedHitEffectTargetCondition.condition.removeBacklink(npc);
|
||||
|
||||
@@ -98,7 +98,7 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
|
||||
|
||||
public WorldMapEditor(WorldmapSegment worldmap) {
|
||||
target = worldmap;
|
||||
this.name = worldmap.id;
|
||||
this.name = worldmap.getDesc();
|
||||
this.icon = new ImageIcon(worldmap.getIcon());
|
||||
setLayout(new BorderLayout());
|
||||
|
||||
@@ -117,8 +117,8 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
|
||||
|
||||
@Override
|
||||
public void targetUpdated() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
this.name = ((GameDataElement)target).getDesc();
|
||||
updateMessage();
|
||||
}
|
||||
|
||||
public JPanel getXmlEditorPane() {
|
||||
|
||||
Reference in New Issue
Block a user