mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-10-11 18:23:48 +00:00
FIXED OLE-12 -- Map script deletion has been implemented with confirmation. Same confirmation propmpt has been added to global script deletion as well.
This commit is contained in:
parent
994205c842
commit
671de1257c
@ -460,6 +460,11 @@ public class MapEditor extends Editor<Map, MapEditor.DrawMode> implements EventH
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeScript(Script script) {
|
||||||
|
getCurrentMap().removeScriptFromMap(script);
|
||||||
|
redraw();
|
||||||
|
}
|
||||||
|
|
||||||
public static enum DrawMode {
|
public static enum DrawMode {
|
||||||
|
|
||||||
Pencil1px, Pencil3px, Pencil5px, FilledRect, Eraser
|
Pencil1px, Pencil3px, Pencil5px, FilledRect, Eraser
|
||||||
|
@ -213,4 +213,12 @@ public class TileMap extends ArrayList<ArrayList<Tile>> implements Serializable
|
|||||||
public static boolean isNullTile(String tileId) {
|
public static boolean isNullTile(String tileId) {
|
||||||
return tileId.equalsIgnoreCase(NULL_TILE_ID);
|
return tileId.equalsIgnoreCase(NULL_TILE_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeScriptFromMap(Script script) {
|
||||||
|
script.getLocationTrigger().clear();
|
||||||
|
locationScripts.values().stream().filter((scripts) -> !(scripts == null)).forEach((scripts) -> {
|
||||||
|
scripts.remove(script);
|
||||||
|
});
|
||||||
|
backingMap.getScripts().getScript().remove(script);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,14 @@ public class GlobalEditorTabControllerImpl extends GlobalEditorTabController {
|
|||||||
protected void onScriptDeletePressed(ActionEvent event) {
|
protected void onScriptDeletePressed(ActionEvent event) {
|
||||||
Script script = globalScriptList.getSelectionModel().getSelectedItem();
|
Script script = globalScriptList.getSelectionModel().getSelectedItem();
|
||||||
if (script != null) {
|
if (script != null) {
|
||||||
|
UIAction.confirm(
|
||||||
|
"Are you sure you want to delete the script "
|
||||||
|
+ script.getName()
|
||||||
|
+ "? There is no undo for this!",
|
||||||
|
() -> {
|
||||||
getCurrentEditor().removeScript(script);
|
getCurrentEditor().removeScript(script);
|
||||||
redrawGlobalScripts();
|
redrawGlobalScripts();
|
||||||
|
}, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +195,18 @@ public class MapEditorTabControllerImpl extends MapEditorTabController {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMapScriptDeletePressed(ActionEvent event) {
|
public void onMapScriptDeletePressed(ActionEvent event) {
|
||||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
Script script = mapScriptsList.getSelectionModel().getSelectedItem();
|
||||||
|
if (script != null) {
|
||||||
|
UIAction.confirm(
|
||||||
|
"Are you sure you want to delete the script "
|
||||||
|
+ script.getName()
|
||||||
|
+ "? There is no undo for this!",
|
||||||
|
() -> {
|
||||||
|
getCurrentEditor().removeScript(script);
|
||||||
|
redrawMapScripts();
|
||||||
|
},
|
||||||
|
null);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -288,8 +299,10 @@ public class MapEditorTabControllerImpl extends MapEditorTabController {
|
|||||||
bind(mapNameField.textProperty(), stringProp(m, "name"));
|
bind(mapNameField.textProperty(), stringProp(m, "name"));
|
||||||
// bind(mapWidthField.textProperty(), intProp(m, "width"));
|
// bind(mapWidthField.textProperty(), intProp(m, "width"));
|
||||||
// bind(mapWrapAround.selectedProperty(),boolProp(m, "wrap"));
|
// bind(mapWrapAround.selectedProperty(),boolProp(m, "wrap"));
|
||||||
|
|
||||||
} catch (NoSuchMethodException ex) {
|
} catch (NoSuchMethodException ex) {
|
||||||
Logger.getLogger(ApplicationUIControllerImpl.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(ApplicationUIControllerImpl.class
|
||||||
|
.getName()).log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
MapEditor e = new MapEditor();
|
MapEditor e = new MapEditor();
|
||||||
e.setEntity(m);
|
e.setEntity(m);
|
||||||
|
Loading…
Reference in New Issue
Block a user