mirror of
https://github.com/AndorsTrailRelease/ATCS.git
synced 2025-10-27 18:44:03 +01:00
v0.6.2 released! Redesigned WorldMap editor. Many new UI features. Fixed
Trainer.
This commit is contained in:
36
.classpath
36
.classpath
@@ -1,18 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="src" path="res"/>
|
<classpathentry kind="src" path="res"/>
|
||||||
<classpathentry kind="src" path="hacked-libtiled"/>
|
<classpathentry kind="src" path="hacked-libtiled"/>
|
||||||
<classpathentry kind="src" path="siphash-zackehh/src/main/java"/>
|
<classpathentry kind="src" path="siphash-zackehh/src/main/java"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="lib" path="lib/jide-oss.jar"/>
|
<classpathentry kind="lib" path="lib/jide-oss.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/json_simple-1.1.jar"/>
|
<classpathentry kind="lib" path="lib/json_simple-1.1.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/junit-4.10.jar"/>
|
<classpathentry kind="lib" path="lib/junit-4.10.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/prefuse.jar"/>
|
<classpathentry kind="lib" path="lib/prefuse.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/rsyntaxtextarea.jar"/>
|
<classpathentry kind="lib" path="lib/rsyntaxtextarea.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/ui.jar"/>
|
<classpathentry kind="lib" path="lib/ui.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/bsh-2.0b4.jar"/>
|
<classpathentry kind="lib" path="lib/bsh-2.0b4.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/AndorsTrainer_v0.1.3.jar"/>
|
<classpathentry kind="lib" path="lib/jsoup-1.10.2.jar" sourcepath="lib/jsoup-1.10.2-sources.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jsoup-1.10.2.jar" sourcepath="lib/jsoup-1.10.2-sources.jar"/>
|
<classpathentry kind="lib" path="lib/AndorsTrainer_v0.1.4.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<jardesc>
|
<jardesc>
|
||||||
<jar path="ATContentStudio/ATCS_v0.6.1.jar"/>
|
<jar path="ATContentStudio/ATCS_v0.6.2.jar"/>
|
||||||
<options buildIfNeeded="true" compress="true" descriptionLocation="/ATContentStudio/ATCS_JAR.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
|
<options buildIfNeeded="true" compress="true" descriptionLocation="/ATContentStudio/ATCS_JAR.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
|
||||||
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
|
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
|
||||||
<selectedProjects/>
|
<selectedProjects/>
|
||||||
|
|||||||
BIN
itemScroll.xcf
Normal file
BIN
itemScroll.xcf
Normal file
Binary file not shown.
Binary file not shown.
BIN
lib/AndorsTrainer_v0.1.4.jar
Normal file
BIN
lib/AndorsTrainer_v0.1.4.jar
Normal file
Binary file not shown.
@@ -1,7 +1,7 @@
|
|||||||
!include MUI2.nsh
|
!include MUI2.nsh
|
||||||
|
|
||||||
!define VERSION "0.6.1"
|
!define VERSION "0.6.2"
|
||||||
!define TRAINER_VERSION "0.1.3"
|
!define TRAINER_VERSION "0.1.4"
|
||||||
!define JAVA_BIN "javaw"
|
!define JAVA_BIN "javaw"
|
||||||
|
|
||||||
Name "Andor's Trail Content Studio v${VERSION}"
|
Name "Andor's Trail Content Studio v${VERSION}"
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import com.gpl.rpg.atcontentstudio.ui.WorkspaceSelector;
|
|||||||
public class ATContentStudio {
|
public class ATContentStudio {
|
||||||
|
|
||||||
public static final String APP_NAME = "Andor's Trail Content Studio";
|
public static final String APP_NAME = "Andor's Trail Content Studio";
|
||||||
public static final String APP_VERSION = "v0.6.1";
|
public static final String APP_VERSION = "v0.6.2";
|
||||||
|
|
||||||
public static boolean STARTED = false;
|
public static boolean STARTED = false;
|
||||||
public static StudioFrame frame = null;
|
public static StudioFrame frame = null;
|
||||||
|
|||||||
BIN
src/com/gpl/rpg/atcontentstudio/img/label.png
Normal file
BIN
src/com/gpl/rpg/atcontentstudio/img/label.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
@@ -32,6 +32,8 @@ public class WorldmapSegment extends GameDataElement {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 2658610076889592723L;
|
private static final long serialVersionUID = 2658610076889592723L;
|
||||||
|
|
||||||
|
public static final String TEMP_LABEL_KEY = "ATCS_INTERNAL_TEMPORARY_KEY_FOR_LABEL";
|
||||||
|
|
||||||
public int segmentX;
|
public int segmentX;
|
||||||
public int segmentY;
|
public int segmentY;
|
||||||
public Map<String, Point> mapLocations = new LinkedHashMap<String, Point>();
|
public Map<String, Point> mapLocations = new LinkedHashMap<String, Point>();
|
||||||
@@ -154,6 +156,7 @@ public class WorldmapSegment extends GameDataElement {
|
|||||||
map.setAttribute("x", Integer.toString(mapLocations.get(s).x + segmentX));
|
map.setAttribute("x", Integer.toString(mapLocations.get(s).x + segmentX));
|
||||||
map.setAttribute("y", Integer.toString(mapLocations.get(s).y + segmentY));
|
map.setAttribute("y", Integer.toString(mapLocations.get(s).y + segmentY));
|
||||||
for (String label : labelledMaps.keySet()) {
|
for (String label : labelledMaps.keySet()) {
|
||||||
|
if (TEMP_LABEL_KEY.equals(label)) continue;
|
||||||
if (labelledMaps.get(label).contains(s)) {
|
if (labelledMaps.get(label).contains(s)) {
|
||||||
map.setAttribute("area", label);
|
map.setAttribute("area", label);
|
||||||
}
|
}
|
||||||
@@ -161,7 +164,9 @@ public class WorldmapSegment extends GameDataElement {
|
|||||||
element.appendChild(map);
|
element.appendChild(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (NamedArea area : labels.values()) {
|
for (String key : labels.keySet()) {
|
||||||
|
if (TEMP_LABEL_KEY.equals(key)) continue;
|
||||||
|
NamedArea area = labels.get(key);
|
||||||
Element namedArea = doc.createElement("namedarea");
|
Element namedArea = doc.createElement("namedarea");
|
||||||
namedArea.setAttribute("id", area.id);
|
namedArea.setAttribute("id", area.id);
|
||||||
namedArea.setAttribute("name", area.name);
|
namedArea.setAttribute("name", area.name);
|
||||||
|
|||||||
@@ -227,6 +227,10 @@ public class DefaultIcons {
|
|||||||
public static Image getCreateTileLayerImage() { return getImage(CREATE_TILE_LAYER_RES); }
|
public static Image getCreateTileLayerImage() { return getImage(CREATE_TILE_LAYER_RES); }
|
||||||
public static Image getCreateTileLayerIcon() { return getIcon(CREATE_TILE_LAYER_RES); }
|
public static Image getCreateTileLayerIcon() { return getIcon(CREATE_TILE_LAYER_RES); }
|
||||||
|
|
||||||
|
private static String LABEL_RES = "/com/gpl/rpg/atcontentstudio/img/label.png";
|
||||||
|
public static Image getLabelImage() { return getImage(LABEL_RES); }
|
||||||
|
public static Image getLabelIcon() { return getIcon(LABEL_RES); }
|
||||||
|
|
||||||
private static String ZOOM_RES = "/com/gpl/rpg/atcontentstudio/img/zoom.png";
|
private static String ZOOM_RES = "/com/gpl/rpg/atcontentstudio/img/zoom.png";
|
||||||
public static Image getZoomImage() { return getImage(ZOOM_RES); }
|
public static Image getZoomImage() { return getImage(ZOOM_RES); }
|
||||||
public static Image getZoomIcon() { return getIcon(ZOOM_RES); }
|
public static Image getZoomIcon() { return getIcon(ZOOM_RES); }
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
|
|||||||
ListModel<TMXMap> currentHighlightListModel = null;
|
ListModel<TMXMap> currentHighlightListModel = null;
|
||||||
|
|
||||||
JList<TMXMap> mapsShown;
|
JList<TMXMap> mapsShown;
|
||||||
|
JList<WorldmapSegment.NamedArea> labelList;
|
||||||
|
|
||||||
JTextField labelIdField;
|
JTextField labelIdField;
|
||||||
JTextField labelNameField;
|
JTextField labelNameField;
|
||||||
@@ -343,9 +344,6 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
|
|||||||
// mapView.selected.add(selectedMap);
|
// mapView.selected.add(selectedMap);
|
||||||
update = true;
|
update = true;
|
||||||
}
|
}
|
||||||
if (e.getClickCount() == 2) {
|
|
||||||
ATContentStudio.frame.openEditor(worldmap.getProject().getMap(selectedMap));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (editMode == EditMode.addMap && mapBeingAddedID != null) {
|
} else if (editMode == EditMode.addMap && mapBeingAddedID != null) {
|
||||||
if (e.getButton() == MouseEvent.BUTTON1) {
|
if (e.getButton() == MouseEvent.BUTTON1) {
|
||||||
@@ -440,6 +438,26 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
|
|||||||
mapView.addMouseListener(mouseListener);
|
mapView.addMouseListener(mouseListener);
|
||||||
mapView.addMouseMotionListener(mouseListener);
|
mapView.addMouseMotionListener(mouseListener);
|
||||||
|
|
||||||
|
mapView.addMapClickListener(new WorldMapView.MapClickListener() {
|
||||||
|
@Override
|
||||||
|
public void mapClicked(MouseEvent e, TMXMap m) {
|
||||||
|
if (e.getClickCount() == 2) {
|
||||||
|
ATContentStudio.frame.openEditor(m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mapChangeClicked(MouseEvent e, TMXMap m, TMXMap changeTarget) {
|
||||||
|
if (e.getClickCount() == 2) {
|
||||||
|
ATContentStudio.frame.openEditor(changeTarget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void backgroundClicked(MouseEvent e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return pane;
|
return pane;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -496,13 +514,18 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
|
|||||||
labelEditPane.add(new JLabel("Labels on the worldmap"), JideBoxLayout.FIX);
|
labelEditPane.add(new JLabel("Labels on the worldmap"), JideBoxLayout.FIX);
|
||||||
|
|
||||||
mslListModel = new MapSegmentLabelsListModel(worldmap);
|
mslListModel = new MapSegmentLabelsListModel(worldmap);
|
||||||
final JList<WorldmapSegment.NamedArea> labelList = new JList<WorldmapSegment.NamedArea>(mslListModel);
|
labelList = new JList<WorldmapSegment.NamedArea>(mslListModel);
|
||||||
labelList.setCellRenderer(new MapLabelCellRenderer());
|
labelList.setCellRenderer(new MapLabelCellRenderer());
|
||||||
labelList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
labelList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||||
labelEditPane.add(new JScrollPane(labelList), JideBoxLayout.FLEXIBLE);
|
labelEditPane.add(new JScrollPane(labelList), JideBoxLayout.FLEXIBLE);
|
||||||
|
|
||||||
JPanel labelListButtonsPane = new JPanel();
|
JPanel labelListButtonsPane = new JPanel();
|
||||||
//TODO Add the buttons
|
labelListButtonsPane.setLayout(new JideBoxLayout(labelListButtonsPane, JideBoxLayout.LINE_AXIS));
|
||||||
|
final JButton createLabel = new JButton(new ImageIcon(DefaultIcons.getCreateIcon()));
|
||||||
|
labelListButtonsPane.add(createLabel, JideBoxLayout.FIX);
|
||||||
|
final JButton deleteLabel = new JButton(new ImageIcon(DefaultIcons.getNullifyIcon()));
|
||||||
|
labelListButtonsPane.add(deleteLabel, JideBoxLayout.FIX);
|
||||||
|
labelListButtonsPane.add(new JPanel(), JideBoxLayout.VARY);
|
||||||
labelEditPane.add(labelListButtonsPane, JideBoxLayout.FIX);
|
labelEditPane.add(labelListButtonsPane, JideBoxLayout.FIX);
|
||||||
|
|
||||||
final JPanel labelParametersPane = new JPanel();
|
final JPanel labelParametersPane = new JPanel();
|
||||||
@@ -511,15 +534,39 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
|
|||||||
labelList.addListSelectionListener(new ListSelectionListener() {
|
labelList.addListSelectionListener(new ListSelectionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void valueChanged(ListSelectionEvent e) {
|
public void valueChanged(ListSelectionEvent e) {
|
||||||
if (labelList.getSelectedValue() != null) {
|
selectedLabel = labelList.getSelectedValue();
|
||||||
selectedLabel = labelList.getSelectedValue();
|
updateLabelParamsPane(labelParametersPane, worldmap);
|
||||||
updateLabelParamsPane(labelParametersPane, worldmap);
|
labelEditPane.revalidate();
|
||||||
labelEditPane.revalidate();
|
labelEditPane.repaint();
|
||||||
labelEditPane.repaint();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
createLabel.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
WorldmapSegment.NamedArea creation = new WorldmapSegment.NamedArea(null, null, null);
|
||||||
|
worldmap.labels.put(WorldmapSegment.TEMP_LABEL_KEY, creation);
|
||||||
|
worldmap.labelledMaps.put(WorldmapSegment.TEMP_LABEL_KEY, new ArrayList<String>());
|
||||||
|
mslListModel.listChanged();
|
||||||
|
labelList.setSelectedValue(creation, true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
deleteLabel.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
if (selectedLabel.id != null) {
|
||||||
|
worldmap.labelledMaps.remove(selectedLabel.id);
|
||||||
|
worldmap.labels.remove(selectedLabel.id);
|
||||||
|
} else {
|
||||||
|
worldmap.labelledMaps.remove(WorldmapSegment.TEMP_LABEL_KEY);
|
||||||
|
worldmap.labels.remove(WorldmapSegment.TEMP_LABEL_KEY);
|
||||||
|
}
|
||||||
|
labelList.clearSelection();
|
||||||
|
mslListModel.listChanged();
|
||||||
|
notifyModelModified();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
tabPane.addTab("Labels", labelEditPane);
|
tabPane.addTab("Labels", labelEditPane);
|
||||||
@@ -530,6 +577,10 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
|
|||||||
|
|
||||||
private void updateLabelParamsPane(JPanel labelParametersPane, final WorldmapSegment worldmap) {
|
private void updateLabelParamsPane(JPanel labelParametersPane, final WorldmapSegment worldmap) {
|
||||||
labelParametersPane.removeAll();
|
labelParametersPane.removeAll();
|
||||||
|
if (selectedLabel == null) {
|
||||||
|
setCurrentHighlightModel(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
labelParametersPane.setLayout(new JideBoxLayout(labelParametersPane, JideBoxLayout.PAGE_AXIS));
|
labelParametersPane.setLayout(new JideBoxLayout(labelParametersPane, JideBoxLayout.PAGE_AXIS));
|
||||||
|
|
||||||
labelIdField = addTextField(labelParametersPane, "Internal ID: ", selectedLabel.id, worldmap.writable, this);
|
labelIdField = addTextField(labelParametersPane, "Internal ID: ", selectedLabel.id, worldmap.writable, this);
|
||||||
@@ -553,7 +604,7 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
|
|||||||
});
|
});
|
||||||
|
|
||||||
JPanel labelCoverageButtonsPane = new JPanel();
|
JPanel labelCoverageButtonsPane = new JPanel();
|
||||||
//TODO Add the buttons.
|
labelCoverageButtonsPane.setLayout(new JideBoxLayout(labelCoverageButtonsPane, JideBoxLayout.LINE_AXIS));
|
||||||
JButton addCoverage = new JButton("Add on-map selection");
|
JButton addCoverage = new JButton("Add on-map selection");
|
||||||
labelCoverageButtonsPane.add(addCoverage, JideBoxLayout.FIX);
|
labelCoverageButtonsPane.add(addCoverage, JideBoxLayout.FIX);
|
||||||
JButton replaceCoverage = new JButton("Replace by on-map selection");
|
JButton replaceCoverage = new JButton("Replace by on-map selection");
|
||||||
@@ -565,11 +616,14 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
|
|||||||
addCoverage.addActionListener(new ActionListener() {
|
addCoverage.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (selectedLabel == null || selectedLabel.id == null) return;
|
if (selectedLabel == null) return;
|
||||||
List<String> currentCoverage = worldmap.labelledMaps.get(selectedLabel.id);
|
String labelId = selectedLabel.id;
|
||||||
|
if (labelId == null) labelId = WorldmapSegment.TEMP_LABEL_KEY;
|
||||||
|
|
||||||
|
List<String> currentCoverage = worldmap.labelledMaps.get(labelId);
|
||||||
if (currentCoverage == null) {
|
if (currentCoverage == null) {
|
||||||
worldmap.labelledMaps.put(selectedLabel.id, new ArrayList<String>());
|
worldmap.labelledMaps.put(labelId, new ArrayList<String>());
|
||||||
currentCoverage = worldmap.labelledMaps.get(selectedLabel.id);
|
currentCoverage = worldmap.labelledMaps.get(labelId);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < msmListModel.getSize(); i++) {
|
for (int i = 0; i < msmListModel.getSize(); i++) {
|
||||||
if (msmListSelectionModel.isSelectedIndex(i)) {
|
if (msmListSelectionModel.isSelectedIndex(i)) {
|
||||||
@@ -586,11 +640,14 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
|
|||||||
replaceCoverage.addActionListener(new ActionListener() {
|
replaceCoverage.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (selectedLabel == null || selectedLabel.id == null) return;
|
if (selectedLabel == null) return;
|
||||||
List<String> currentCoverage = worldmap.labelledMaps.get(selectedLabel.id);
|
String labelId = selectedLabel.id;
|
||||||
|
if (labelId == null) labelId = WorldmapSegment.TEMP_LABEL_KEY;
|
||||||
|
|
||||||
|
List<String> currentCoverage = worldmap.labelledMaps.get(labelId);
|
||||||
if (currentCoverage == null) {
|
if (currentCoverage == null) {
|
||||||
worldmap.labelledMaps.put(selectedLabel.id, new ArrayList<String>());
|
worldmap.labelledMaps.put(labelId, new ArrayList<String>());
|
||||||
currentCoverage = worldmap.labelledMaps.get(selectedLabel.id);
|
currentCoverage = worldmap.labelledMaps.get(labelId);
|
||||||
} else {
|
} else {
|
||||||
currentCoverage.clear();
|
currentCoverage.clear();
|
||||||
}
|
}
|
||||||
@@ -609,16 +666,21 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
|
|||||||
removeFromCoverage.addActionListener(new ActionListener() {
|
removeFromCoverage.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (selectedLabel == null || selectedLabel.id == null) return;
|
if (selectedLabel == null) return;
|
||||||
List<String> currentCoverage = worldmap.labelledMaps.get(selectedLabel.id);
|
String labelId = selectedLabel.id;
|
||||||
|
if (labelId == null) labelId = WorldmapSegment.TEMP_LABEL_KEY;
|
||||||
|
|
||||||
|
List<String> currentCoverage = worldmap.labelledMaps.get(labelId);
|
||||||
if (currentCoverage == null) return;
|
if (currentCoverage == null) return;
|
||||||
|
List<String> toRemove = new ArrayList<String>();
|
||||||
for (int i = 0; i < mslmListModel.getSize(); i++) {
|
for (int i = 0; i < mslmListModel.getSize(); i++) {
|
||||||
if (mslmListSelectionModel.isSelectedIndex(i)) {
|
if (mslmListSelectionModel.isSelectedIndex(i)) {
|
||||||
if (currentCoverage.contains(mslmListModel.getElementAt(i).id)) {
|
if (currentCoverage.contains(mslmListModel.getElementAt(i).id)) {
|
||||||
currentCoverage.remove(mslmListModel.getElementAt(i).id);
|
toRemove.add(mslmListModel.getElementAt(i).id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
currentCoverage.removeAll(toRemove);
|
||||||
mslmListModel.listChanged();
|
mslmListModel.listChanged();
|
||||||
repaintMap();
|
repaintMap();
|
||||||
}
|
}
|
||||||
@@ -679,11 +741,13 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
|
if (area.id == null) return segment.labelledMaps.get(WorldmapSegment.TEMP_LABEL_KEY).size();
|
||||||
return segment.labelledMaps.get(area.id).size();
|
return segment.labelledMaps.get(area.id).size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TMXMap getElementAt(int index) {
|
public TMXMap getElementAt(int index) {
|
||||||
|
if (area.id == null) return segment.getProject().getMap(segment.labelledMaps.get(WorldmapSegment.TEMP_LABEL_KEY).get(index));
|
||||||
return segment.getProject().getMap(segment.labelledMaps.get(area.id).get(index));
|
return segment.getProject().getMap(segment.labelledMaps.get(area.id).get(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -790,7 +854,13 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
|
|||||||
label.setText("None");
|
label.setText("None");
|
||||||
} else {
|
} else {
|
||||||
WorldmapSegment.NamedArea area = (WorldmapSegment.NamedArea) value;
|
WorldmapSegment.NamedArea area = (WorldmapSegment.NamedArea) value;
|
||||||
label.setText(area.name+" ("+area.id+")");
|
if (area.id != null) {
|
||||||
|
label.setText(area.name+" ("+area.id+")");
|
||||||
|
label.setIcon(new ImageIcon(DefaultIcons.getLabelIcon()));
|
||||||
|
} else {
|
||||||
|
label.setText("Incomplete Label. Enter an ID.");
|
||||||
|
label.setIcon(new ImageIcon(DefaultIcons.getNullifyIcon()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
@@ -1012,12 +1082,20 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
|
|||||||
WorldmapSegment worldmap = (WorldmapSegment)target;
|
WorldmapSegment worldmap = (WorldmapSegment)target;
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
if (source == labelIdField) {
|
if (source == labelIdField) {
|
||||||
List<String> coverage = worldmap.labelledMaps.get(selectedLabel.id);
|
List<String> coverage;
|
||||||
worldmap.labelledMaps.remove(selectedLabel.id);
|
if (selectedLabel.id != null) {
|
||||||
worldmap.labels.remove(selectedLabel.id);
|
coverage = worldmap.labelledMaps.get(selectedLabel.id);
|
||||||
|
worldmap.labelledMaps.remove(selectedLabel.id);
|
||||||
|
worldmap.labels.remove(selectedLabel.id);
|
||||||
|
} else {
|
||||||
|
coverage = worldmap.labelledMaps.get(WorldmapSegment.TEMP_LABEL_KEY);
|
||||||
|
worldmap.labels.remove(WorldmapSegment.TEMP_LABEL_KEY);
|
||||||
|
}
|
||||||
selectedLabel.id = (String) value;
|
selectedLabel.id = (String) value;
|
||||||
worldmap.labelledMaps.put(selectedLabel.id, coverage);
|
if (value != null) {
|
||||||
worldmap.labels.put(selectedLabel.id, selectedLabel);
|
worldmap.labelledMaps.put(selectedLabel.id, coverage);
|
||||||
|
worldmap.labels.put(selectedLabel.id, selectedLabel);
|
||||||
|
}
|
||||||
mslListModel.listChanged();
|
mslListModel.listChanged();
|
||||||
changed = true;
|
changed = true;
|
||||||
} else if (source == labelNameField) {
|
} else if (source == labelNameField) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.awt.Font;
|
|||||||
import java.awt.FontMetrics;
|
import java.awt.FontMetrics;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Image;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.RenderingHints;
|
import java.awt.RenderingHints;
|
||||||
@@ -29,11 +30,15 @@ import javax.swing.JComponent;
|
|||||||
import javax.swing.ListModel;
|
import javax.swing.ListModel;
|
||||||
import javax.swing.ListSelectionModel;
|
import javax.swing.ListSelectionModel;
|
||||||
import javax.swing.Scrollable;
|
import javax.swing.Scrollable;
|
||||||
|
import javax.swing.ToolTipManager;
|
||||||
|
|
||||||
import tiled.view.MapRenderer;
|
import tiled.view.MapRenderer;
|
||||||
import tiled.view.OrthogonalRenderer;
|
import tiled.view.OrthogonalRenderer;
|
||||||
|
|
||||||
import com.gpl.rpg.atcontentstudio.model.Project;
|
import com.gpl.rpg.atcontentstudio.model.Project;
|
||||||
|
import com.gpl.rpg.atcontentstudio.model.maps.MapChange;
|
||||||
|
import com.gpl.rpg.atcontentstudio.model.maps.MapObject;
|
||||||
|
import com.gpl.rpg.atcontentstudio.model.maps.MapObjectGroup;
|
||||||
import com.gpl.rpg.atcontentstudio.model.maps.TMXMap;
|
import com.gpl.rpg.atcontentstudio.model.maps.TMXMap;
|
||||||
import com.gpl.rpg.atcontentstudio.model.maps.WorldmapSegment;
|
import com.gpl.rpg.atcontentstudio.model.maps.WorldmapSegment;
|
||||||
|
|
||||||
@@ -91,12 +96,82 @@ public class WorldMapView extends JComponent implements Scrollable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (selectedMap != null) {
|
if (selectedMap != null) {
|
||||||
mapClicked(e, WorldMapView.this.worldmap.getProject().getMap(selectedMap));
|
x = x - mapLocations.get(selectedMap).x;
|
||||||
|
y = y - mapLocations.get(selectedMap).y;
|
||||||
|
//Look for a mapchange there
|
||||||
|
TMXMap map = proj.getMap(selectedMap);
|
||||||
|
|
||||||
|
boolean mapchangeFound = false;
|
||||||
|
for (MapObjectGroup group : map.groups) {
|
||||||
|
for (MapObject obj : group.mapObjects) {
|
||||||
|
if (obj instanceof MapChange) {
|
||||||
|
if (x >= obj.x && x < obj.x + obj.w && y >= obj.y && y < obj.y + obj.h) {
|
||||||
|
String mapId = ((MapChange)obj).map != null ? ((MapChange)obj).map.id : ((MapChange)obj).map_id;
|
||||||
|
mapChangeClicked(e, proj.getMap(selectedMap), proj.getMap(mapId));
|
||||||
|
mapchangeFound = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mapchangeFound) {
|
||||||
|
mapClicked(e, WorldMapView.this.worldmap.getProject().getMap(selectedMap));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
backgroundClicked(e);
|
backgroundClicked(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
addMouseMotionListener(new MouseAdapter() {
|
||||||
|
@Override
|
||||||
|
public void mouseMoved(MouseEvent e) {
|
||||||
|
String selectedMap = null;
|
||||||
|
int x = (int) (e.getX() / zoomLevel);
|
||||||
|
int y = (int) (e.getY() / zoomLevel);
|
||||||
|
for (String s : mapLocations.keySet()) {
|
||||||
|
if (mapLocations.get(s).contains(x, y)) {
|
||||||
|
selectedMap = s;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (selectedMap != null) {
|
||||||
|
//Reuse x,y to indicate to tile-within-the-map coordinates.
|
||||||
|
x = x - mapLocations.get(selectedMap).x;
|
||||||
|
y = y - mapLocations.get(selectedMap).y;
|
||||||
|
//Look for a mapchange there
|
||||||
|
TMXMap map = proj.getMap(selectedMap);
|
||||||
|
|
||||||
|
boolean mapchangeFound = false;
|
||||||
|
for (MapObjectGroup group : map.groups) {
|
||||||
|
for (MapObject obj : group.mapObjects) {
|
||||||
|
if (obj instanceof MapChange) {
|
||||||
|
if (x >= obj.x && x < obj.x + obj.w && y >= obj.y && y < obj.y + obj.h) {
|
||||||
|
String mapId = ((MapChange)obj).map != null ? ((MapChange)obj).map.id : ((MapChange)obj).map_id;
|
||||||
|
setToolTipText(selectedMap+"->"+mapId);
|
||||||
|
mapchangeFound = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mapchangeFound) {
|
||||||
|
setToolTipText(selectedMap);
|
||||||
|
}
|
||||||
|
ToolTipManager.sharedInstance().registerComponent(WorldMapView.this);
|
||||||
|
ToolTipManager.sharedInstance().setEnabled(true);
|
||||||
|
} else {
|
||||||
|
ToolTipManager.sharedInstance().setEnabled(false);
|
||||||
|
ToolTipManager.sharedInstance().unregisterComponent(WorldMapView.this);
|
||||||
|
setToolTipText(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Point getToolTipLocation(MouseEvent event) {
|
||||||
|
return event.getPoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void paintOnGraphics(Graphics2D g2) {
|
private void paintOnGraphics(Graphics2D g2) {
|
||||||
@@ -133,8 +208,8 @@ public class WorldMapView extends JComponent implements Scrollable {
|
|||||||
if (layer instanceof tiled.core.TileLayer && layer.isVisible()) {
|
if (layer instanceof tiled.core.TileLayer && layer.isVisible()) {
|
||||||
if (layer.getName().equalsIgnoreCase("walkable")) continue;
|
if (layer.getName().equalsIgnoreCase("walkable")) continue;
|
||||||
renderer.paintTileLayer(g2, (tiled.core.TileLayer) layer);
|
renderer.paintTileLayer(g2, (tiled.core.TileLayer) layer);
|
||||||
} else if (layer instanceof tiled.core.ObjectGroup && layer.isVisible()) {
|
} else if (layer instanceof tiled.core.ObjectGroup) {
|
||||||
// paintObjectGroup(g2, map, (tiled.core.ObjectGroup) layer);
|
paintObjectGroup(g2, map, (tiled.core.ObjectGroup) layer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (map.colorFilter != null) {
|
if (map.colorFilter != null) {
|
||||||
@@ -165,20 +240,58 @@ public class WorldMapView extends JComponent implements Scrollable {
|
|||||||
|
|
||||||
for (String s : worldmap.labels.keySet()) {
|
for (String s : worldmap.labels.keySet()) {
|
||||||
String label = worldmap.labels.get(s).name;
|
String label = worldmap.labels.get(s).name;
|
||||||
Rectangle areaCovered = new Rectangle(0, 0, -1, -1);
|
if (label != null) {
|
||||||
for (String map : worldmap.labelledMaps.get(s)) {
|
Rectangle areaCovered = new Rectangle(0, 0, -1, -1);
|
||||||
areaCovered.add(mapLocations.get(map));
|
for (String map : worldmap.labelledMaps.get(s)) {
|
||||||
|
areaCovered.add(mapLocations.get(map));
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle2D stringBounds = fm.getStringBounds(label, g2);
|
||||||
|
GlyphVector gv = areaNameFont.createGlyphVector(frc, label);
|
||||||
|
g2.setColor(Color.WHITE);
|
||||||
|
g2.fill(gv.getOutline((int)(areaCovered.getCenterX() - stringBounds.getCenterX()), (int)(areaCovered.getCenterY() - stringBounds.getCenterY())));
|
||||||
|
g2.setColor(Color.BLACK);
|
||||||
|
g2.draw(gv.getOutline((int)(areaCovered.getCenterX() - stringBounds.getCenterX()), (int)(areaCovered.getCenterY() - stringBounds.getCenterY())));
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle2D stringBounds = fm.getStringBounds(label, g2);
|
|
||||||
GlyphVector gv = areaNameFont.createGlyphVector(frc, label);
|
|
||||||
g2.setColor(Color.WHITE);
|
|
||||||
g2.fill(gv.getOutline((int)(areaCovered.getCenterX() - stringBounds.getCenterX()), (int)(areaCovered.getCenterY() - stringBounds.getCenterY())));
|
|
||||||
g2.setColor(Color.BLACK);
|
|
||||||
g2.draw(gv.getOutline((int)(areaCovered.getCenterX() - stringBounds.getCenterX()), (int)(areaCovered.getCenterY() - stringBounds.getCenterY())));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void paintObjectGroup(Graphics2D g2d, TMXMap map, tiled.core.ObjectGroup layer) {
|
||||||
|
for (MapObjectGroup group : map.groups) {
|
||||||
|
if (group.tmxGroup == layer) {
|
||||||
|
for (MapObject object : group.mapObjects) {
|
||||||
|
if (object instanceof MapChange) {
|
||||||
|
// Only show mapchange areas pointing to maps not shown in this worldmap
|
||||||
|
if (((MapChange)object).map != null && !mapLocations.containsKey(((MapChange)object).map.id)) {
|
||||||
|
drawObject(object, g2d, new Color(20, 20, 190));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawObject(MapObject object, Graphics2D g2d, Color color) {
|
||||||
|
g2d.setPaint(color);
|
||||||
|
g2d.drawRect(object.x+1, object.y+1, object.w-3, object.h-3);
|
||||||
|
g2d.drawRect(object.x+2, object.y+2, object.w-5, object.h-5);
|
||||||
|
g2d.setPaint(color.darker().darker());
|
||||||
|
g2d.drawLine(object.x, object.y + object.h - 1, object.x + object.w - 1, object.y + object.h - 1);
|
||||||
|
g2d.drawLine(object.x + object.w - 1, object.y, object.x + object.w - 1, object.y + object.h - 1);
|
||||||
|
g2d.drawLine(object.x + 3, object.y + 3, object.x + object.w - 4, object.y + 3);
|
||||||
|
g2d.drawLine(object.x + 3, object.y + 3, object.x + 3, object.y + object.h - 4);
|
||||||
|
g2d.setPaint(color.brighter().brighter().brighter());
|
||||||
|
g2d.drawLine(object.x, object.y, object.x + object.w - 1, object.y);
|
||||||
|
g2d.drawLine(object.x, object.y, object.x, object.y + object.h - 1);
|
||||||
|
g2d.drawLine(object.x + 3, object.y + object.h - 4, object.x + object.w - 4, object.y + object.h - 4);
|
||||||
|
g2d.drawLine(object.x + object.w - 4, object.y + 3, object.x + object.w - 4, object.y + object.h - 4);
|
||||||
|
Image img = object.getIcon();
|
||||||
|
g2d.setColor(new Color(255, 255, 255, 120));
|
||||||
|
g2d.fillRect(object.x + 2, object.y + 2, img.getWidth(null), img.getHeight(null));
|
||||||
|
g2d.drawImage(object.getIcon(), object.x + 2, object.y + 2, null);
|
||||||
|
}
|
||||||
|
|
||||||
private void outlineFromListModel(Graphics2D g2, ListModel<TMXMap> listModel, ListSelectionModel selectionModel, Color outlineColor, Stroke outlineStroke, Font mapIdFont, int mapIdLabelHeight) {
|
private void outlineFromListModel(Graphics2D g2, ListModel<TMXMap> listModel, ListSelectionModel selectionModel, Color outlineColor, Stroke outlineStroke, Font mapIdFont, int mapIdLabelHeight) {
|
||||||
for (int i =0; i<listModel.getSize(); i++) {
|
for (int i =0; i<listModel.getSize(); i++) {
|
||||||
//No selection model ? We want to highlight the whole list.
|
//No selection model ? We want to highlight the whole list.
|
||||||
@@ -235,6 +348,7 @@ public class WorldMapView extends JComponent implements Scrollable {
|
|||||||
|
|
||||||
public interface MapClickListener {
|
public interface MapClickListener {
|
||||||
public void mapClicked(MouseEvent e, TMXMap m);
|
public void mapClicked(MouseEvent e, TMXMap m);
|
||||||
|
public void mapChangeClicked(MouseEvent e, TMXMap m, TMXMap changeTarget);
|
||||||
public void backgroundClicked(MouseEvent e);
|
public void backgroundClicked(MouseEvent e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,6 +366,10 @@ public class WorldMapView extends JComponent implements Scrollable {
|
|||||||
for (MapClickListener l : listeners) l.mapClicked(e, m);
|
for (MapClickListener l : listeners) l.mapClicked(e, m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void mapChangeClicked(MouseEvent e, TMXMap m, TMXMap changeTarget) {
|
||||||
|
for (MapClickListener l : listeners) l.mapChangeClicked(e, m, changeTarget);
|
||||||
|
}
|
||||||
|
|
||||||
private void backgroundClicked(MouseEvent e) {
|
private void backgroundClicked(MouseEvent e) {
|
||||||
for (MapClickListener l : listeners) l.backgroundClicked(e);
|
for (MapClickListener l : listeners) l.backgroundClicked(e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user