* Custom Resources filters system
* Tiles filter, close #61 * Improve Tooltips
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 4.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.8 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+85
-79
@@ -30,27 +30,27 @@ arrow
|
||||
arrow-down
|
||||
bounds: 729, 191, 13, 15
|
||||
arrow-over
|
||||
bounds: 778, 192, 13, 15
|
||||
bounds: 829, 192, 13, 15
|
||||
border
|
||||
bounds: 771, 185, 5, 5
|
||||
bounds: 225, 23, 5, 5
|
||||
split: 2, 2, 2, 2
|
||||
pad: 1, 1, 1, 1
|
||||
border-circle
|
||||
bounds: 793, 193, 14, 14
|
||||
bounds: 844, 193, 14, 14
|
||||
border-circle-error
|
||||
bounds: 809, 193, 14, 14
|
||||
bounds: 860, 193, 14, 14
|
||||
border-error
|
||||
bounds: 674, 177, 11, 11
|
||||
bounds: 570, 167, 11, 11
|
||||
split: 5, 5, 5, 5
|
||||
pad: 1, 1, 1, 1
|
||||
border-textfield
|
||||
bounds: 210, 25, 11, 5
|
||||
bounds: 726, 184, 11, 5
|
||||
split: 5, 5, 2, 2
|
||||
pad: 5, 5, 1, 1
|
||||
box-colapse-off
|
||||
bounds: 78, 1, 11, 11
|
||||
bounds: 583, 167, 11, 11
|
||||
box-colapse-on
|
||||
bounds: 91, 1, 11, 11
|
||||
bounds: 596, 167, 11, 11
|
||||
button
|
||||
bounds: 501, 112, 12, 20
|
||||
split: 5, 5, 5, 4
|
||||
@@ -105,30 +105,30 @@ button-window-bg
|
||||
split: 5, 5, 4, 3
|
||||
pad: 4, 4, 1, 1
|
||||
close-node
|
||||
bounds: 344, 72, 12, 12
|
||||
bounds: 392, 69, 12, 12
|
||||
close-node-hover
|
||||
bounds: 358, 72, 12, 12
|
||||
bounds: 632, 175, 12, 12
|
||||
close-node-pressed
|
||||
bounds: 372, 72, 12, 12
|
||||
bounds: 646, 178, 12, 12
|
||||
color-picker-bar-selector
|
||||
bounds: 687, 174, 7, 14
|
||||
bounds: 609, 164, 7, 14
|
||||
color-picker-cross
|
||||
bounds: 778, 185, 5, 5
|
||||
bounds: 222, 16, 5, 5
|
||||
color-picker-selector-horizontal
|
||||
bounds: 550, 129, 3, 1
|
||||
bounds: 1020, 210, 3, 1
|
||||
color-picker-selector-vertical
|
||||
bounds: 75, 1, 1, 3
|
||||
bounds: 628, 204, 1, 3
|
||||
console-background
|
||||
bounds: 486, 174, 64, 81
|
||||
split: 23, 22, 42, 23
|
||||
pad: 16, 15, 20, 15
|
||||
cursor
|
||||
bounds: 484, 131, 1, 1
|
||||
bounds: 207, 23, 1, 1
|
||||
default-pane
|
||||
bounds: 53, 1, 5, 3
|
||||
split: 1, 1, 1, 1
|
||||
default-pane-noborder
|
||||
bounds: 628, 206, 1, 1
|
||||
bounds: 484, 131, 1, 1
|
||||
split: 0, 0, 0, 0
|
||||
default-select
|
||||
bounds: 305, 104, 27, 24
|
||||
@@ -147,30 +147,36 @@ expandable-properties-active-bg
|
||||
bounds: 551, 135, 4, 17
|
||||
split: 1, 2, 0, 17
|
||||
expandable-properties-collapse-off
|
||||
bounds: 737, 182, 7, 7
|
||||
bounds: 210, 23, 7, 7
|
||||
expandable-properties-collapse-on
|
||||
bounds: 746, 183, 7, 7
|
||||
bounds: 557, 133, 7, 7
|
||||
expandable-properties-inactive-bg
|
||||
bounds: 550, 154, 4, 18
|
||||
split: 1, 2, 0, 18
|
||||
filter
|
||||
bounds: 487, 78, 15, 15
|
||||
filter-down
|
||||
bounds: 646, 192, 15, 15
|
||||
filter-over
|
||||
bounds: 663, 190, 15, 15
|
||||
icon-animation
|
||||
bounds: 357, 130, 22, 22
|
||||
icon-arrow-left
|
||||
bounds: 1017, 194, 6, 11
|
||||
bounds: 688, 177, 6, 11
|
||||
icon-arrow-right
|
||||
bounds: 1017, 181, 6, 11
|
||||
bounds: 557, 142, 6, 11
|
||||
icon-close
|
||||
bounds: 711, 233, 22, 22
|
||||
icon-close-panel
|
||||
bounds: 454, 106, 18, 22
|
||||
icon-close-small
|
||||
bounds: 632, 175, 12, 12
|
||||
bounds: 660, 176, 12, 12
|
||||
icon-close-white
|
||||
bounds: 486, 154, 22, 18
|
||||
icon-composite
|
||||
bounds: 381, 130, 22, 22
|
||||
icon-composite2
|
||||
bounds: 825, 193, 14, 14
|
||||
bounds: 876, 193, 14, 14
|
||||
icon-drive
|
||||
bounds: 735, 233, 22, 22
|
||||
icon-file-audio
|
||||
@@ -200,9 +206,9 @@ icon-library
|
||||
icon-library-over
|
||||
bounds: 812, 209, 22, 22
|
||||
icon-link-active
|
||||
bounds: 487, 78, 15, 15
|
||||
bounds: 695, 191, 15, 15
|
||||
icon-link-inactive
|
||||
bounds: 646, 192, 15, 15
|
||||
bounds: 712, 191, 15, 15
|
||||
icon-list-settings
|
||||
bounds: 855, 233, 22, 22
|
||||
icon-lock-active
|
||||
@@ -220,7 +226,7 @@ icon-particle-white
|
||||
icon-refresh
|
||||
bounds: 927, 233, 22, 22
|
||||
icon-root
|
||||
bounds: 841, 193, 14, 14
|
||||
bounds: 892, 193, 14, 14
|
||||
icon-spine
|
||||
bounds: 908, 209, 22, 22
|
||||
icon-star
|
||||
@@ -234,9 +240,9 @@ icon-trash-disabled
|
||||
icon-trash-over
|
||||
bounds: 329, 68, 13, 15
|
||||
icon-unlink-active
|
||||
bounds: 663, 190, 15, 15
|
||||
bounds: 744, 192, 15, 15
|
||||
icon-unlink-inactive
|
||||
bounds: 695, 191, 15, 15
|
||||
bounds: 761, 192, 15, 15
|
||||
icon-visible-off
|
||||
bounds: 975, 233, 22, 22
|
||||
icon-visible-on
|
||||
@@ -254,7 +260,7 @@ icon-zoomout-disabled
|
||||
icon-zoomout-over
|
||||
bounds: 375, 86, 17, 17
|
||||
image-up
|
||||
bounds: 712, 191, 15, 15
|
||||
bounds: 778, 192, 15, 15
|
||||
layer-bg
|
||||
bounds: 225, 30, 5, 19
|
||||
split: 2, 2, 0, 19
|
||||
@@ -262,11 +268,11 @@ layer-bg-over
|
||||
bounds: 225, 51, 5, 19
|
||||
split: 2, 2, 0, 19
|
||||
library-up
|
||||
bounds: 744, 192, 15, 15
|
||||
bounds: 795, 192, 15, 15
|
||||
list-selection
|
||||
bounds: 232, 62, 1, 1
|
||||
list-selection-white
|
||||
bounds: 646, 175, 1, 1
|
||||
bounds: 299, 65, 1, 1
|
||||
logo
|
||||
bounds: 53, 6, 23, 23
|
||||
menu-bg
|
||||
@@ -296,7 +302,7 @@ menu-item-over
|
||||
missing-image
|
||||
bounds: 1, 105, 232, 150
|
||||
origin-anchor
|
||||
bounds: 504, 78, 9, 9
|
||||
bounds: 556, 155, 9, 9
|
||||
padded-list-selection
|
||||
bounds: 41, 2, 10, 3
|
||||
split: 4, 4, 1, 1
|
||||
@@ -305,56 +311,56 @@ panel
|
||||
bounds: 139, 14, 11, 36
|
||||
split: 3, 3, 33, 2
|
||||
particle-up
|
||||
bounds: 761, 192, 15, 15
|
||||
bounds: 812, 192, 15, 15
|
||||
pin
|
||||
bounds: 152, 69, 36, 34
|
||||
popup-menu
|
||||
bounds: 999, 233, 22, 22
|
||||
split: 7, 7, 7, 7
|
||||
progressbar
|
||||
bounds: 232, 65, 1, 5
|
||||
bounds: 550, 125, 1, 5
|
||||
progressbar-filled
|
||||
bounds: 235, 66, 1, 5
|
||||
bounds: 232, 65, 1, 5
|
||||
progressbar-filled-vertical
|
||||
bounds: 477, 131, 5, 1
|
||||
progressbar-vertical
|
||||
bounds: 515, 113, 5, 1
|
||||
scroll
|
||||
bounds: 386, 70, 5, 6
|
||||
bounds: 215, 7, 5, 6
|
||||
split: 2, 2, 2, 2
|
||||
scroll-horizontal
|
||||
bounds: 755, 185, 6, 5
|
||||
bounds: 207, 8, 6, 5
|
||||
split: 2, 2, 0, 5
|
||||
pad: -1, -1, 2, 2
|
||||
scroll-knob-horizontal
|
||||
bounds: 763, 185, 6, 5
|
||||
bounds: 207, 1, 6, 5
|
||||
split: 2, 2, 0, 5
|
||||
pad: -1, -1, 2, 2
|
||||
scroll-knob-vertical
|
||||
bounds: 785, 184, 5, 6
|
||||
bounds: 215, 15, 5, 6
|
||||
split: 2, 2, 2, 2
|
||||
select-box-list-bg
|
||||
bounds: 207, 23, 1, 1
|
||||
bounds: 646, 175, 1, 1
|
||||
select-box-list-bg-white
|
||||
bounds: 394, 80, 1, 1
|
||||
bounds: 618, 177, 1, 1
|
||||
select-down
|
||||
bounds: 11, 1, 7, 4
|
||||
select-up
|
||||
bounds: 20, 1, 7, 4
|
||||
selection
|
||||
bounds: 344, 69, 1, 1
|
||||
bounds: 567, 163, 1, 1
|
||||
selection-anchor
|
||||
bounds: 696, 180, 9, 9
|
||||
bounds: 504, 78, 9, 9
|
||||
separator
|
||||
bounds: 709, 177, 1, 1
|
||||
bounds: 570, 164, 1, 1
|
||||
separator-menu
|
||||
bounds: 235, 63, 1, 1
|
||||
bounds: 696, 177, 1, 1
|
||||
separator-tool
|
||||
bounds: 238, 70, 1, 1
|
||||
bounds: 726, 181, 1, 1
|
||||
tree-over
|
||||
bounds: 238, 70, 1, 1
|
||||
bounds: 726, 181, 1, 1
|
||||
separator-vertical
|
||||
bounds: 522, 113, 1, 1
|
||||
bounds: 739, 188, 1, 1
|
||||
slider
|
||||
bounds: 552, 174, 1, 4
|
||||
slider-knob
|
||||
@@ -370,13 +376,13 @@ slider-vertical
|
||||
splash_logo
|
||||
bounds: 1, 31, 76, 72
|
||||
splitpane
|
||||
bounds: 299, 65, 4, 1
|
||||
splitpane-over
|
||||
bounds: 551, 132, 4, 1
|
||||
splitpane-over
|
||||
bounds: 235, 70, 4, 1
|
||||
splitpane-vertical
|
||||
bounds: 1020, 207, 1, 4
|
||||
bounds: 215, 1, 1, 4
|
||||
splitpane-vertical-over
|
||||
bounds: 555, 174, 1, 4
|
||||
bounds: 218, 1, 1, 4
|
||||
static-text
|
||||
bounds: 478, 83, 7, 21
|
||||
split: 3, 3, 0, 21
|
||||
@@ -384,7 +390,7 @@ sticky-note
|
||||
bounds: 589, 204, 37, 27
|
||||
split: 14, 13, 10, 11
|
||||
sub-menu
|
||||
bounds: 703, 171, 4, 7
|
||||
bounds: 219, 23, 4, 7
|
||||
sub-menu-bg
|
||||
bounds: 235, 73, 14, 31
|
||||
split: 2, 2, 0, 31
|
||||
@@ -395,16 +401,16 @@ tab-inactive
|
||||
bounds: 622, 181, 8, 21
|
||||
split: 3, 3, 2, 1
|
||||
textfield
|
||||
bounds: 889, 193, 14, 14
|
||||
bounds: 940, 193, 14, 14
|
||||
split: 2, 2, 3, 2
|
||||
textfield-light
|
||||
bounds: 873, 193, 14, 14
|
||||
bounds: 924, 193, 14, 14
|
||||
split: 3, 3, 4, 3
|
||||
textfield-light-over
|
||||
bounds: 857, 193, 14, 14
|
||||
bounds: 908, 193, 14, 14
|
||||
split: 3, 3, 4, 3
|
||||
textfield-over
|
||||
bounds: 857, 193, 14, 14
|
||||
bounds: 908, 193, 14, 14
|
||||
split: 2, 2, 3, 2
|
||||
thumbnail
|
||||
bounds: 35, 1, 4, 4
|
||||
@@ -413,7 +419,7 @@ thumbnail-over
|
||||
bounds: 29, 1, 4, 4
|
||||
split: 1, 2, 1, 2
|
||||
tint-border
|
||||
bounds: 386, 78, 6, 6
|
||||
bounds: 207, 15, 6, 6
|
||||
split: 2, 2, 2, 2
|
||||
tool-align
|
||||
bounds: 251, 81, 22, 23
|
||||
@@ -433,13 +439,13 @@ toolbar-bg
|
||||
bounds: 1, 1, 8, 4
|
||||
split: 1, 2, 1, 1
|
||||
toolbar-down
|
||||
bounds: 707, 180, 8, 9
|
||||
bounds: 696, 180, 8, 9
|
||||
split: 2, 2, 3, 3
|
||||
toolbar-normal
|
||||
bounds: 717, 180, 8, 9
|
||||
bounds: 706, 180, 8, 9
|
||||
split: 2, 2, 3, 3
|
||||
toolbar-over
|
||||
bounds: 727, 180, 8, 9
|
||||
bounds: 716, 180, 8, 9
|
||||
split: 2, 2, 3, 3
|
||||
tooltip-bg
|
||||
bounds: 1020, 218, 3, 3
|
||||
@@ -447,37 +453,37 @@ tooltip-bg
|
||||
touchpad-knob
|
||||
bounds: 980, 209, 22, 22
|
||||
tree-minus
|
||||
bounds: 646, 178, 12, 12
|
||||
bounds: 674, 176, 12, 12
|
||||
tree-plus
|
||||
bounds: 660, 176, 12, 12
|
||||
bounds: 556, 166, 12, 12
|
||||
tree-selection
|
||||
bounds: 696, 173, 5, 5
|
||||
bounds: 222, 9, 5, 5
|
||||
split: 2, 2, 2, 2
|
||||
pad: 1, 1, 1, 1
|
||||
vis-blue
|
||||
bounds: 558, 177, 1, 1
|
||||
bounds: 75, 3, 1, 1
|
||||
vis-check
|
||||
bounds: 905, 193, 14, 14
|
||||
bounds: 956, 193, 14, 14
|
||||
vis-check-down
|
||||
bounds: 921, 193, 14, 14
|
||||
bounds: 972, 193, 14, 14
|
||||
vis-check-over
|
||||
bounds: 937, 193, 14, 14
|
||||
bounds: 988, 193, 14, 14
|
||||
vis-check-tick
|
||||
bounds: 953, 193, 14, 14
|
||||
bounds: 1004, 191, 14, 14
|
||||
vis-check-tick-disabled
|
||||
bounds: 969, 193, 14, 14
|
||||
vis-radio
|
||||
bounds: 985, 193, 14, 14
|
||||
vis-radio-down
|
||||
bounds: 1001, 191, 14, 14
|
||||
vis-radio-over
|
||||
bounds: 251, 65, 14, 14
|
||||
vis-radio-tick
|
||||
vis-radio
|
||||
bounds: 267, 65, 14, 14
|
||||
vis-radio-tick-disabled
|
||||
vis-radio-down
|
||||
bounds: 283, 65, 14, 14
|
||||
vis-radio-over
|
||||
bounds: 344, 70, 14, 14
|
||||
vis-radio-tick
|
||||
bounds: 360, 70, 14, 14
|
||||
vis-radio-tick-disabled
|
||||
bounds: 376, 70, 14, 14
|
||||
vis-red
|
||||
bounds: 305, 65, 1, 1
|
||||
bounds: 229, 20, 1, 1
|
||||
white
|
||||
bounds: 1020, 213, 3, 3
|
||||
window
|
||||
@@ -508,7 +514,7 @@ window-action-restore-normal
|
||||
window-action-restore-pressed
|
||||
bounds: 676, 233, 33, 22
|
||||
window-bg
|
||||
bounds: 550, 126, 1, 1
|
||||
bounds: 1020, 207, 1, 1
|
||||
window-noborder
|
||||
bounds: 190, 69, 27, 34
|
||||
split: 5, 4, 26, 3
|
||||
|
||||
@@ -484,6 +484,11 @@
|
||||
imageOver: arrow-over,
|
||||
imageUp: arrow
|
||||
},
|
||||
filter-button: {
|
||||
imageDown: filter-down,
|
||||
imageOver: filter-over,
|
||||
imageUp: filter
|
||||
},
|
||||
image-button: {
|
||||
imageUp: image-up
|
||||
},
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
+1
-1
Submodule hyperlap2d-common-api updated: e7522bff38...4118575dd1
@@ -148,6 +148,8 @@ public class TiledPanelMediator extends Mediator<TiledPanel> {
|
||||
|
||||
tiledPlugin.dataToSave.addTile(tileName, type);
|
||||
}
|
||||
|
||||
facade.sendNotification(MsgAPI.UPDATE_RESOURCES_LIST);
|
||||
|
||||
tiledPlugin.saveDataManager.save();
|
||||
break;
|
||||
@@ -218,6 +220,7 @@ public class TiledPanelMediator extends Mediator<TiledPanel> {
|
||||
tiledPlugin.setSelectedTileVO(new TileVO());
|
||||
|
||||
viewComponent.removeTile();
|
||||
facade.sendNotification(MsgAPI.UPDATE_RESOURCES_LIST);
|
||||
break;
|
||||
case TiledPlugin.ACTION_DELETE_AUTO_TILE:
|
||||
String tn2 = notification.getBody();
|
||||
@@ -238,6 +241,7 @@ public class TiledPanelMediator extends Mediator<TiledPanel> {
|
||||
|
||||
viewComponent.removeAutoTile();
|
||||
tiledPlugin.facade.sendNotification(TiledPlugin.ACTION_RECALC_PERCENT_ALTERNATIVES_AUTO_TILE);
|
||||
facade.sendNotification(MsgAPI.UPDATE_RESOURCES_LIST);
|
||||
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() {
|
||||
@@ -248,6 +252,7 @@ public class TiledPanelMediator extends Mediator<TiledPanel> {
|
||||
tiledPlugin.setSelectedTileVO(new TileVO());
|
||||
|
||||
viewComponent.removeAllTiles();
|
||||
facade.sendNotification(MsgAPI.UPDATE_RESOURCES_LIST);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -48,6 +48,7 @@ import games.rednblack.editor.renderer.components.ZIndexComponent;
|
||||
import games.rednblack.editor.renderer.utils.ComponentRetriever;
|
||||
import games.rednblack.editor.renderer.utils.CustomVariables;
|
||||
import games.rednblack.h2d.common.MenuAPI;
|
||||
import games.rednblack.h2d.common.MsgAPI;
|
||||
import games.rednblack.h2d.common.plugins.H2DPluginAdapter;
|
||||
import net.mountainblade.modular.annotations.Implementation;
|
||||
|
||||
@@ -150,6 +151,8 @@ public class TiledPlugin extends H2DPluginAdapter {
|
||||
pluginAPI.setDropDownItemName(ACTION_SET_GRID_SIZE_FROM_ITEM, "Set tile grid size");
|
||||
|
||||
pluginAPI.addMenuItem(MenuAPI.RESOURCE_MENU, "Import Tile Set...", IMPORT_TILESET_PANEL_OPEN);
|
||||
|
||||
facade.sendNotification(MsgAPI.ADD_RESOURCES_BOX_FILTER, new TilesResourceFilter(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package games.rednblack.editor.plugin.tiled;
|
||||
|
||||
import games.rednblack.editor.renderer.factory.EntityFactory;
|
||||
import games.rednblack.h2d.common.filters.IAbstractResourceFilter;
|
||||
|
||||
public class TilesResourceFilter extends IAbstractResourceFilter {
|
||||
|
||||
private final TiledPlugin tiledPlugin;
|
||||
|
||||
public TilesResourceFilter(TiledPlugin tiledPlugin) {
|
||||
super("Filter Tiles", "filter-tiles");
|
||||
this.tiledPlugin = tiledPlugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean filterResource(String resName, int entityType) {
|
||||
if (entityType == EntityFactory.IMAGE_TYPE
|
||||
|| entityType == EntityFactory.SPRITE_TYPE
|
||||
|| entityType == EntityFactory.SPINE_TYPE) {
|
||||
return tiledPlugin.dataToSave.containsAutoTile(resName) || tiledPlugin.dataToSave.containsTile(resName);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window;
|
||||
import games.rednblack.editor.proxy.SettingsManager;
|
||||
import games.rednblack.editor.splash.SplashScreenAdapter;
|
||||
import games.rednblack.editor.utils.AppConfig;
|
||||
import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory;
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
|
||||
public class HyperLap2DApp extends ApplicationAdapter {
|
||||
@@ -39,6 +40,8 @@ public class HyperLap2DApp extends ApplicationAdapter {
|
||||
public void create() {
|
||||
Lwjgl3Application app = (Lwjgl3Application) Gdx.app;
|
||||
|
||||
StandardWidgetsFactory.init(HyperLap2DFacade.getInstance());
|
||||
|
||||
Lwjgl3ApplicationConfiguration config2 = new Lwjgl3ApplicationConfiguration();
|
||||
config2.setWindowedMode(467, 385);
|
||||
config2.setTitle("HyperLap2D");
|
||||
|
||||
@@ -21,7 +21,6 @@ package games.rednblack.editor;
|
||||
import games.rednblack.editor.controller.StartupCommand;
|
||||
import games.rednblack.editor.splash.SplashMediator;
|
||||
import games.rednblack.h2d.common.HyperLog;
|
||||
import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory;
|
||||
import org.puremvc.java.patterns.facade.Facade;
|
||||
import org.puremvc.java.patterns.observer.Notification;
|
||||
|
||||
@@ -72,7 +71,6 @@ public class HyperLap2DFacade extends Facade {
|
||||
|
||||
@Override
|
||||
protected void initializeView() {
|
||||
StandardWidgetsFactory.init(this);
|
||||
super.initializeView();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,9 @@ public class Main {
|
||||
if (restartStartOnFirstThread()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Thread.currentThread().setUncaughtExceptionHandler(new CustomExceptionHandler());
|
||||
|
||||
HyperLap2DFacade.getInstance();
|
||||
|
||||
Graphics.DisplayMode dm = Lwjgl3ApplicationConfiguration.getDisplayMode();
|
||||
@@ -62,8 +65,6 @@ public class Main {
|
||||
config.useOpenGL3(true, 3, 2);
|
||||
config.setBackBufferConfig(8,8,8,8,16,8, settingsManager.editorConfigVO.msaaSamples);
|
||||
|
||||
Thread.currentThread().setUncaughtExceptionHandler(new CustomExceptionHandler());
|
||||
|
||||
new Lwjgl3Application(HyperLap2DApp.initInstance(dm.width, dm.height, settingsManager), config);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,15 +28,20 @@ import games.rednblack.editor.HyperLap2DFacade;
|
||||
*/
|
||||
public class CheckBoxChangeListener extends ChangeListener {
|
||||
|
||||
private final String eventName;
|
||||
private final String eventName, type;
|
||||
|
||||
public CheckBoxChangeListener(String eventName) {
|
||||
this(eventName, null);
|
||||
}
|
||||
|
||||
public CheckBoxChangeListener(String eventName, String type) {
|
||||
this.eventName = eventName;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changed(ChangeEvent changeEvent, Actor actor) {
|
||||
HyperLap2DFacade facade = HyperLap2DFacade.getInstance();
|
||||
facade.sendNotification(eventName, ((VisCheckBox) actor).isChecked());
|
||||
facade.sendNotification(eventName, ((VisCheckBox) actor).isChecked(), type);
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ public class UICompositeHierarchyMediator extends Mediator<UICompositeHierarchy>
|
||||
super(NAME, new UICompositeHierarchy());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] listNotificationInterests() {
|
||||
return new String[]{
|
||||
MsgAPI.SCENE_LOADED,
|
||||
|
||||
@@ -20,6 +20,7 @@ package games.rednblack.editor.view.ui.box;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import games.rednblack.editor.view.ui.box.resourcespanel.*;
|
||||
import org.puremvc.java.interfaces.INotification;
|
||||
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop;
|
||||
@@ -27,11 +28,6 @@ import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import games.rednblack.editor.HyperLap2DFacade;
|
||||
import games.rednblack.editor.proxy.ProjectManager;
|
||||
import games.rednblack.editor.view.ui.box.resourcespanel.UIActionsTabMediator;
|
||||
import games.rednblack.editor.view.ui.box.resourcespanel.UIAnimationsTabMediator;
|
||||
import games.rednblack.editor.view.ui.box.resourcespanel.UIImagesTabMediator;
|
||||
import games.rednblack.editor.view.ui.box.resourcespanel.UILibraryItemsTabMediator;
|
||||
import games.rednblack.editor.view.ui.box.resourcespanel.UIParticleEffectsTabMediator;
|
||||
import games.rednblack.h2d.common.MsgAPI;
|
||||
import games.rednblack.h2d.common.view.ui.widget.imagetabbedpane.ImageTab;
|
||||
|
||||
@@ -119,6 +115,7 @@ public class UIResourcesBoxMediator extends PanelMediator<UIResourcesBox> {
|
||||
facade.registerMediator(new UILibraryItemsTabMediator());
|
||||
facade.registerMediator(new UIParticleEffectsTabMediator());
|
||||
facade.registerMediator(new UIActionsTabMediator());
|
||||
facade.registerMediator(new UIFilterMenuMediator());
|
||||
}
|
||||
|
||||
private void initTabs() {
|
||||
|
||||
@@ -2,6 +2,7 @@ package games.rednblack.editor.view.ui.box.resourcespanel;
|
||||
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.kotcrab.vis.ui.util.dialog.Dialogs;
|
||||
import com.kotcrab.vis.ui.util.dialog.InputDialogListener;
|
||||
@@ -25,7 +26,8 @@ public class UIActionsTab extends UIResourcesTab {
|
||||
|
||||
VisTable bottomPane = new VisTable();
|
||||
contentTable.row();
|
||||
contentTable.add(bottomPane).expandX().fillX();
|
||||
bottomPane.align(Align.left);
|
||||
contentTable.add(bottomPane).padTop(5).colspan(3).growX();
|
||||
|
||||
bottomPane.add(newBtn).center().pad(3);
|
||||
bottomPane.add(deleteBtn).center().pad(3);
|
||||
|
||||
+3
-1
@@ -18,6 +18,8 @@ public class UIActionsTabMediator extends UIResourcesTabMediator<UIActionsTab> {
|
||||
private static final String TAG = UIActionsTabMediator.class.getCanonicalName();
|
||||
public static final String NAME = TAG;
|
||||
|
||||
private final Array<DraggableResource> itemArray = new Array<>();
|
||||
|
||||
public UIActionsTabMediator() {
|
||||
super(NAME, new UIActionsTab());
|
||||
}
|
||||
@@ -51,7 +53,7 @@ public class UIActionsTabMediator extends UIResourcesTabMediator<UIActionsTab> {
|
||||
ProjectManager projectManager = HyperLap2DFacade.getInstance().retrieveProxy(ProjectManager.NAME);
|
||||
HashMap<String, GraphVO> items = projectManager.currentProjectInfoVO.libraryActions;
|
||||
|
||||
Array<DraggableResource> itemArray = new Array<>();
|
||||
itemArray.clear();
|
||||
for (String key : items.keySet()) {
|
||||
if(!key.toLowerCase().contains(searchText))continue;
|
||||
DraggableResource draggableResource = new DraggableResource(new LibraryActionResource(key));
|
||||
|
||||
+4
-1
@@ -90,7 +90,10 @@ public class UIAnimationsTabMediator extends UIResourcesTabMediator<UIAnimations
|
||||
|
||||
private void createAnimationResources(Set<String> strings, Class<? extends BoxItemResource> resourceClass, BiFunction<String, Vector2, Boolean> factoryFunction, String searchText) {
|
||||
for (String animationName : strings) {
|
||||
if (!animationName.contains(searchText)) continue;
|
||||
if (!animationName.toLowerCase().contains(searchText)
|
||||
|| filterResource(animationName, resourceClass == SpineResource.class ? EntityFactory.SPINE_TYPE : EntityFactory.SPRITE_TYPE))
|
||||
continue;
|
||||
|
||||
try {
|
||||
Constructor<? extends BoxItemResource> constructor = resourceClass.getConstructor(String.class, boolean.class);
|
||||
DraggableResource draggableResource = new DraggableResource(constructor.newInstance(animationName, true));
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
package games.rednblack.editor.view.ui.box.resourcespanel;
|
||||
|
||||
import com.badlogic.gdx.math.Interpolation;
|
||||
import com.badlogic.gdx.scenes.scene2d.*;
|
||||
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.kotcrab.vis.ui.util.ActorUtils;
|
||||
import com.kotcrab.vis.ui.widget.VisCheckBox;
|
||||
import com.kotcrab.vis.ui.widget.VisTable;
|
||||
import games.rednblack.editor.event.CheckBoxChangeListener;
|
||||
import games.rednblack.h2d.common.filters.IAbstractResourceFilter;
|
||||
import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory;
|
||||
|
||||
public class UIFilterMenu extends VisTable {
|
||||
private static final float TRANSITION_TIME = 0.15f;
|
||||
|
||||
private static final String CLASS_NAME = "games.rednblack.editor.view.ui.box.resourcespanel.UIItemsTreeBox";
|
||||
public static final String SHOW_FILTER_MENU = CLASS_NAME + ".SHOW_FILTER_MENU";
|
||||
|
||||
private boolean removing = false;
|
||||
private final InputListener stageListener;
|
||||
|
||||
public UIFilterMenu() {
|
||||
setTransform(true);
|
||||
background("popup-menu");
|
||||
pad(10);
|
||||
defaults().left();
|
||||
|
||||
stageListener = new InputListener() {
|
||||
@Override
|
||||
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
|
||||
if (!contains(x, y)) {
|
||||
remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
setTouchable(Touchable.enabled);
|
||||
}
|
||||
|
||||
public void addFilter(IAbstractResourceFilter filter) {
|
||||
VisCheckBox checkBox = StandardWidgetsFactory.createCheckBox(filter.name);
|
||||
checkBox.setChecked(filter.isActive());
|
||||
checkBox.addListener(new CheckBoxChangeListener(UIResourcesTabMediator.CHANGE_ACTIVE_FILTER, filter.id));
|
||||
add(checkBox).padTop(2).padBottom(2).row();
|
||||
pack();
|
||||
}
|
||||
|
||||
public boolean contains (float x, float y) {
|
||||
return getX() < x && getX() + getWidth() > x && getY() < y && getY() + getHeight() > y;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setStage (Stage stage) {
|
||||
super.setStage(stage);
|
||||
if (stage != null) stage.addListener(stageListener);
|
||||
}
|
||||
|
||||
public void showMenu(Stage stage, float x, float y) {
|
||||
if (getStage() == stage) return;
|
||||
|
||||
setPosition(x, y - getHeight());
|
||||
if (stage.getHeight() - getY() > stage.getHeight()) setY(getY() + getHeight());
|
||||
ActorUtils.keepWithinStage(stage, this);
|
||||
stage.addActor(this);
|
||||
|
||||
setOrigin(Align.topRight);
|
||||
setScale(0);
|
||||
getColor().a = 0;
|
||||
clearActions();
|
||||
addAction(Actions.parallel(
|
||||
Actions.alpha(1, TRANSITION_TIME),
|
||||
Actions.scaleTo(1, 1, TRANSITION_TIME, Interpolation.pow5Out)
|
||||
));
|
||||
removing = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove () {
|
||||
if (!removing) {
|
||||
removing = true;
|
||||
clearActions();
|
||||
addAction(Actions.sequence(
|
||||
Actions.parallel(
|
||||
Actions.alpha(0, TRANSITION_TIME),
|
||||
Actions.scaleTo(0, 0, TRANSITION_TIME, Interpolation.pow2Out)
|
||||
),
|
||||
Actions.run(() -> {
|
||||
if (getStage() != null) getStage().removeListener(stageListener);
|
||||
UIFilterMenu.super.remove();
|
||||
})));
|
||||
}
|
||||
return removing;
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package games.rednblack.editor.view.ui.box.resourcespanel;
|
||||
|
||||
import games.rednblack.editor.view.stage.Sandbox;
|
||||
import games.rednblack.editor.view.stage.UIStage;
|
||||
import games.rednblack.h2d.common.MsgAPI;
|
||||
import org.puremvc.java.interfaces.INotification;
|
||||
import org.puremvc.java.patterns.mediator.Mediator;
|
||||
|
||||
public class UIFilterMenuMediator extends Mediator<UIFilterMenu> {
|
||||
|
||||
private static final String TAG = UIFilterMenuMediator.class.getCanonicalName();
|
||||
public static final String NAME = TAG;
|
||||
|
||||
public UIFilterMenuMediator() {
|
||||
super(NAME, new UIFilterMenu());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] listNotificationInterests() {
|
||||
return new String[]{
|
||||
UIFilterMenu.SHOW_FILTER_MENU,
|
||||
MsgAPI.ADD_RESOURCES_BOX_FILTER
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleNotification(INotification notification) {
|
||||
UIStage uiStage = Sandbox.getInstance().getUIStage();
|
||||
|
||||
switch (notification.getName()) {
|
||||
case UIFilterMenu.SHOW_FILTER_MENU:
|
||||
Object[] payload = notification.getBody();
|
||||
viewComponent.showMenu(uiStage, (float) payload[0], (float) payload[1]);
|
||||
break;
|
||||
case MsgAPI.ADD_RESOURCES_BOX_FILTER:
|
||||
viewComponent.addFilter(notification.getBody());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-2
@@ -18,6 +18,7 @@
|
||||
|
||||
package games.rednblack.editor.view.ui.box.resourcespanel;
|
||||
|
||||
import games.rednblack.editor.renderer.factory.EntityFactory;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.puremvc.java.interfaces.INotification;
|
||||
|
||||
@@ -40,6 +41,7 @@ public class UIImagesTabMediator extends UIResourcesTabMediator<UIImagesTab> {
|
||||
private static final String TAG = UIImagesTabMediator.class.getCanonicalName();
|
||||
public static final String NAME = TAG;
|
||||
|
||||
private final Array<DraggableResource> thumbnailBoxes = new Array<>();
|
||||
|
||||
public UIImagesTabMediator() {
|
||||
super(NAME, new UIImagesTab());
|
||||
@@ -72,7 +74,7 @@ public class UIImagesTabMediator extends UIResourcesTabMediator<UIImagesTab> {
|
||||
ProjectManager projectManager = facade.retrieveProxy(ProjectManager.NAME);
|
||||
ProjectInfoVO projectInfoVO = projectManager.getCurrentProjectInfoVO();
|
||||
|
||||
Array<DraggableResource> thumbnailBoxes = new Array<>();
|
||||
thumbnailBoxes.clear();
|
||||
|
||||
for (String atlasName : projectInfoVO.imagesPacks.keySet()) {
|
||||
TextureAtlas atlas = resourceManager.getTextureAtlas(atlasName);
|
||||
@@ -80,7 +82,8 @@ public class UIImagesTabMediator extends UIResourcesTabMediator<UIImagesTab> {
|
||||
|
||||
for (TextureAtlas.AtlasRegion region : new Array.ArrayIterator<>(atlasRegions)) {
|
||||
if(!projectInfoVO.imagesPacks.get(atlasName).regions.contains(region.name)
|
||||
|| !region.name.contains(searchText)) continue;
|
||||
|| !region.name.toLowerCase().contains(searchText)
|
||||
|| filterResource(region.name, EntityFactory.IMAGE_TYPE)) continue;
|
||||
|
||||
boolean is9patch = region.findValue("split") != null;
|
||||
ImageResource imageResource = new ImageResource(region, true);
|
||||
|
||||
+5
-2
@@ -20,6 +20,7 @@ package games.rednblack.editor.view.ui.box.resourcespanel;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import games.rednblack.editor.controller.commands.resource.ExportLibraryItemCommand;
|
||||
import games.rednblack.editor.renderer.factory.EntityFactory;
|
||||
import games.rednblack.h2d.common.MsgAPI;
|
||||
import games.rednblack.editor.HyperLap2DFacade;
|
||||
import games.rednblack.editor.controller.commands.resource.DeleteLibraryItem;
|
||||
@@ -41,6 +42,7 @@ public class UILibraryItemsTabMediator extends UIResourcesTabMediator<UILibraryI
|
||||
private static final String TAG = UILibraryItemsTabMediator.class.getCanonicalName();
|
||||
public static final String NAME = TAG;
|
||||
|
||||
private final Array<DraggableResource> itemArray = new Array<>();
|
||||
|
||||
public UILibraryItemsTabMediator() {
|
||||
super(NAME, new UILibraryItemsTab());
|
||||
@@ -76,9 +78,10 @@ public class UILibraryItemsTabMediator extends UIResourcesTabMediator<UILibraryI
|
||||
ProjectManager projectManager = HyperLap2DFacade.getInstance().retrieveProxy(ProjectManager.NAME);
|
||||
HashMap<String, CompositeItemVO> items = projectManager.currentProjectInfoVO.libraryItems;
|
||||
|
||||
Array<DraggableResource> itemArray = new Array<>();
|
||||
itemArray.clear();
|
||||
for (String key : items.keySet()) {
|
||||
if(!key.toLowerCase().contains(searchText))continue;
|
||||
if (!key.toLowerCase().contains(searchText)
|
||||
|| filterResource(key, EntityFactory.COMPOSITE_TYPE)) continue;
|
||||
DraggableResource draggableResource = new DraggableResource(new LibraryItemResource(key));
|
||||
draggableResource.setFactoryFunction(ItemFactory.get()::createItemFromLibrary);
|
||||
draggableResource.initDragDrop();
|
||||
|
||||
+7
-7
@@ -30,7 +30,6 @@ import games.rednblack.editor.view.ui.box.resourcespanel.draggable.DraggableReso
|
||||
import games.rednblack.editor.view.ui.box.resourcespanel.draggable.list.ParticleEffectResource;
|
||||
import games.rednblack.editor.view.ui.box.resourcespanel.draggable.list.TalosResource;
|
||||
import games.rednblack.h2d.extension.talos.TalosItemType;
|
||||
import games.rednblack.h2d.extention.spine.SpineItemType;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.puremvc.java.interfaces.INotification;
|
||||
|
||||
@@ -81,21 +80,22 @@ public class UIParticleEffectsTabMediator extends UIResourcesTabMediator<UIParti
|
||||
ResourceManager resourceManager = facade.retrieveProxy(ResourceManager.NAME);
|
||||
|
||||
if (new TalosItemType().getTypeId() == EntityFactory.TALOS_TYPE) {
|
||||
createAnimationResources(resourceManager.getProjectTalosList().keySet(), TalosResource.class, ItemFactory.get()::tryCreateTalosItem, searchText);
|
||||
createParticleResources(resourceManager.getProjectTalosList().keySet(), TalosResource.class, ItemFactory.get()::tryCreateTalosItem, searchText);
|
||||
}
|
||||
|
||||
createAnimationResources(resourceManager.getProjectParticleList().keySet(), ParticleEffectResource.class, ItemFactory.get()::tryCreateParticleItem, searchText);
|
||||
createParticleResources(resourceManager.getProjectParticleList().keySet(), ParticleEffectResource.class, ItemFactory.get()::tryCreateParticleItem, searchText);
|
||||
particlesList.sort();
|
||||
viewComponent.setItems(particlesList);
|
||||
}
|
||||
|
||||
|
||||
private void createAnimationResources(Set<String> strings, Class resourceClass, BiFunction<String, Vector2, Boolean> factoryFunction, String searchText) {
|
||||
for (String animationName : strings) {
|
||||
if (!animationName.contains(searchText)) continue;
|
||||
private void createParticleResources(Set<String> strings, Class resourceClass, BiFunction<String, Vector2, Boolean> factoryFunction, String searchText) {
|
||||
for (String particleName : strings) {
|
||||
if (!particleName.toLowerCase().contains(searchText)
|
||||
|| filterResource(particleName, resourceClass == TalosResource.class ? EntityFactory.TALOS_TYPE : EntityFactory.PARTICLE_TYPE)) continue;
|
||||
try {
|
||||
Constructor constructor = resourceClass.getConstructor(String.class);
|
||||
DraggableResource draggableResource = new DraggableResource((DraggableResourceView) constructor.newInstance(animationName));
|
||||
DraggableResource draggableResource = new DraggableResource((DraggableResourceView) constructor.newInstance(particleName));
|
||||
draggableResource.setFactoryFunction(factoryFunction);
|
||||
particlesList.add(draggableResource);
|
||||
} catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e) {
|
||||
|
||||
+27
-5
@@ -19,11 +19,17 @@
|
||||
package games.rednblack.editor.view.ui.box.resourcespanel;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||
import com.badlogic.gdx.utils.Pools;
|
||||
import com.kotcrab.vis.ui.widget.VisImageButton;
|
||||
import com.kotcrab.vis.ui.widget.VisScrollPane;
|
||||
import com.kotcrab.vis.ui.widget.VisTable;
|
||||
import com.kotcrab.vis.ui.widget.VisTextField;
|
||||
import games.rednblack.editor.HyperLap2DFacade;
|
||||
import games.rednblack.h2d.common.MsgAPI;
|
||||
import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory;
|
||||
import games.rednblack.h2d.common.view.ui.widget.imagetabbedpane.ImageTab;
|
||||
|
||||
@@ -36,18 +42,17 @@ public abstract class UIResourcesTab extends ImageTab {
|
||||
|
||||
public String searchString = "";
|
||||
|
||||
public static final String SEARCH = "games.rednblack.editor.view.ui.box.resourcespanel.UIResourcesTab" + ".SEARCH";
|
||||
|
||||
public UIResourcesTab() {
|
||||
super(false, false);
|
||||
contentTable = new VisTable();
|
||||
contentTable.padTop(8).padLeft(7);
|
||||
contentTable.add(StandardWidgetsFactory.createLabel("Search:")).padLeft(1).padBottom(6);
|
||||
contentTable.add(createTextField()).padLeft(0).padRight(7).fillX().padBottom(4);
|
||||
contentTable.add(createFilterButton()).padRight(7);
|
||||
contentTable.row();
|
||||
|
||||
VisScrollPane scrollPane = crateScrollPane();
|
||||
contentTable.add(scrollPane).padLeft(7).colspan(2).maxHeight(Gdx.graphics.getHeight() * 0.22f).expandX().fillX();
|
||||
contentTable.padTop(4);
|
||||
contentTable.add(scrollPane).padTop(4).colspan(3).maxHeight(Gdx.graphics.getHeight() * 0.22f).expandX().fillX();
|
||||
}
|
||||
|
||||
protected VisTextField createTextField() {
|
||||
@@ -58,12 +63,29 @@ public abstract class UIResourcesTab extends ImageTab {
|
||||
public void keyTyped(VisTextField textField, char c) {
|
||||
searchString = textField.getText();
|
||||
HyperLap2DFacade facade = HyperLap2DFacade.getInstance();
|
||||
facade.sendNotification(SEARCH);
|
||||
facade.sendNotification(MsgAPI.UPDATE_RESOURCES_LIST);
|
||||
}
|
||||
});
|
||||
return visTextField;
|
||||
}
|
||||
|
||||
protected VisImageButton createFilterButton () {
|
||||
VisImageButton button = StandardWidgetsFactory.createImageButton("filter-button");
|
||||
button.addListener(new ClickListener() {
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
HyperLap2DFacade facade = HyperLap2DFacade.getInstance();
|
||||
Vector2 pos = Pools.obtain(Vector2.class);
|
||||
pos.set(0, 0);
|
||||
button.localToStageCoordinates(pos);
|
||||
Object[] payload = new Object[]{pos.x, pos.y, getTabTitle()};
|
||||
facade.sendNotification(UIFilterMenu.SHOW_FILTER_MENU, payload);
|
||||
Pools.free(pos);
|
||||
}
|
||||
});
|
||||
return button;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Table getContentTable() {
|
||||
return contentTable;
|
||||
|
||||
+39
-3
@@ -18,8 +18,12 @@
|
||||
|
||||
package games.rednblack.editor.view.ui.box.resourcespanel;
|
||||
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
import games.rednblack.editor.HyperLap2DFacade;
|
||||
import games.rednblack.editor.proxy.ProjectManager;
|
||||
import games.rednblack.editor.proxy.SettingsManager;
|
||||
import games.rednblack.h2d.common.MsgAPI;
|
||||
import games.rednblack.h2d.common.filters.IAbstractResourceFilter;
|
||||
import org.puremvc.java.interfaces.INotification;
|
||||
import org.puremvc.java.patterns.mediator.Mediator;
|
||||
|
||||
@@ -27,6 +31,13 @@ import org.puremvc.java.patterns.mediator.Mediator;
|
||||
* Created by sargis on 5/12/15.
|
||||
*/
|
||||
public abstract class UIResourcesTabMediator<T extends UIResourcesTab> extends Mediator<T> {
|
||||
private static final String NAME = "games.rednblack.editor.view.ui.box.resourcespanel.UIResourcesTabMediator";
|
||||
public static final String CHANGE_ACTIVE_FILTER = NAME + ".CHANGE_ACTIVE_FILTER";
|
||||
|
||||
protected ObjectMap<String, IAbstractResourceFilter> filters = new ObjectMap<>();
|
||||
|
||||
private SettingsManager settingsManager;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@@ -41,6 +52,7 @@ public abstract class UIResourcesTabMediator<T extends UIResourcesTab> extends M
|
||||
public void onRegister() {
|
||||
super.onRegister();
|
||||
facade = HyperLap2DFacade.getInstance();
|
||||
settingsManager = facade.retrieveProxy(SettingsManager.NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,20 +60,37 @@ public abstract class UIResourcesTabMediator<T extends UIResourcesTab> extends M
|
||||
return new String[]{
|
||||
ProjectManager.PROJECT_OPENED,
|
||||
ProjectManager.PROJECT_DATA_UPDATED,
|
||||
UIResourcesTab.SEARCH
|
||||
MsgAPI.ADD_RESOURCES_BOX_FILTER,
|
||||
MsgAPI.UPDATE_RESOURCES_LIST,
|
||||
CHANGE_ACTIVE_FILTER
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handleNotification(INotification notification) {
|
||||
IAbstractResourceFilter filter;
|
||||
|
||||
switch (notification.getName()) {
|
||||
case ProjectManager.PROJECT_OPENED:
|
||||
case ProjectManager.PROJECT_DATA_UPDATED:
|
||||
case MsgAPI.UPDATE_RESOURCES_LIST:
|
||||
initList(viewComponent.searchString);
|
||||
break;
|
||||
case UIResourcesTab.SEARCH:
|
||||
case MsgAPI.ADD_RESOURCES_BOX_FILTER:
|
||||
filter = notification.getBody();
|
||||
filter.setActive(settingsManager.editorConfigVO.enabledFilters.getOrDefault(filter.id, false));
|
||||
if (!filters.containsKey(filter.id))
|
||||
filters.put(filter.id, filter);
|
||||
break;
|
||||
case CHANGE_ACTIVE_FILTER:
|
||||
if (filters.containsKey(notification.getType())) {
|
||||
filter = filters.get(notification.getType());
|
||||
filter.setActive(notification.getBody());
|
||||
settingsManager.editorConfigVO.enabledFilters.put(filter.id, filter.isActive());
|
||||
settingsManager.saveEditorConfig();
|
||||
}
|
||||
initList(viewComponent.searchString);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -69,4 +98,11 @@ public abstract class UIResourcesTabMediator<T extends UIResourcesTab> extends M
|
||||
|
||||
protected abstract void initList(String searchText);
|
||||
|
||||
protected boolean filterResource(String resName, int resType) {
|
||||
for (IAbstractResourceFilter filter : filters.values()) {
|
||||
if (filter.isActive() && filter.filterResource(resName, resType))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ public class DraggableResource extends DragAndDrop implements Comparable<Draggab
|
||||
}
|
||||
|
||||
if (viewComponent instanceof BoxItemResource) {
|
||||
StandardWidgetsFactory.addVisTooltip((Actor) viewComponent, viewComponent.getPayloadData().name);
|
||||
StandardWidgetsFactory.addTooltip((Actor) viewComponent, viewComponent.getPayloadData().name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-8
@@ -60,16 +60,17 @@ public class UISensorProperties extends UIRemovableProperties {
|
||||
|
||||
// table
|
||||
VisTable sensorTable = new VisTable();
|
||||
sensorTable.add(sensorTop).padRight(5).fillX();
|
||||
sensorTable.defaults().left();
|
||||
sensorTable.add(sensorTop).padRight(5);
|
||||
sensorTable.add(sensorSpanPercentTop).width(50).padRight(5);
|
||||
sensorTable.row();
|
||||
sensorTable.add(sensorLeft).padRight(5).fillX();
|
||||
sensorTable.add(sensorLeft).padRight(5);
|
||||
sensorTable.add(sensorSpanPercentLeft).width(50).padRight(5);
|
||||
sensorTable.row();
|
||||
sensorTable.add(sensorRight).padRight(5).fillX();
|
||||
sensorTable.add(sensorRight).padRight(5);
|
||||
sensorTable.add(sensorSpanPercentRight).width(50).padRight(5);
|
||||
sensorTable.row();
|
||||
sensorTable.add(sensorBottom).padRight(5).fillX();
|
||||
sensorTable.add(sensorBottom).padRight(5);
|
||||
sensorTable.add(sensorSpanPercentBottom).width(50).padRight(5);
|
||||
|
||||
mainTable.add(sensorTable).padBottom(5).colspan(2);
|
||||
@@ -80,10 +81,10 @@ public class UISensorProperties extends UIRemovableProperties {
|
||||
* Initializes the tooltips.
|
||||
*/
|
||||
private void initTooltip() {
|
||||
StandardWidgetsFactory.addVisTooltip(sensorBottom, "Adds a sensor to the bottom of the body.\nThe value gives the percentage of\nthe body width where 1.0 equals 100%.");
|
||||
StandardWidgetsFactory.addVisTooltip(sensorLeft, "Adds a sensor to the left of the body.\nThe value gives the percentage of\nthe body height where 1.0 equals 100%.");
|
||||
StandardWidgetsFactory.addVisTooltip(sensorRight, "Adds a sensor to the right of the body.\nThe value gives the percentage of\nthe body height where 1.0 equals 100%.");
|
||||
StandardWidgetsFactory.addVisTooltip(sensorTop, "Adds a sensor to the top of the body.\nThe value gives the percentage of\nthe body width where 1.0 equals 100%.");
|
||||
StandardWidgetsFactory.addTooltip(sensorBottom, "Adds a sensor to the bottom of the body. The value gives the percentage of the body width where 1.0 equals 100%.");
|
||||
StandardWidgetsFactory.addTooltip(sensorLeft, "Adds a sensor to the left of the body. The value gives the percentage of the body height where 1.0 equals 100%.");
|
||||
StandardWidgetsFactory.addTooltip(sensorRight, "Adds a sensor to the right of the body. The value gives the percentage of the body height where 1.0 equals 100%.");
|
||||
StandardWidgetsFactory.addTooltip(sensorTop, "Adds a sensor to the top of the body. The value gives the percentage of the body width where 1.0 equals 100%.");
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
|
||||
Reference in New Issue
Block a user