Compare commits

...

13 Commits

Author SHA1 Message Date
Zukero
5d802ed0e3 v0.6.6 released. 2017-08-18 22:19:29 +02:00
Zukero
33cbd059ec More bug fixes in Requirement management for Key and Replace areas.
Much better handling of the old school form, and smooth, automatic
transitionning from old school to new school, but only when necessary!
2017-08-18 17:22:06 +02:00
Zukero
6cb0941ca6 Replace areas can now use any type of requirement.
Many bug fix in Key Areas and Replace Areas, especially for the
requirements management.
2017-08-18 16:20:25 +02:00
Zukero
cfb38c33d6 Fixed bug preventing Quests with no quest stages from loading. 2017-08-18 11:51:48 +02:00
Zukero
ec3afaaf36 v0.6.5 released! 2017-08-11 22:32:54 +02:00
Zukero
9f978591ff Fixed XML-refreshing bug in TMX Map editor, and added area name editor
for key areas.
2017-08-11 22:16:08 +02:00
Zukero
7fff58d8f9 Merge branch 'master' of https://github.com/Zukero/ATCS.git 2017-08-11 21:31:57 +02:00
Zukero
6192bd8dce Fixed issue with symlinks creatipon in windows for paths containing
spaces.
2017-08-11 21:31:34 +02:00
Zukero
be43a2a5d4 Fixed display of incorrect default values when the underlying datais
null. Fixed KeyArea initialization.
2017-08-11 18:43:44 +02:00
Zukero
99524bf043 Introducing the help panel for Dialogue Sketches' editor's shortcuts. 2017-08-09 18:04:30 +02:00
Zukero
f2144ab446 Modified marker (*) handled for Dialogue Sketches too.
Typo fixed too, now displays "Dialogue sketches" instead of "Dialogue
sketchs"
2017-08-08 18:43:15 +02:00
Zukero
ada045a13b Fixed JSON import of existing element.
When an imported item was already present in the game sources, it wasnt
associated with the correct file, leading to trouble.
2017-08-08 18:25:01 +02:00
Zukero
4c4f7e5b92 Better management of scrolling in TMX Maps editor's Replacement
simulator.
2017-07-30 17:38:50 +02:00
18 changed files with 200 additions and 61 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="WINDOWS-1252" standalone="no"?>
<jardesc>
<jar path="ATCS/ATCS_v0.6.4.jar"/>
<jar path="ATCS/ATCS_v0.6.6.jar"/>
<options buildIfNeeded="true" compress="true" descriptionLocation="/ATCS/ATCS_JAR.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
<selectedProjects/>

1
packaging/ATCS_latest Normal file
View File

@@ -0,0 +1 @@
v0.6.6

View File

@@ -1,6 +1,6 @@
!include MUI2.nsh
!define VERSION "0.6.4"
!define VERSION "0.6.6"
!define TRAINER_VERSION "0.1.4"
!define JAVA_BIN "javaw"

View File

@@ -38,7 +38,7 @@ import prefuse.data.expression.parser.ExpressionParser;
public class ATContentStudio {
public static final String APP_NAME = "Andor's Trail Content Studio";
public static final String APP_VERSION = "v0.6.4";
public static final String APP_VERSION = "v0.6.6";
public static final String CHECK_UPDATE_URL = "https://andorstrail.com/static/ATCS_latest";
public static final String DOWNLOAD_URL = "https://andorstrail.com/viewtopic.php?f=6&t=4806";

View File

@@ -214,6 +214,9 @@ public class ActorCondition extends JSONElement {
}
if (this.icon_id != null) {
String spritesheetId = this.icon_id.split(":")[0];
if (getProject().getSpritesheet(spritesheetId) == null) {
System.out.println(this.id);
}
getProject().getSpritesheet(spritesheetId).addBacklink(this);
}

View File

@@ -99,8 +99,8 @@ public class Quest extends JSONElement {
public void parse(Map questJson) {
this.visible_in_log = JSONElement.getInteger((Number) questJson.get("showInLog"));
List questStagesJson = (List) questJson.get("stages");
this.stages = new ArrayList<QuestStage>();
if (questStagesJson != null && !questStagesJson.isEmpty()) {
this.stages = new ArrayList<QuestStage>();
for (Object questStageJsonObj : questStagesJson) {
Map questStageJson = (Map)questStageJsonObj;
QuestStage questStage = new QuestStage(this);

View File

@@ -19,20 +19,20 @@ public class KeyArea extends MapObject {
String requireType = obj.getProperties().getProperty("requireType");
String requireId = obj.getProperties().getProperty("requireId");
String requireValue = obj.getProperties().getProperty("requireValue");
if (requireId == null) {
oldSchoolRequirement = false;
if (requireType == null) {
String[] fields = obj.getName().split(":");
if (fields.length == 2) {
requireType = Requirement.RequirementType.questProgress.toString();
requireValue = fields[1];
requireId = fields[0];
oldSchoolRequirement = true;
} else if (fields.length == 3) {
requireValue = fields[2];
requireType = fields[0];
requireId = fields[1];
oldSchoolRequirement = true;
}
oldSchoolRequirement = true;
} else {
oldSchoolRequirement = false;
}
requirement = new Requirement();
if (requireType != null) requirement.type = Requirement.RequirementType.valueOf(requireType);
@@ -76,7 +76,7 @@ public class KeyArea extends MapObject {
}
if (requirement != null) {
if (oldSchoolRequirement && Requirement.RequirementType.questProgress.equals(requirement.type) && (requirement.negated == null || !requirement.negated)) {
tmxObject.setName(requirement.required_obj_id+":"+Integer.toString(requirement.required_value));
tmxObject.setName(requirement.required_obj_id+":"+((requirement.required_value == null) ? "" : Integer.toString(requirement.required_value)));
} else {
if (requirement.type != null) {
tmxObject.getProperties().setProperty("requireType", requirement.type.toString());
@@ -89,13 +89,16 @@ public class KeyArea extends MapObject {
if (requirement.required_value != null) {
tmxObject.getProperties().setProperty("requireValue", requirement.required_value.toString());
}
if (requirement.negated != null) {
tmxObject.getProperties().setProperty("requireNegation", Boolean.toString(requirement.negated));
}
}
}
}
public void updateNameFromRequirementChange() {
if (oldSchoolRequirement && Requirement.RequirementType.questProgress.equals(requirement.type) && (requirement.negated == null || !requirement.negated)) {
name = requirement.required_obj_id+":"+Integer.toString(requirement.required_value);
name = requirement.required_obj_id+":"+((requirement.required_value == null) ? "" : Integer.toString(requirement.required_value));
} else if (oldSchoolRequirement) {
int i = 0;
String futureName = requirement.type.toString() + "#" + Integer.toString(i);

View File

@@ -17,13 +17,13 @@ public class ReplaceArea extends MapObject {
public List<ReplaceArea.Replacement> replacements = null;
public ReplaceArea(tiled.core.MapObject obj) {
// String requireType = obj.getProperties().getProperty("requireType");
String requireType = obj.getProperties().getProperty("requireType");
String requireId = obj.getProperties().getProperty("requireId");
String requireValue = obj.getProperties().getProperty("requireValue");
if (requireId == null) {
if (requireType == null) {
String[] fields = obj.getName().split(":");
if (fields.length == 2) {
// requireType = Requirement.RequirementType.questProgress.toString();
requireType = Requirement.RequirementType.questProgress.toString();
requireValue = fields[1];
requireId = fields[0];
oldSchoolRequirement = true;
@@ -34,9 +34,7 @@ public class ReplaceArea extends MapObject {
}*/
}
requirement = new Requirement();
//Replace areas only support questProgress requirements ATM
//requirement.type = Requirement.RequirementType.valueOf(requireType);
requirement.type = Requirement.RequirementType.questProgress;
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;
@@ -93,7 +91,7 @@ public class ReplaceArea extends MapObject {
}
if (requirement != null) {
if (oldSchoolRequirement && Requirement.RequirementType.questProgress.equals(requirement.type) && (requirement.negated == null || !requirement.negated)) {
tmxObject.setName(requirement.required_obj_id+":"+Integer.toString(requirement.required_value));
tmxObject.setName(requirement.required_obj_id+":"+((requirement.required_value == null) ? "" : Integer.toString(requirement.required_value)));
} else {
tmxObject.getProperties().setProperty("requireType", requirement.type.toString());
if (requirement.required_obj != null) {
@@ -104,6 +102,9 @@ public class ReplaceArea extends MapObject {
if (requirement.required_value != null) {
tmxObject.getProperties().setProperty("requireValue", requirement.required_value.toString());
}
if (requirement.negated != null) {
tmxObject.getProperties().setProperty("requireNegation", Boolean.toString(requirement.negated));
}
}
}
}
@@ -111,7 +112,7 @@ public class ReplaceArea extends MapObject {
//Don't use yet !
public void updateNameFromRequirementChange() {
if (oldSchoolRequirement && Requirement.RequirementType.questProgress.equals(requirement.type) && (requirement.negated == null || !requirement.negated)) {
name = requirement.required_obj_id+":"+Integer.toString(requirement.required_value);
name = requirement.required_obj_id+":"+((requirement.required_value == null) ? "" : Integer.toString(requirement.required_value));
} else if (oldSchoolRequirement) {
int i = 0;
String futureName = requirement.type.toString() + "#" + Integer.toString(i);

View File

@@ -109,7 +109,7 @@ public class WriterModeDataSet implements ProjectTreeNode, Serializable {
@Override
public String getDesc() {
return (needsSaving() ? "*" : "")+"Dialogue sketchs";
return (needsSaving() ? "*" : "")+"Dialogue sketches";
}
@Override

View File

@@ -316,11 +316,15 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
// }
public static JSpinner addIntegerField(JPanel pane, String label, Integer initialValue, boolean allowNegatives, boolean editable, final FieldUpdateListener listener) {
return addIntegerField(pane, label, initialValue, 0, allowNegatives, editable, listener);
}
public static JSpinner addIntegerField(JPanel pane, String label, Integer initialValue, Integer defaultValue, boolean allowNegatives, boolean editable, final FieldUpdateListener listener) {
JPanel tfPane = new JPanel();
tfPane.setLayout(new JideBoxLayout(tfPane, JideBoxLayout.LINE_AXIS, 6));
JLabel tfLabel = new JLabel(label);
tfPane.add(tfLabel, JideBoxLayout.FIX);
final JSpinner spinner = new JSpinner(new SpinnerNumberModel(initialValue != null ? initialValue.intValue() : 0, allowNegatives ? Integer.MIN_VALUE : 0, Integer.MAX_VALUE, 1));
final JSpinner spinner = new JSpinner(new SpinnerNumberModel(initialValue != null ? initialValue.intValue() : defaultValue.intValue(), allowNegatives ? Integer.MIN_VALUE : 0, Integer.MAX_VALUE, 1));
((JSpinner.DefaultEditor)spinner.getEditor()).getTextField().setHorizontalAlignment(JTextField.LEFT);
spinner.setEnabled(editable);
((DefaultFormatter)((NumberEditor)spinner.getEditor()).getTextField().getFormatter()).setCommitsOnValidEdit(true);

View File

@@ -338,6 +338,7 @@ public class JSONImportWizard extends JDialog {
} else if (existingNode.getDataType() == GameSource.Type.altered) {
errors.add("An item with id "+node.id+" is already altered in this project.");
} else {
node.jsonFile = existingNode.jsonFile;
warnings.add("An item with id "+node.id+" exists in the used game source. This one will be inserted as \"altered\"");
}
existingNode = null;
@@ -412,7 +413,7 @@ public class JSONImportWizard extends JDialog {
proj.createElements(created);
JSONElement lastNode = created.get(created.size() - 1);
if (lastNode != null) {
lastNode.save();
// lastNode.save();
ATContentStudio.frame.selectInTree(lastNode);
}
JSONImportWizard.this.setVisible(false);

View File

@@ -242,17 +242,17 @@ public class ProjectsTree extends JPanel {
addNextSeparator = false;
}
if (actions.testWriter.isEnabled()) {
if (actions.createWriter.isEnabled()) {
addNextSeparator = true;
popupMenu.add(new JMenuItem(actions.testWriter));
popupMenu.add(new JMenuItem(actions.createWriter));
}
// if (actions.testCommitWriter.isEnabled()) {
// addNextSeparator = true;
// popupMenu.add(new JMenuItem(actions.testCommitWriter));
// }
if (actions.createWriter.isEnabled()) {
if (actions.generateWriter.isEnabled()) {
addNextSeparator = true;
popupMenu.add(new JMenuItem(actions.createWriter));
popupMenu.add(new JMenuItem(actions.generateWriter));
}
if (addNextSeparator) {
popupMenu.add(new JSeparator());

View File

@@ -399,7 +399,7 @@ public class WorkspaceActions {
};
};
public ATCSAction testWriter = new ATCSAction("Create dialogue sketch", "Create a dialogue sketch for fast dialogue edition"){
public ATCSAction createWriter = new ATCSAction("Create dialogue sketch", "Create a dialogue sketch for fast dialogue edition"){
public void actionPerformed(ActionEvent e) {
if (selectedNode == null || selectedNode.getProject() == null) return;
new WriterSketchCreationWizard(selectedNode.getProject()).setVisible(true);
@@ -434,7 +434,7 @@ public class WorkspaceActions {
}
};*/
public ATCSAction createWriter = new ATCSAction("Generate dialogue sketch", "Generates a dialogue sketch from this dialogue and its tree.") {
public ATCSAction generateWriter = new ATCSAction("Generate dialogue sketch", "Generates a dialogue sketch from this dialogue and its tree.") {
public void actionPerformed(ActionEvent e) {
if (selectedNode == null || selectedNode.getProject() == null || !(selectedNode instanceof Dialogue)) return;
new WriterSketchCreationWizard(selectedNode.getProject(), (Dialogue)selectedNode).setVisible(true);
@@ -472,9 +472,9 @@ public class WorkspaceActions {
actions.add(exportProject);
actions.add(showAbout);
actions.add(exitATCS);
actions.add(testWriter);
// actions.add(testCommitWriter);
actions.add(createWriter);
// actions.add(testCommitWriter);
actions.add(generateWriter);
actions.add(editWorkspaceSettings);
selectionChanged(null, null);
}

View File

@@ -487,7 +487,7 @@ public class ItemEditor extends JSONElementEditor {
hitSourceConditionChance = addDoubleField(pane, "Chance: ", condition.chance, writable, listener);
hitSourceConditionApply = new JRadioButton("Apply new condition");
pane.add(hitSourceConditionApply, JideBoxLayout.FIX);
hitSourceConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, false, writable, listener);
hitSourceConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, 1, false, writable, listener);
hitSourceConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, false, writable, listener);
hitSourceConditionClear = new JRadioButton("Clear active condition");
pane.add(hitSourceConditionClear, JideBoxLayout.FIX);
@@ -543,7 +543,7 @@ public class ItemEditor extends JSONElementEditor {
hitTargetConditionChance = addDoubleField(pane, "Chance: ", condition.chance, writable, listener);
hitTargetConditionApply = new JRadioButton("Apply new condition");
pane.add(hitTargetConditionApply, JideBoxLayout.FIX);
hitTargetConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, false, writable, listener);
hitTargetConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, 1, false, writable, listener);
hitTargetConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, false, writable, listener);
hitTargetConditionClear = new JRadioButton("Clear active condition");
pane.add(hitTargetConditionClear, JideBoxLayout.FIX);
@@ -599,7 +599,7 @@ public class ItemEditor extends JSONElementEditor {
killSourceConditionChance = addDoubleField(pane, "Chance: ", condition.chance, writable, listener);
killSourceConditionApply = new JRadioButton("Apply new condition");
pane.add(killSourceConditionApply, JideBoxLayout.FIX);
killSourceConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, false, writable, listener);
killSourceConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, 1, false, writable, listener);
killSourceConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, false, writable, listener);
killSourceConditionClear = new JRadioButton("Clear active condition");
pane.add(killSourceConditionClear, JideBoxLayout.FIX);
@@ -651,7 +651,7 @@ public class ItemEditor extends JSONElementEditor {
Project proj = ((Item)target).getProject();
equipConditionBox = addActorConditionBox(pane, proj, "Actor Condition: ", condition.condition, writable, listener);
equipConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude, false, writable, listener);
equipConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude, 1, false, writable, listener);
pane.revalidate();
pane.repaint();

View File

@@ -181,12 +181,12 @@ public class NPCEditor extends JSONElementEditor {
moveTypeBox = addEnumValueBox(pane, "Movement type: ", NPC.MovementType.values(), npc.movement_type, npc.writable, listener);
combatTraitPane = new CollapsiblePanel("Combat traits: ");
combatTraitPane.setLayout(new JideBoxLayout(combatTraitPane, JideBoxLayout.PAGE_AXIS, 6));
maxHP = addIntegerField(combatTraitPane, "Max HP: ", npc.max_hp, false, npc.writable, listener);
maxAP = addIntegerField(combatTraitPane, "Max AP: ", npc.max_ap, false, npc.writable, listener);
moveCost = addIntegerField(combatTraitPane, "Move cost: ", npc.move_cost, false, npc.writable, listener);
maxHP = addIntegerField(combatTraitPane, "Max HP: ", npc.max_hp, 1, false, npc.writable, listener);
maxAP = addIntegerField(combatTraitPane, "Max AP: ", npc.max_ap, 10, false, npc.writable, listener);
moveCost = addIntegerField(combatTraitPane, "Move cost: ", npc.move_cost, 10, false, npc.writable, listener);
atkDmgMin = addIntegerField(combatTraitPane, "Attack Damage min: ", npc.attack_damage_min, false, npc.writable, listener);
atkDmgMax = addIntegerField(combatTraitPane, "Attack Damage max: ", npc.attack_damage_max, false, npc.writable, listener);
atkCost = addIntegerField(combatTraitPane, "Attack cost: ", npc.attack_cost, false, npc.writable, listener);
atkCost = addIntegerField(combatTraitPane, "Attack cost: ", npc.attack_cost, 10, false, npc.writable, listener);
atkChance = addIntegerField(combatTraitPane, "Attack chance: ", npc.attack_chance, false, npc.writable, listener);
critSkill = addIntegerField(combatTraitPane, "Critical skill: ", npc.critical_skill, false, npc.writable, listener);
critMult = addDoubleField(combatTraitPane, "Critical multiplier: ", npc.critical_multiplier, npc.writable, listener);
@@ -323,7 +323,7 @@ public class NPCEditor extends JSONElementEditor {
Project proj = ((NPC)target).getProject();
sourceConditionBox = addActorConditionBox(pane, proj, "Actor Condition: ", condition.condition, writable, listener);
sourceConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude, false, writable, listener);
sourceConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude, 1, false, writable, listener);
sourceConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, false, writable, listener);
sourceConditionChance = addDoubleField(pane, "Chance: ", condition.chance, writable, listener);
@@ -341,7 +341,7 @@ public class NPCEditor extends JSONElementEditor {
Project proj = ((NPC)target).getProject();
targetConditionBox = addActorConditionBox(pane, proj, "Actor Condition: ", condition.condition, writable, listener);
targetConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude, false, writable, listener);
targetConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude, 1, false, writable, listener);
targetConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, false, writable, listener);
targetConditionChance = addDoubleField(pane, "Chance: ", condition.chance, writable, listener);

View File

@@ -206,11 +206,12 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
JScrollPane tmxScroller = new JScrollPane(getTmxEditorPane(), JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
JScrollPane xmlScroller = new JScrollPane(getXmlEditorPane(), JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
JScrollPane replScroller = new JScrollPane(getReplacementSimulatorPane(), JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
//JScrollPane replScroller = new JScrollPane(getReplacementSimulatorPane(), JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
xmlScroller.getVerticalScrollBar().setUnitIncrement(16);
editorTabsHolder.add("TMX", tmxScroller);
editorTabsHolder.add("XML", xmlScroller);
editorTabsHolder.add("Replacements", replScroller);
//editorTabsHolder.add("Replacements", replScroller);
editorTabsHolder.add("Replacements", getReplacementSimulatorPane());
}
@@ -523,6 +524,7 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
if (selected instanceof ContainerArea) {
droplistBox = addDroplistBox(pane, ((TMXMap)target).getProject(), "Droplist: ", ((ContainerArea)selected).droplist, ((TMXMap)target).writable, listener);
} else if (selected instanceof KeyArea) {
areaField = addTextField(pane, "Area ID: ", ((KeyArea)selected).name, ((TMXMap)target).writable, listener);
dialogueBox = addDialogueBox(pane, ((TMXMap)target).getProject(), "Message when locked: ", ((KeyArea)selected).dialogue, ((TMXMap)target).writable, listener);
requirementTypeCombo = addEnumValueBox(pane, "Requirement type: ", Requirement.RequirementType.values(), ((KeyArea)selected).requirement.type, ((TMXMap)target).writable, listener);
requirementParamsPane = new JPanel();
@@ -561,9 +563,8 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
});
pane.add(tACPane, JideBoxLayout.FIX);
} else if (selected instanceof ReplaceArea) {
//Replace areas only use questProgress requirements ATM
//requirementTypeCombo = addEnumValueBox(pane, "Requirement type: ", Requirement.RequirementType.values(), ((ReplaceArea)selected).requirement.type, ((TMXMap)target).writable, listener);
areaField = addTextField(pane, "Area ID: ", ((ReplaceArea)selected).name, ((TMXMap)target).writable, listener);
requirementTypeCombo = addEnumValueBox(pane, "Requirement type: ", Requirement.RequirementType.values(), ((ReplaceArea)selected).requirement.type, ((TMXMap)target).writable, listener);
requirementParamsPane = new JPanel();
requirementParamsPane.setLayout(new JideBoxLayout(requirementParamsPane, JideBoxLayout.PAGE_AXIS, 6));
pane.add(requirementParamsPane, JideBoxLayout.FIX);
@@ -785,7 +786,7 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
activateAndViewPane.setLayout(new JideBoxLayout(activateAndViewPane, JideBoxLayout.LINE_AXIS));
activateAndViewPane.add(areasActivationPane, JideBoxLayout.FIX);
activateAndViewPane.add(viewer, JideBoxLayout.VARY);
activateAndViewPane.add(new JScrollPane(viewer), JideBoxLayout.VARY);
replacementSimulator.add(walkableVisibleBox, JideBoxLayout.FIX);
replacementSimulator.add(activateAndViewPane, JideBoxLayout.VARY);
@@ -1812,6 +1813,7 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
}
private int skipAreaFieldEvents = 0;
public class MapFieldUpdater implements FieldUpdateListener {
@SuppressWarnings({ "unchecked", "rawtypes" })
@@ -1847,8 +1849,22 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
tmxViewer.revalidate();
tmxViewer.repaint();
} else if (source == areaField) {
selectedMapObject.name = (String) value;
groupObjectsListModel.objectChanged(selectedMapObject);
if (skipAreaFieldEvents > 0) skipAreaFieldEvents--;
else {
selectedMapObject.name = (String) value;
if (selectedMapObject instanceof KeyArea) {
KeyArea area = (KeyArea) selectedMapObject;
if (area.oldSchoolRequirement) {
area.oldSchoolRequirement = false;
}
} else if (selectedMapObject instanceof ReplaceArea) {
ReplaceArea area = (ReplaceArea) selectedMapObject;
if (area.oldSchoolRequirement) {
area.oldSchoolRequirement = false;
}
}
groupObjectsListModel.objectChanged(selectedMapObject);
}
} else if (source == spawngroupField) {
if (selectedMapObject instanceof SpawnArea) {
SpawnArea area = (SpawnArea)selectedMapObject;
@@ -1972,7 +1988,20 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
KeyArea area = (KeyArea) selectedMapObject;
area.requirement.changeType((Requirement.RequirementType)requirementTypeCombo.getSelectedItem());
updateRequirementParamsPane(requirementParamsPane, area.requirement, this);
if (area.oldSchoolRequirement) area.updateNameFromRequirementChange();
if (area.oldSchoolRequirement) {
area.updateNameFromRequirementChange();
skipAreaFieldEvents+=2;
areaField.setText(area.name);
}
} else if (selectedMapObject instanceof ReplaceArea) {
ReplaceArea area = (ReplaceArea) selectedMapObject;
area.requirement.changeType((Requirement.RequirementType)requirementTypeCombo.getSelectedItem());
updateRequirementParamsPane(requirementParamsPane, area.requirement, this);
if (area.oldSchoolRequirement) {
area.updateNameFromRequirementChange();
skipAreaFieldEvents+=2;
areaField.setText(area.name);
}
}
} else if (source == requirementObj) {
if (selectedMapObject instanceof KeyArea) {
@@ -1983,7 +2012,11 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
} else {
area.requirement.required_obj_id = null;
}
if (area.oldSchoolRequirement) area.updateNameFromRequirementChange();
if (area.oldSchoolRequirement) {
area.updateNameFromRequirementChange();
skipAreaFieldEvents+=2;
areaField.setText(area.name);
}
} else if (selectedMapObject instanceof ReplaceArea) {
ReplaceArea area = (ReplaceArea) selectedMapObject;
area.requirement.required_obj = (GameDataElement) value;
@@ -1992,17 +2025,31 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
} else {
area.requirement.required_obj_id = null;
}
if (area.oldSchoolRequirement) area.updateNameFromRequirementChange();
if (area.oldSchoolRequirement) {
area.updateNameFromRequirementChange();
skipAreaFieldEvents+=2;
areaField.setText(area.name);
}
}
} else if (source == requirementObjId) {
if (selectedMapObject instanceof KeyArea) {
KeyArea area = (KeyArea) selectedMapObject;
area.requirement.required_obj_id = (String) value;
area.requirement.required_obj = null;
if (area.oldSchoolRequirement) {
area.updateNameFromRequirementChange();
skipAreaFieldEvents+=2;
areaField.setText(area.name);
}
} else if (selectedMapObject instanceof ReplaceArea) {
ReplaceArea area = (ReplaceArea) selectedMapObject;
area.requirement.required_obj_id = (String) value;
area.requirement.required_obj = null;
if (area.oldSchoolRequirement) {
area.updateNameFromRequirementChange();
skipAreaFieldEvents+=2;
areaField.setText(area.name);
}
}
} else if (source == requirementValue) {
if (selectedMapObject instanceof KeyArea) {
@@ -2021,7 +2068,11 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
stage = quest.getStage(area.requirement.required_value);
if (stage != null) stage.addBacklink(map);
}
if (area.oldSchoolRequirement) area.updateNameFromRequirementChange();
if (area.oldSchoolRequirement) {
area.updateNameFromRequirementChange();
skipAreaFieldEvents+=2;
areaField.setText(area.name);
}
} else if (selectedMapObject instanceof ReplaceArea) {
ReplaceArea area = (ReplaceArea) selectedMapObject;
Quest quest = null;
@@ -2038,17 +2089,29 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
stage = quest.getStage(area.requirement.required_value);
if (stage != null) stage.addBacklink(map);
}
if (area.oldSchoolRequirement) area.updateNameFromRequirementChange();
if (area.oldSchoolRequirement) {
area.updateNameFromRequirementChange();
skipAreaFieldEvents+=2;
areaField.setText(area.name);
}
}
} else if (source == requirementNegated) {
if (selectedMapObject instanceof KeyArea) {
KeyArea area = (KeyArea) selectedMapObject;
area.requirement.negated = (Boolean) value;
if (area.oldSchoolRequirement) area.updateNameFromRequirementChange();
if (area.oldSchoolRequirement) {
area.updateNameFromRequirementChange();
skipAreaFieldEvents+=2;
areaField.setText(area.name);
}
} else if (selectedMapObject instanceof ReplaceArea) {
ReplaceArea area = (ReplaceArea) selectedMapObject;
area.requirement.negated = (Boolean) value;
if (area.oldSchoolRequirement) area.updateNameFromRequirementChange();
if (area.oldSchoolRequirement) {
area.updateNameFromRequirementChange();
skipAreaFieldEvents+=2;
areaField.setText(area.name);
}
}
} else if (source == sourceLayer) {
selectedReplacement.sourceLayer = (String)value;
@@ -2062,9 +2125,9 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
if (modified) {
if (map.state != GameDataElement.State.modified) {
map.state = GameDataElement.State.modified;
map.childrenChanged(new ArrayList<ProjectTreeNode>());
ATContentStudio.frame.editorChanged(TMXMapEditor.this);
}
map.childrenChanged(new ArrayList<ProjectTreeNode>());
}
}
}

View File

@@ -10,14 +10,18 @@ import java.awt.event.FocusListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.geom.Point2D;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.imageio.ImageIO;
import javax.swing.AbstractAction;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JEditorPane;
import javax.swing.JInternalFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
@@ -57,6 +61,9 @@ import prefuse.visual.EdgeItem;
import prefuse.visual.VisualItem;
import prefuse.visual.expression.InGroupPredicate;
import com.gpl.rpg.atcontentstudio.ATContentStudio;
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
import com.gpl.rpg.atcontentstudio.model.ProjectTreeNode;
import com.gpl.rpg.atcontentstudio.model.gamedata.Dialogue;
import com.gpl.rpg.atcontentstudio.model.tools.writermode.WriterModeData;
import com.gpl.rpg.atcontentstudio.model.tools.writermode.WriterModeData.EmptyReply;
@@ -71,8 +78,19 @@ import com.jidesoft.swing.JideBoxLayout;
public class WriterModeEditor extends Editor {
private static final long serialVersionUID = -6591631891278528494L;
private static final String HELP_TEXT =
"<html><body><table>"
+ "<tr><td valign=\"middle\">(Esc.)</td><td valign=\"middle\"> Cancel edition</td></tr>"
+ "<tr><td valign=\"middle\">(Ctrl+Enter)</td><td valign=\"middle\"> Confirm changes</td></tr>"
+ "<tr><td valign=\"middle\">(Shift+Enter)</td><td valign=\"middle\"> Create next of same kind</td></tr>"
+ "<tr><td valign=\"middle\">(Alt+Enter)</td><td valign=\"middle\"> Create next of other kind</td></tr>"
+ "</table></body></html>";
private JComponent overlay = null;
private JComponent helpWindow = null;
private Display view;
final private WriterModeData data;
@@ -87,12 +105,19 @@ public class WriterModeEditor extends Editor {
selected = data.begin;
view = new WriterGraphView();
view.setLocation(0, 0);
setLayout(new BorderLayout());
add(createButtonPane(), BorderLayout.NORTH);
add(view, BorderLayout.CENTER);
}
public void dataAltered() {
data.state = GameDataElement.State.modified;
data.childrenChanged(new ArrayList<ProjectTreeNode>());
ATContentStudio.frame.editorChanged(this);
}
public JPanel createButtonPane() {
JPanel pane = new JPanel();
pane.setLayout(new JideBoxLayout(pane, JideBoxLayout.LINE_AXIS));
@@ -102,6 +127,8 @@ public class WriterModeEditor extends Editor {
@Override
public void actionPerformed(ActionEvent e) {
data.save();
data.childrenChanged(new ArrayList<ProjectTreeNode>());
ATContentStudio.frame.editorChanged(WriterModeEditor.this);
}
});
export.addActionListener(new ActionListener() {
@@ -111,6 +138,8 @@ public class WriterModeEditor extends Editor {
data.getProject().createElements(created);
//data.begin.dialogue.save();
data.save();
data.childrenChanged(new ArrayList<ProjectTreeNode>());
ATContentStudio.frame.editorChanged(WriterModeEditor.this);
}
});
pane.add(save, JideBoxLayout.FIX);
@@ -135,6 +164,22 @@ public class WriterModeEditor extends Editor {
}
private void createHelpWindow() {
JInternalFrame window = new JInternalFrame("Help", true, true);
window.setLayout(new BorderLayout());
JEditorPane area = new JEditorPane();
area.setContentType("text/html");
area.setText(HELP_TEXT);
area.setEditable(false);
window.add(new JScrollPane(area));
window.setSize(350, 250);
window.setLocation(0, 0);
view.add(window);
helpWindow = window;
}
public static final String GRAPH = "graph";
public static final String NODES = "graph.nodes";
public static final String NULL_NODES = "graph.nullNodes";
@@ -587,6 +632,7 @@ public class WriterModeEditor extends Editor {
addEdge(selected, target);
}
}
dataAltered();
}
static final String disposeEditorString = "disposeEditor";
@@ -612,6 +658,7 @@ public class WriterModeEditor extends Editor {
revalidate();
repaint();
disposeOverlay();
dataAltered();
}
};
@@ -654,6 +701,7 @@ public class WriterModeEditor extends Editor {
revalidate();
repaint();
}
dataAltered();
}
};
@@ -695,7 +743,7 @@ public class WriterModeEditor extends Editor {
revalidate();
repaint();
}
dataAltered();
}
};
@@ -721,7 +769,20 @@ public class WriterModeEditor extends Editor {
revalidate();
repaint();
}
dataAltered();
}
};
static final String showHelpString = "showHelp";
final AbstractAction showHelp = new AbstractAction("Show help window") {
private static final long serialVersionUID = 1658086056088672748L;
@Override
public void actionPerformed(ActionEvent e) {
if (helpWindow == null) {
createHelpWindow();
}
helpWindow.setVisible(true);
}
};
@@ -812,6 +873,8 @@ public class WriterModeEditor extends Editor {
area.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, KeyEvent.ALT_DOWN_MASK, true), commitAndCreateNextDefaultNodeString);
area.getActionMap().put(commitAndCreateNextDefaultNodeString, commitAndCreateNextDefaultNode);
area.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0, true), showHelpString);
area.getActionMap().put(showHelpString, showHelp);
if (selected instanceof WriterDialogue) {
area.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, KeyEvent.SHIFT_DOWN_MASK, true), createContinueTalkingNodeString);
@@ -1081,8 +1144,8 @@ public class WriterModeEditor extends Editor {
@Override
public void targetUpdated() {
// TODO Auto-generated method stub
this.icon = new ImageIcon(((GameDataElement)target).getIcon());
this.name = ((GameDataElement)target).getDesc();
}
}

View File

@@ -128,13 +128,13 @@ public class FileUtils {
case Windows:
System.err.println("Trying the Windows way with mklink");
try {
Runtime.getRuntime().exec("cmd.exe /C mklink "+(targetFile.isDirectory() ? "/J " : "")+linkFile.getAbsolutePath()+" "+targetFile.getAbsolutePath());
Runtime.getRuntime().exec("cmd.exe /C mklink "+(targetFile.isDirectory() ? "/J " : "")+"\""+linkFile.getAbsolutePath()+"\" \""+targetFile.getAbsolutePath()+"\"");
} catch (IOException e1) {
e1.printStackTrace();
}
System.err.println("Attempting UAC elevation through VBS script.");
if (!linkFile.exists()) {
runWithUac("cmd.exe /C mklink "+(targetFile.isDirectory() ? "/J " : "")+linkFile.getAbsolutePath()+" "+targetFile.getAbsolutePath(), 3, linkFile);
System.err.println("Attempting UAC elevation through VBS script.");
runWithUac("cmd.exe /C mklink "+(targetFile.isDirectory() ? "/J " : "")+"\""+linkFile.getAbsolutePath()+"\" \""+targetFile.getAbsolutePath()+"\"", 3, linkFile);
}
break;
case MacOS: