mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-10-30 02:26:58 +00:00
Merge branch 'master' of https://github.com/badvision/lawless-legends
This commit is contained in:
commit
395f69f277
@ -110,6 +110,9 @@ public class MapEditor extends Editor<Map, MapEditor.DrawMode> implements EventH
|
||||
case ScriptPencil:
|
||||
drawCanvas.setCursor(Cursor.CLOSED_HAND);
|
||||
break;
|
||||
case ScriptEraser:
|
||||
drawCanvas.setCursor(Cursor.OPEN_HAND);
|
||||
break;
|
||||
default:
|
||||
setCurrentTile(getCurrentTile());
|
||||
break;
|
||||
@ -567,9 +570,14 @@ public class MapEditor extends Editor<Map, MapEditor.DrawMode> implements EventH
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
private boolean hasScriptsAt(int x, int y) {
|
||||
List<Script> scripts = currentMap.getLocationScripts(x, y);
|
||||
return scripts != null && !scripts.isEmpty();
|
||||
}
|
||||
|
||||
public static enum DrawMode {
|
||||
|
||||
Pencil1px, Pencil3px, Pencil5px, FilledRect, TileEraser(false), ScriptPencil(false), Select(false);
|
||||
Pencil1px, Pencil3px, Pencil5px, FilledRect, TileEraser(false), ScriptPencil(false), Select(false), ScriptEraser(false);
|
||||
|
||||
boolean requireTile = false;
|
||||
|
||||
@ -749,6 +757,13 @@ public class MapEditor extends Editor<Map, MapEditor.DrawMode> implements EventH
|
||||
trackState();
|
||||
drawScript(x, y, getSelectedScript());
|
||||
break;
|
||||
case ScriptEraser:
|
||||
if (canSkip || !hasScriptsAt(x, y)) {
|
||||
return;
|
||||
}
|
||||
trackState();
|
||||
drawScript(x, y, null);
|
||||
break;
|
||||
case Select:
|
||||
updateSelection(t.getX(), t.getY());
|
||||
if (t.getEventType().equals(MouseEvent.MOUSE_RELEASED)) {
|
||||
|
@ -84,7 +84,10 @@ public abstract class MapEditorTabController {
|
||||
|
||||
@FXML
|
||||
abstract public void mapScriptPaint(ActionEvent event);
|
||||
|
||||
|
||||
@FXML
|
||||
abstract public void mapScriptErasor(ActionEvent event);
|
||||
|
||||
@FXML
|
||||
abstract public void mapTogglePanZoom(ActionEvent event);
|
||||
|
||||
|
@ -12,12 +12,7 @@ package org.badvision.outlaweditor.ui.impl;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javafx.beans.property.BooleanProperty;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.control.ListCell;
|
||||
import javafx.scene.control.ListView;
|
||||
import javafx.scene.control.Menu;
|
||||
@ -37,7 +32,6 @@ import org.badvision.outlaweditor.api.ApplicationState;
|
||||
import org.badvision.outlaweditor.data.DataUtilities;
|
||||
import static org.badvision.outlaweditor.data.PropertyHelper.bind;
|
||||
import static org.badvision.outlaweditor.data.PropertyHelper.stringProp;
|
||||
import static org.badvision.outlaweditor.data.PropertyHelper.boolProp;
|
||||
import org.badvision.outlaweditor.data.TileUtils;
|
||||
import org.badvision.outlaweditor.data.xml.Map;
|
||||
import org.badvision.outlaweditor.data.xml.Script;
|
||||
@ -101,6 +95,13 @@ public class MapEditorTabControllerImpl extends MapEditorTabController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mapScriptErasor(ActionEvent event) {
|
||||
if (getCurrentEditor() != null) {
|
||||
getCurrentEditor().setDrawMode(MapEditor.DrawMode.ScriptEraser);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mapTogglePanZoom(ActionEvent event) {
|
||||
if (getCurrentEditor() != null) {
|
||||
|
@ -1,10 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import java.lang.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.CheckBox?>
|
||||
<?import javafx.scene.control.ComboBox?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.ListView?>
|
||||
<?import javafx.scene.control.Menu?>
|
||||
<?import javafx.scene.control.MenuButton?>
|
||||
<?import javafx.scene.control.MenuItem?>
|
||||
<?import javafx.scene.control.ScrollPane?>
|
||||
<?import javafx.scene.control.Separator?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.control.ToolBar?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
|
||||
<AnchorPane id="mapsTab" minHeight="0.0" minWidth="0.0" prefHeight="480.0" prefWidth="677.0" stylesheets="@styles/applicationui.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.badvision.outlaweditor.ui.impl.MapEditorTabControllerImpl">
|
||||
<AnchorPane id="mapsTab" minHeight="0.0" minWidth="0.0" prefHeight="480.0" prefWidth="677.0" stylesheets="@styles/applicationui.css" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.badvision.outlaweditor.ui.impl.MapEditorTabControllerImpl">
|
||||
<children>
|
||||
<VBox prefHeight="200.0" prefWidth="100.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
||||
@ -28,6 +40,7 @@
|
||||
<MenuItem mnemonicParsing="false" onAction="#mapDrawFilledRectMode" text="Filled Rectangle" />
|
||||
<MenuItem mnemonicParsing="false" onAction="#mapEraser" text="Tile Eraser" />
|
||||
<MenuItem mnemonicParsing="false" onAction="#mapScriptPaint" text="Script Painter" />
|
||||
<MenuItem mnemonicParsing="false" onAction="#mapScriptErasor" text="Script Eraser" />
|
||||
</items>
|
||||
</Menu>
|
||||
<MenuItem mnemonicParsing="false" onAction="#mapTogglePanZoom" text="Toggle pan/zoom controls" />
|
||||
|
Loading…
Reference in New Issue
Block a user