This commit is contained in:
@@ -18,14 +18,13 @@
|
||||
|
||||
package games.rednblack.editor.plugin.tiled;
|
||||
|
||||
import org.puremvc.java.interfaces.IFacade;
|
||||
|
||||
import com.badlogic.ashley.core.Engine;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.kotcrab.vis.ui.VisUI;
|
||||
import com.kotcrab.vis.ui.widget.VisLabel;
|
||||
import com.kotcrab.vis.ui.widget.VisTable;
|
||||
import com.kotcrab.vis.ui.widget.VisTextButton;
|
||||
|
||||
import games.rednblack.editor.plugin.tiled.data.TileVO;
|
||||
import games.rednblack.editor.plugin.tiled.manager.ResourcesManager;
|
||||
import games.rednblack.editor.plugin.tiled.view.tabs.GridTilesTab;
|
||||
@@ -34,7 +33,6 @@ import games.rednblack.h2d.common.UIDraggablePanel;
|
||||
import games.rednblack.h2d.common.view.ui.widget.imagetabbedpane.ImageTab;
|
||||
import games.rednblack.h2d.common.view.ui.widget.imagetabbedpane.ImageTabbedPane;
|
||||
import games.rednblack.h2d.common.view.ui.widget.imagetabbedpane.ImageTabbedPaneListener;
|
||||
import org.puremvc.java.interfaces.IFacade;
|
||||
|
||||
/**
|
||||
* Created by mariam on 2/2/2016.
|
||||
@@ -171,6 +169,12 @@ public class TiledPanel extends UIDraggablePanel {
|
||||
reInitTabTable();
|
||||
tilesTab.scrollTiles();
|
||||
}
|
||||
|
||||
public void removeAllTiles() {
|
||||
tilesTab.removeAllTiles();
|
||||
reInitTabTable();
|
||||
tilesTab.scrollTiles();
|
||||
}
|
||||
|
||||
private void initTabs() {
|
||||
tilesTab = new GridTilesTab(this, 0);
|
||||
|
||||
+22
-1
@@ -29,6 +29,8 @@ import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop;
|
||||
import com.kotcrab.vis.ui.util.dialog.Dialogs;
|
||||
import com.kotcrab.vis.ui.util.dialog.OptionDialogAdapter;
|
||||
|
||||
import games.rednblack.editor.plugin.tiled.data.TileVO;
|
||||
import games.rednblack.editor.plugin.tiled.tools.DeleteTileTool;
|
||||
@@ -65,6 +67,7 @@ public class TiledPanelMediator extends Mediator<TiledPanel> {
|
||||
TiledPlugin.TILE_ADDED,
|
||||
TiledPlugin.TILE_SELECTED,
|
||||
TiledPlugin.ACTION_DELETE_TILE,
|
||||
TiledPlugin.ACTION_DELETE_TILE_ALL,
|
||||
TiledPlugin.ACTION_SET_GRID_SIZE_FROM_LIST,
|
||||
TiledPlugin.ACTION_SET_OFFSET,
|
||||
TiledPlugin.OPEN_DROP_DOWN,
|
||||
@@ -142,6 +145,7 @@ public class TiledPanelMediator extends Mediator<TiledPanel> {
|
||||
HashMap<String, String> actionsSet = new HashMap<>();
|
||||
actionsSet.put(TiledPlugin.ACTION_SET_GRID_SIZE_FROM_LIST, "Set grid size");
|
||||
actionsSet.put(TiledPlugin.ACTION_DELETE_TILE, "Delete");
|
||||
actionsSet.put(TiledPlugin.ACTION_DELETE_TILE_ALL, "Delete all...");
|
||||
actionsSet.put(TiledPlugin.ACTION_OPEN_OFFSET_PANEL, "Set offset");
|
||||
tiledPlugin.facade.sendNotification(TiledPlugin.TILE_SELECTED, tiledPlugin.dataToSave.getTile(tileName));
|
||||
tiledPlugin.getAPI().showPopup(actionsSet, tileName);
|
||||
@@ -176,6 +180,23 @@ public class TiledPanelMediator extends Mediator<TiledPanel> {
|
||||
|
||||
viewComponent.removeTile();
|
||||
break;
|
||||
case TiledPlugin.ACTION_DELETE_TILE_ALL:
|
||||
Dialogs.showOptionDialog(tiledPlugin.getAPI().getUIStage(), "Delete all...", "Do you really want to delete all tiles?",
|
||||
Dialogs.OptionDialogType.YES_NO, new OptionDialogAdapter() {
|
||||
@Override
|
||||
public void yes () {
|
||||
tiledPlugin.dataToSave.removeAllTiles();
|
||||
tiledPlugin.saveDataManager.save();
|
||||
tiledPlugin.setSelectedTileVO(new TileVO());
|
||||
|
||||
viewComponent.removeAllTiles();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void no () {
|
||||
}
|
||||
});
|
||||
break;
|
||||
case MsgAPI.TOOL_SELECTED:
|
||||
String body = notification.getBody();
|
||||
switch (body) {
|
||||
@@ -221,7 +242,7 @@ public class TiledPanelMediator extends Mediator<TiledPanel> {
|
||||
}
|
||||
}
|
||||
|
||||
private int mapClassNameToEntityType(String className) {
|
||||
private int mapClassNameToEntityType(String className) {
|
||||
if (className.endsWith(".ImageResource"))
|
||||
return EntityFactory.IMAGE_TYPE;
|
||||
else if (className.endsWith(".SpriteResource"))
|
||||
|
||||
@@ -62,6 +62,7 @@ public class TiledPlugin extends H2DPluginAdapter {
|
||||
public static final String GRID_CHANGED = CLASS_NAME + ".GRID_CHANGED";
|
||||
public static final String IMPORT_TILESET_PANEL_OPEN = CLASS_NAME + ".IMPORT_TILESET_PANEL_OPEN";
|
||||
public static final String ACTION_DELETE_TILE = CLASS_NAME + ".ACTION_DELETE_TILE";
|
||||
public static final String ACTION_DELETE_TILE_ALL = CLASS_NAME + ".ACTION_DELETE_TILE_ALL";
|
||||
public static final String ACTION_SET_OFFSET = CLASS_NAME + ".ACTION_SET_OFFSET";
|
||||
public static final String ACTION_OPEN_OFFSET_PANEL = CLASS_NAME + ".ACTION_OPEN_OFFSET_PANEL";
|
||||
public static final String TILE_GRID_OFFSET_ADDED = CLASS_NAME + ".TILE_GRID_OFFSET_ADDED";
|
||||
|
||||
+10
-2
@@ -1,12 +1,13 @@
|
||||
package games.rednblack.editor.plugin.tiled.save;
|
||||
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import games.rednblack.editor.plugin.tiled.data.ParameterVO;
|
||||
import games.rednblack.editor.plugin.tiled.data.TileVO;
|
||||
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
/**
|
||||
* Created by mariam on 3/23/16.
|
||||
*/
|
||||
@@ -36,6 +37,13 @@ public class DataToSave {
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all tiles.
|
||||
*/
|
||||
public void removeAllTiles() {
|
||||
tiles.clear();
|
||||
}
|
||||
|
||||
public void setTileGridOffset(TileVO tileVO) {
|
||||
StreamSupport.stream(tiles.spliterator(), false)
|
||||
|
||||
+8
@@ -105,6 +105,14 @@ public class GridTilesTab extends DefaultTab {
|
||||
tiles.clear();
|
||||
initView();
|
||||
}
|
||||
|
||||
public void removeAllTiles() {
|
||||
if (pane != null) isBottomEdge = pane.isBottomEdge();
|
||||
tileIndex = 0;
|
||||
tilesCount = 19;
|
||||
tiles.clear();
|
||||
initView();
|
||||
}
|
||||
|
||||
public void scrollTiles() {
|
||||
if(savedTiles.size + 1 >= tilesCount) {
|
||||
|
||||
Reference in New Issue
Block a user