mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-01-13 03:30:28 +00:00
Added script coloring in the scripts list -- makes it possible to tell what script is associated on the map (yay!)
This commit is contained in:
parent
f0c628016e
commit
41265e8f59
@ -253,7 +253,7 @@ public class MapEditor extends Editor<Map, MapEditor.DrawMode> implements EventH
|
||||
idx = (idx + 1) % scripts.size();
|
||||
gc.beginPath();
|
||||
gc.moveTo(xx,yy);
|
||||
gc.setStroke(currentMap.getScriptColor(scripts.get(idx)));
|
||||
currentMap.getScriptColor(scripts.get(idx)).ifPresent(gc::setStroke);
|
||||
xx += dashLength;
|
||||
gc.lineTo(xx, yy);
|
||||
gc.setEffect(new DropShadow(2, Color.BLACK));
|
||||
@ -263,7 +263,7 @@ public class MapEditor extends Editor<Map, MapEditor.DrawMode> implements EventH
|
||||
idx = (idx + 1) % scripts.size();
|
||||
gc.beginPath();
|
||||
gc.moveTo(xx,yy);
|
||||
gc.setStroke(currentMap.getScriptColor(scripts.get(idx)));
|
||||
currentMap.getScriptColor(scripts.get(idx)).ifPresent(gc::setStroke);
|
||||
yy += dashLength;
|
||||
gc.lineTo(xx, yy);
|
||||
gc.setEffect(new DropShadow(2, Color.BLACK));
|
||||
@ -273,7 +273,7 @@ public class MapEditor extends Editor<Map, MapEditor.DrawMode> implements EventH
|
||||
idx = (idx + 1) % scripts.size();
|
||||
gc.beginPath();
|
||||
gc.moveTo(xx,yy);
|
||||
gc.setStroke(currentMap.getScriptColor(scripts.get(idx)));
|
||||
currentMap.getScriptColor(scripts.get(idx)).ifPresent(gc::setStroke);
|
||||
xx -= dashLength;
|
||||
gc.lineTo(xx, yy);
|
||||
gc.setEffect(new DropShadow(2, Color.BLACK));
|
||||
@ -283,7 +283,7 @@ public class MapEditor extends Editor<Map, MapEditor.DrawMode> implements EventH
|
||||
idx = (idx + 1) % scripts.size();
|
||||
gc.beginPath();
|
||||
gc.moveTo(xx,yy);
|
||||
gc.setStroke(currentMap.getScriptColor(scripts.get(idx)));
|
||||
currentMap.getScriptColor(scripts.get(idx)).ifPresent(gc::setStroke);
|
||||
yy -= dashLength;
|
||||
gc.lineTo(xx, yy);
|
||||
gc.setEffect(new DropShadow(2, Color.BLACK));
|
||||
|
@ -6,6 +6,7 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import javafx.scene.image.WritableImage;
|
||||
import javafx.scene.paint.Color;
|
||||
@ -46,8 +47,8 @@ public class TileMap extends ArrayList<ArrayList<Tile>> implements Serializable
|
||||
private final java.util.Map<Integer, List<Script>> locationScripts = new HashMap<>();
|
||||
private final java.util.Map<Script, Color> scriptColors = new HashMap<>();
|
||||
|
||||
public Color getScriptColor(Script s) {
|
||||
return scriptColors.get(s);
|
||||
public Optional<Color> getScriptColor(Script s) {
|
||||
return Optional.ofNullable(scriptColors.get(s));
|
||||
}
|
||||
|
||||
public List<Script> getLocationScripts(int x, int y) {
|
||||
@ -79,6 +80,7 @@ public class TileMap extends ArrayList<ArrayList<Tile>> implements Serializable
|
||||
locationScripts.put(loc, list);
|
||||
}
|
||||
list.add(s);
|
||||
Application.getInstance().getController().redrawScripts();
|
||||
}
|
||||
|
||||
private int getMortonNumber(int x, int y) {
|
||||
|
@ -306,6 +306,7 @@ public class MapEditorTabControllerImpl extends MapEditorTabController {
|
||||
if (empty || item == null) {
|
||||
setText("");
|
||||
} else {
|
||||
getCurrentEditor().getCurrentMap().getScriptColor(item).ifPresent(this::setTextFill);
|
||||
setText(item.getName());
|
||||
scriptDragDrop.registerDragSupport(this, item);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user