diff --git a/assets/plugins/plugin-9patch-0.1.3.jar b/assets/plugins/plugin-9patch-0.1.3.jar index 9265a310..36a4529c 100644 Binary files a/assets/plugins/plugin-9patch-0.1.3.jar and b/assets/plugins/plugin-9patch-0.1.3.jar differ diff --git a/assets/plugins/plugin-performance-0.1.3.jar b/assets/plugins/plugin-performance-0.1.3.jar index b0f9cd9c..65847b7e 100644 Binary files a/assets/plugins/plugin-performance-0.1.3.jar and b/assets/plugins/plugin-performance-0.1.3.jar differ diff --git a/assets/plugins/plugin-skin-composer-0.1.3.jar b/assets/plugins/plugin-skin-composer-0.1.3.jar index 5aeb4ef6..4de29119 100644 Binary files a/assets/plugins/plugin-skin-composer-0.1.3.jar and b/assets/plugins/plugin-skin-composer-0.1.3.jar differ diff --git a/assets/plugins/plugin-tiled-0.1.3.jar b/assets/plugins/plugin-tiled-0.1.3.jar index 4fa2ae03..94e702c3 100644 Binary files a/assets/plugins/plugin-tiled-0.1.3.jar and b/assets/plugins/plugin-tiled-0.1.3.jar differ diff --git a/build.gradle b/build.gradle index 3f881f11..c830d70e 100644 --- a/build.gradle +++ b/build.gradle @@ -104,6 +104,8 @@ dependencies { implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion" + implementation "games.rednblack.puremvc:core:$pureMvcVersion" + implementation "org.lwjgl:lwjgl-tinyfd:$lwjgl3Version" implementation "org.lwjgl:lwjgl-tinyfd:$lwjgl3Version:natives-linux" implementation "org.lwjgl:lwjgl-tinyfd:$lwjgl3Version:natives-linux-arm32" diff --git a/gradle.properties b/gradle.properties index 84913c52..a3a5fb6f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,4 +6,5 @@ visuiVersion = 1.5.1 typingLabelVersion = 1.3.0 shapedrawerVersion = 2.5.0 talosVersion = 1.4.0 -gdxTinyVGVersion=7a8927633e \ No newline at end of file +gdxTinyVGVersion=7a8927633e +pureMvcVersion=1.0.2 \ No newline at end of file diff --git a/hyperlap2d-common-api b/hyperlap2d-common-api index 19c2b01f..ed24c1d7 160000 --- a/hyperlap2d-common-api +++ b/hyperlap2d-common-api @@ -1 +1 @@ -Subproject commit 19c2b01f948d5917a9ba7a4e2f4af237c7117ec5 +Subproject commit ed24c1d7d32c8a4786069a505609dd371daff1ec diff --git a/plugin-9patch/build.gradle b/plugin-9patch/build.gradle index beafd54d..cddaabce 100644 --- a/plugin-9patch/build.gradle +++ b/plugin-9patch/build.gradle @@ -17,6 +17,8 @@ dependencies { implementation 'net.mountainblade:modular:1.0' + implementation "games.rednblack.puremvc:core:$pureMvcVersion" + implementation project(":hyperlap2d-common-api") implementation project(":hyperlap2d-runtime-libgdx") diff --git a/plugin-9patch/src/main/java/games/rednblack/editor/plugin/ninepatch/MainPanel.java b/plugin-9patch/src/main/java/games/rednblack/editor/plugin/ninepatch/MainPanel.java index 6e356a38..8b6fe73c 100644 --- a/plugin-9patch/src/main/java/games/rednblack/editor/plugin/ninepatch/MainPanel.java +++ b/plugin-9patch/src/main/java/games/rednblack/editor/plugin/ninepatch/MainPanel.java @@ -10,7 +10,7 @@ import com.kotcrab.vis.ui.widget.VisLabel; import com.kotcrab.vis.ui.widget.VisTable; import com.kotcrab.vis.ui.widget.VisTextButton; import games.rednblack.h2d.common.H2DDialog; -import org.puremvc.java.interfaces.IFacade; +import games.rednblack.puremvc.Facade; /** * Created by azakhary on 8/18/2015. @@ -20,7 +20,7 @@ public class MainPanel extends H2DDialog { public static final String SAVE_CLICKED = CLASS_NAME + ".SAVE_CLICKED"; - private IFacade facade; + private Facade facade; private VisTable mainTable; private TextureRegion texture; @@ -31,7 +31,7 @@ public class MainPanel extends H2DDialog { private EditingZone editingZone; private PreviewWidget previewWidget; - public MainPanel(IFacade facade) { + public MainPanel(Facade facade) { super("Nine Patch", false); addCloseButton(); diff --git a/plugin-9patch/src/main/java/games/rednblack/editor/plugin/ninepatch/MainPanelMediator.java b/plugin-9patch/src/main/java/games/rednblack/editor/plugin/ninepatch/MainPanelMediator.java index 121c56b8..1af1ca14 100644 --- a/plugin-9patch/src/main/java/games/rednblack/editor/plugin/ninepatch/MainPanelMediator.java +++ b/plugin-9patch/src/main/java/games/rednblack/editor/plugin/ninepatch/MainPanelMediator.java @@ -4,14 +4,14 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.graphics.g2d.NinePatch; import com.badlogic.gdx.graphics.g2d.TextureAtlas; -import com.badlogic.gdx.graphics.g2d.TextureRegion; import games.rednblack.editor.renderer.components.MainItemComponent; import games.rednblack.editor.renderer.components.NinePatchComponent; import games.rednblack.editor.renderer.components.TextureRegionComponent; import games.rednblack.editor.renderer.factory.EntityFactory; import games.rednblack.editor.renderer.utils.ComponentRetriever; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import java.awt.image.BufferedImage; import java.io.BufferedWriter; @@ -36,12 +36,10 @@ public class MainPanelMediator extends Mediator { } @Override - public String[] listNotificationInterests() { - return new String[]{ - NinePatchPlugin.EDIT_NINE_PATCH, + public void listNotificationInterests(Interests interests) { + interests.add(NinePatchPlugin.EDIT_NINE_PATCH, NinePatchPlugin.CONVERT_TO_NINE_PATCH, - MainPanel.SAVE_CLICKED - }; + MainPanel.SAVE_CLICKED); } @Override diff --git a/plugin-performance/build.gradle b/plugin-performance/build.gradle index beafd54d..cddaabce 100644 --- a/plugin-performance/build.gradle +++ b/plugin-performance/build.gradle @@ -17,6 +17,8 @@ dependencies { implementation 'net.mountainblade:modular:1.0' + implementation "games.rednblack.puremvc:core:$pureMvcVersion" + implementation project(":hyperlap2d-common-api") implementation project(":hyperlap2d-runtime-libgdx") diff --git a/plugin-performance/src/main/java/games/rednblack/editor/plugin/performance/PerformancePanelMediator.java b/plugin-performance/src/main/java/games/rednblack/editor/plugin/performance/PerformancePanelMediator.java index 30cdea3a..0ddbba96 100644 --- a/plugin-performance/src/main/java/games/rednblack/editor/plugin/performance/PerformancePanelMediator.java +++ b/plugin-performance/src/main/java/games/rednblack/editor/plugin/performance/PerformancePanelMediator.java @@ -1,8 +1,9 @@ package games.rednblack.editor.plugin.performance; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; public class PerformancePanelMediator extends Mediator { private static final String TAG = PerformancePanelMediator.class.getCanonicalName(); @@ -18,12 +19,10 @@ public class PerformancePanelMediator extends Mediator { } @Override - public String[] listNotificationInterests() { - return new String[]{ - MsgAPI.RENDER, + public void listNotificationInterests(Interests interests) { + interests.add(MsgAPI.RENDER, MsgAPI.SCENE_LOADED, - PerformancePlugin.PANEL_OPEN - }; + PerformancePlugin.PANEL_OPEN); } @Override diff --git a/plugin-skin-composer/build.gradle b/plugin-skin-composer/build.gradle index f4b8a9bc..60f83529 100644 --- a/plugin-skin-composer/build.gradle +++ b/plugin-skin-composer/build.gradle @@ -15,6 +15,8 @@ dependencies { implementation "com.kotcrab.vis:vis-ui:$visuiVersion" implementation "net.onedaybeard.artemis:artemis-odb:$artemisVersion" + implementation "games.rednblack.puremvc:core:$pureMvcVersion" + implementation 'net.mountainblade:modular:1.0' implementation project(":hyperlap2d-common-api") diff --git a/plugin-skin-composer/src/main/java/games/rednblack/editor/plugin/skincomposer/SkinComposerMediator.java b/plugin-skin-composer/src/main/java/games/rednblack/editor/plugin/skincomposer/SkinComposerMediator.java index 0ba63f83..702b0556 100644 --- a/plugin-skin-composer/src/main/java/games/rednblack/editor/plugin/skincomposer/SkinComposerMediator.java +++ b/plugin-skin-composer/src/main/java/games/rednblack/editor/plugin/skincomposer/SkinComposerMediator.java @@ -5,9 +5,10 @@ import com.kotcrab.vis.ui.util.dialog.Dialogs; import games.rednblack.h2d.common.network.HttpDownloadUtility; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.network.model.GithubReleaseData; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import org.apache.commons.io.FileUtils; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; import java.io.File; import java.io.IOException; @@ -27,11 +28,9 @@ public class SkinComposerMediator extends Mediator { } @Override - public String[] listNotificationInterests() { - return new String[]{ - SkinComposerPlugin.PANEL_OPEN, - SkinComposerPlugin.DOWNLOAD_JAR - }; + public void listNotificationInterests(Interests interests) { + interests.add(SkinComposerPlugin.PANEL_OPEN, + SkinComposerPlugin.DOWNLOAD_JAR); } @Override diff --git a/plugin-skin-composer/src/main/java/games/rednblack/editor/plugin/skincomposer/SkinComposerSettings.java b/plugin-skin-composer/src/main/java/games/rednblack/editor/plugin/skincomposer/SkinComposerSettings.java index 90737dba..eca2be4c 100644 --- a/plugin-skin-composer/src/main/java/games/rednblack/editor/plugin/skincomposer/SkinComposerSettings.java +++ b/plugin-skin-composer/src/main/java/games/rednblack/editor/plugin/skincomposer/SkinComposerSettings.java @@ -5,7 +5,7 @@ import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.plugins.H2DPluginAdapter; import games.rednblack.h2d.common.view.SettingsNodeValue; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; -import org.puremvc.java.interfaces.IFacade; +import games.rednblack.puremvc.Facade; public class SkinComposerSettings extends SettingsNodeValue { @@ -13,7 +13,7 @@ public class SkinComposerSettings extends SettingsNodeValue { private final H2DPluginAdapter plugin; private boolean loaded = false; - public SkinComposerSettings(IFacade facade, H2DPluginAdapter plugin) { + public SkinComposerSettings(Facade facade, H2DPluginAdapter plugin) { super("Skin Composer", facade); this.plugin = plugin; diff --git a/plugin-tiled/build.gradle b/plugin-tiled/build.gradle index e3e59642..3e7fdea5 100644 --- a/plugin-tiled/build.gradle +++ b/plugin-tiled/build.gradle @@ -21,6 +21,8 @@ dependencies { implementation "com.esotericsoftware.spine:spine-libgdx:$spineVersion" + implementation "games.rednblack.puremvc:core:$pureMvcVersion" + implementation 'net.mountainblade:modular:1.0' implementation project(":hyperlap2d-common-api") diff --git a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/TiledPanel.java b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/TiledPanel.java index 55149c9b..88c9e587 100644 --- a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/TiledPanel.java +++ b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/TiledPanel.java @@ -18,8 +18,6 @@ package games.rednblack.editor.plugin.tiled; -import org.puremvc.java.interfaces.IFacade; - import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.kotcrab.vis.ui.widget.VisLabel; import com.kotcrab.vis.ui.widget.VisTable; @@ -35,6 +33,7 @@ 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 games.rednblack.puremvc.Facade; /** * Created by mariam on 2/2/2016. @@ -49,7 +48,7 @@ public class TiledPanel extends UIDraggablePanel { public static final float SETTINGS_HEIGHT = 150f; public TiledPlugin tiledPlugin; - private IFacade facade; + private Facade facade; protected ImageTabbedPane tabbedPane; protected VisTable tabTable; //table inside of each tab @@ -249,7 +248,7 @@ public class TiledPanel extends UIDraggablePanel { this.engine = engine; } - public IFacade getFacade() { + public Facade getFacade() { return facade; } } diff --git a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/TiledPanelMediator.java b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/TiledPanelMediator.java index 51478435..37c3d88e 100644 --- a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/TiledPanelMediator.java +++ b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/TiledPanelMediator.java @@ -24,8 +24,6 @@ import java.util.Iterator; import games.rednblack.editor.renderer.data.TexturePackVO; import games.rednblack.h2d.extension.spine.SpineItemType; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input; @@ -53,6 +51,9 @@ import games.rednblack.editor.renderer.factory.EntityFactory; import games.rednblack.editor.renderer.utils.ComponentRetriever; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.ResourcePayloadObject; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; /** * Created by mariam on 2/2/2016. @@ -77,29 +78,27 @@ public class TiledPanelMediator extends Mediator { } @Override - public String[] listNotificationInterests() { - return new String[]{ - MsgAPI.SCENE_LOADED, + public void listNotificationInterests(Interests interests) { + interests.add(MsgAPI.SCENE_LOADED, TiledPlugin.TILE_ADDED, TiledPlugin.TILE_SELECTED, - TiledPlugin.ACTION_DELETE_TILE, - TiledPlugin.ACTION_DELETE_TILE_ALL, + TiledPlugin.ACTION_DELETE_TILE); + interests.add(TiledPlugin.ACTION_DELETE_TILE_ALL, TiledPlugin.ACTION_SET_GRID_SIZE_FROM_LIST, TiledPlugin.ACTION_SET_OFFSET, - TiledPlugin.OPEN_DROP_DOWN, - TiledPlugin.AUTO_TILE_SELECTED, + TiledPlugin.OPEN_DROP_DOWN); + interests.add(TiledPlugin.AUTO_TILE_SELECTED, TiledPlugin.ACTION_DELETE_AUTO_TILE, TiledPlugin.AUTO_OPEN_DROP_DOWN, - TiledPlugin.AUTO_FILL_TILES, - TiledPlugin.ACTION_SETUP_ALTERNATIVES_AUTO_TILE, + TiledPlugin.AUTO_FILL_TILES); + interests.add(TiledPlugin.ACTION_SETUP_ALTERNATIVES_AUTO_TILE, TiledPlugin.GRID_CHANGED, SettingsTab.OK_BTN_CLICKED, - TiledPlugin.ACTION_SET_GRID_SIZE_FROM_ITEM, - MsgAPI.IMAGE_BUNDLE_DROP_SINGLE, + TiledPlugin.ACTION_SET_GRID_SIZE_FROM_ITEM); + interests.add(MsgAPI.IMAGE_BUNDLE_DROP_SINGLE, MsgAPI.ACTION_DELETE_IMAGE_RESOURCE, MsgAPI.TOOL_SELECTED, - MsgAPI.ACTION_KEY_DOWN - }; + MsgAPI.ACTION_KEY_DOWN); } @Override diff --git a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/offset/OffsetPanelMediator.java b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/offset/OffsetPanelMediator.java index dadef9be..d4d0e613 100644 --- a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/offset/OffsetPanelMediator.java +++ b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/offset/OffsetPanelMediator.java @@ -2,8 +2,9 @@ package games.rednblack.editor.plugin.tiled.offset; import com.badlogic.gdx.math.Vector2; import games.rednblack.editor.plugin.tiled.TiledPlugin; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; /** * Created by mariam on 5/12/16. @@ -23,12 +24,10 @@ public class OffsetPanelMediator extends Mediator { } @Override - public String[] listNotificationInterests() { - return new String[] { - TiledPlugin.ACTION_OPEN_OFFSET_PANEL, + public void listNotificationInterests(Interests interests) { + interests.add(TiledPlugin.ACTION_OPEN_OFFSET_PANEL, TiledPlugin.TILE_GRID_OFFSET_ADDED, - TiledPlugin.TILE_SELECTED - }; + TiledPlugin.TILE_SELECTED); } @Override diff --git a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/tools/DeleteTileTool.java b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/tools/DeleteTileTool.java index abbcdf13..91ee1191 100644 --- a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/tools/DeleteTileTool.java +++ b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/tools/DeleteTileTool.java @@ -3,8 +3,6 @@ package games.rednblack.editor.plugin.tiled.tools; import java.util.HashSet; import java.util.Set; -import org.puremvc.java.interfaces.INotification; - import com.badlogic.gdx.Input; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.TextureRegion; @@ -13,6 +11,7 @@ import games.rednblack.editor.plugin.tiled.TiledPlugin; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.view.tools.Tool; import games.rednblack.h2d.common.vo.CursorData; +import games.rednblack.puremvc.interfaces.INotification; /** * Created by mariam on 4/5/16. diff --git a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/tools/DrawTileTool.java b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/tools/DrawTileTool.java index 1ce144e9..5f737cfd 100644 --- a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/tools/DrawTileTool.java +++ b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/tools/DrawTileTool.java @@ -1,7 +1,6 @@ package games.rednblack.editor.plugin.tiled.tools; import games.rednblack.h2d.extension.spine.SpineItemType; -import org.puremvc.java.interfaces.INotification; import com.badlogic.gdx.Input; import com.badlogic.gdx.graphics.Texture; @@ -21,6 +20,7 @@ import games.rednblack.editor.renderer.utils.ComponentRetriever; import games.rednblack.h2d.common.command.TransformCommandBuilder; import games.rednblack.h2d.common.view.tools.Tool; import games.rednblack.h2d.common.vo.CursorData; +import games.rednblack.puremvc.interfaces.INotification; /** * Created by mariam on 3/29/16. diff --git a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/view/dialog/AlternativeAutoTileDialogMediator.java b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/view/dialog/AlternativeAutoTileDialogMediator.java index 2b24c2f6..ebb089dc 100644 --- a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/view/dialog/AlternativeAutoTileDialogMediator.java +++ b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/view/dialog/AlternativeAutoTileDialogMediator.java @@ -1,11 +1,11 @@ package games.rednblack.editor.plugin.tiled.view.dialog; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; - import games.rednblack.editor.plugin.tiled.TiledPlugin; import games.rednblack.editor.plugin.tiled.data.AlternativeAutoTileVO; import games.rednblack.editor.plugin.tiled.data.AutoTileVO; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; /** * The mediator for messages for the alternatives. @@ -23,14 +23,12 @@ public class AlternativeAutoTileDialogMediator extends Mediator { private final PluginAPI pluginAPI; - public ImportTileSetDialogMediator(PluginAPI pluginAPI, IFacade facade) { + public ImportTileSetDialogMediator(PluginAPI pluginAPI, Facade facade) { super(NAME, new ImportTileSetDialog(facade)); this.pluginAPI = pluginAPI; } @Override - public String[] listNotificationInterests() { - return new String[] { - TiledPlugin.IMPORT_TILESET_PANEL_OPEN, - ImportTileSetDialog.IMPORT_TILESET - }; + public void listNotificationInterests(Interests interests) { + interests.add(TiledPlugin.IMPORT_TILESET_PANEL_OPEN, + ImportTileSetDialog.IMPORT_TILESET); } @Override diff --git a/src/main/java/games/rednblack/editor/ConsoleInterceptor.java b/src/main/java/games/rednblack/editor/ConsoleInterceptor.java index 0e1385f0..191a3125 100644 --- a/src/main/java/games/rednblack/editor/ConsoleInterceptor.java +++ b/src/main/java/games/rednblack/editor/ConsoleInterceptor.java @@ -1,7 +1,7 @@ package games.rednblack.editor; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.patterns.facade.Facade; +import games.rednblack.puremvc.Facade; import java.io.OutputStream; import java.io.PrintStream; @@ -12,7 +12,7 @@ public class ConsoleInterceptor extends PrintStream { public ConsoleInterceptor(OutputStream out) { super(out, true); - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); } public void setPrefix(String prefix) { diff --git a/src/main/java/games/rednblack/editor/HyperLap2D.java b/src/main/java/games/rednblack/editor/HyperLap2D.java index 479396b4..a6457128 100644 --- a/src/main/java/games/rednblack/editor/HyperLap2D.java +++ b/src/main/java/games/rednblack/editor/HyperLap2D.java @@ -31,10 +31,10 @@ import games.rednblack.editor.splash.SplashScreenAdapter; import games.rednblack.editor.view.ui.panel.ImportPanel; import games.rednblack.editor.view.ui.widget.actors.basic.WhitePixel; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.interfaces.IProxy; import org.lwjgl.BufferUtils; import org.lwjgl.glfw.GLFW; -import org.puremvc.java.interfaces.IProxy; -import org.puremvc.java.patterns.observer.Notification; import java.nio.IntBuffer; @@ -42,12 +42,10 @@ public class HyperLap2D implements IProxy, ApplicationListener, Lwjgl3WindowList private static final String TAG = HyperLap2D.class.getCanonicalName(); public static final String NAME = TAG; - private HyperLap2DFacade facade; + private Facade facade; private Object data; - private final Notification renderNotification; - - public HyperLap2DFacade getFacade() { + public Facade getFacade() { return facade; } @@ -56,20 +54,19 @@ public class HyperLap2D implements IProxy, ApplicationListener, Lwjgl3WindowList private final SettingsManager settingsManager; public HyperLap2D(SettingsManager settingsManager) { - renderNotification = new Notification(MsgAPI.RENDER, null, null); this.settingsManager = settingsManager; } @Override public void create() { - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); facade.registerProxy(settingsManager); facade.registerProxy(this); } private void startup() { - facade.startup(); - sendNotification(MsgAPI.CREATE); + facade.sendNotification(MsgAPI.STARTUP); + facade.sendNotification(MsgAPI.CREATE); facade.sendNotification(SplashScreenAdapter.CLOSE_SPLASH, "Initializing..."); Lwjgl3Graphics graphics = (Lwjgl3Graphics)Gdx.graphics; @@ -79,55 +76,38 @@ public class HyperLap2D implements IProxy, ApplicationListener, Lwjgl3WindowList int width = w.get(0); int height = h.get(0); - sendNotification(MsgAPI.RESIZE, new int[]{width, height}); + facade.sendNotification(MsgAPI.RESIZE, new int[]{width, height}); startTime = System.currentTimeMillis(); } @Override public void pause() { - sendNotification(MsgAPI.PAUSE); + facade.sendNotification(MsgAPI.PAUSE); } @Override public void resume() { - sendNotification(MsgAPI.RESUME); + facade.sendNotification(MsgAPI.RESUME); } @Override public void render() { - renderNotification.setBody(Math.min(Gdx.graphics.getDeltaTime(), 0.1f)); - facade.notifyObservers(renderNotification); + facade.sendNotification(MsgAPI.RENDER, Math.min(Gdx.graphics.getDeltaTime(), 0.1f)); } @Override public void resize(int width, int height) { - sendNotification(MsgAPI.RESIZE, new int[]{width, height}); + facade.sendNotification(MsgAPI.RESIZE, new int[]{width, height}); } @Override public void dispose() { - sendNotification(MsgAPI.DISPOSE); + facade.sendNotification(MsgAPI.DISPOSE); } @Override - public void sendNotification(String notificationName, Object body, String type) { - System.out.println("sendNotification: " + System.currentTimeMillis() + " " + type); - facade.sendNotification(notificationName, body, type); - } - - @Override - public void sendNotification(String notificationName, Object body) { - facade.sendNotification(notificationName, body); - } - - @Override - public void sendNotification(String notificationName) { - facade.sendNotification(notificationName); - } - - @Override - public String getProxyName() { + public String getName() { return NAME; } @@ -136,11 +116,6 @@ public class HyperLap2D implements IProxy, ApplicationListener, Lwjgl3WindowList return data; } - @Override - public void setData(Object data) { - this.data = data; - } - @Override public void onRegister() { ConsoleInterceptor errInterceptor = new ConsoleInterceptor(System.err); diff --git a/src/main/java/games/rednblack/editor/HyperLap2DApp.java b/src/main/java/games/rednblack/editor/HyperLap2DApp.java index 2906dcab..420c7f9a 100644 --- a/src/main/java/games/rednblack/editor/HyperLap2DApp.java +++ b/src/main/java/games/rednblack/editor/HyperLap2DApp.java @@ -10,6 +10,7 @@ import games.rednblack.editor.splash.SplashScreenAdapter; import games.rednblack.editor.utils.AppConfig; import games.rednblack.editor.utils.HyperLap2DUtils; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; +import games.rednblack.puremvc.Facade; import org.apache.commons.lang3.SystemUtils; public class HyperLap2DApp extends ApplicationAdapter { @@ -41,7 +42,7 @@ public class HyperLap2DApp extends ApplicationAdapter { public void create() { Lwjgl3ApplicationGLESFix app = (Lwjgl3ApplicationGLESFix) Gdx.app; - StandardWidgetsFactory.init(HyperLap2DFacade.getInstance()); + StandardWidgetsFactory.init(Facade.getInstance()); Lwjgl3ApplicationConfiguration config2 = new Lwjgl3ApplicationConfiguration(); config2.setWindowedMode(467, 385); diff --git a/src/main/java/games/rednblack/editor/HyperLap2DFacade.java b/src/main/java/games/rednblack/editor/HyperLap2DFacade.java deleted file mode 100644 index 0f67cb7d..00000000 --- a/src/main/java/games/rednblack/editor/HyperLap2DFacade.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * ****************************************************************************** - * * Copyright 2015 See AUTHORS file. - * * - * * Licensed under the Apache License, Version 2.0 (the "License"); - * * you may not use this file except in compliance with the License. - * * You may obtain a copy of the License at - * * - * * http://www.apache.org/licenses/LICENSE-2.0 - * * - * * Unless required by applicable law or agreed to in writing, software - * * distributed under the License is distributed on an "AS IS" BASIS, - * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * * See the License for the specific language governing permissions and - * * limitations under the License. - * ***************************************************************************** - */ - -package games.rednblack.editor; - -import games.rednblack.editor.controller.StartupCommand; -import games.rednblack.editor.splash.SplashMediator; -import games.rednblack.h2d.common.HyperLog; -import org.puremvc.java.patterns.facade.Facade; -import org.puremvc.java.patterns.observer.Notification; - -/** - * Created by sargis on 3/30/15. - */ -public class HyperLap2DFacade extends Facade { - public static final String STARTUP = "startup"; - private static HyperLap2DFacade instance = null; - - protected HyperLap2DFacade() { - super(); - } - - /** - * Facade Singleton Factory method - * - * @return The Singleton instance of the Facade - */ - public synchronized static HyperLap2DFacade getInstance() { - if (instance == null) { - instance = new HyperLap2DFacade(); - instance.registerMediator(new SplashMediator()); - HyperLog.setFacade(instance); - } - return instance; - } - - public void startup() { - notifyObservers(new Notification(STARTUP, null, null)); - } - - @Override - protected void initializeFacade() { - super.initializeFacade(); - } - - @Override - protected void initializeController() { - super.initializeController(); - registerCommand(STARTUP, StartupCommand::new); - } - - @Override - protected void initializeModel() { - super.initializeModel(); - } - - @Override - protected void initializeView() { - super.initializeView(); - } -} diff --git a/src/main/java/games/rednblack/editor/Main.java b/src/main/java/games/rednblack/editor/Main.java index b27d84dc..eee98256 100644 --- a/src/main/java/games/rednblack/editor/Main.java +++ b/src/main/java/games/rednblack/editor/Main.java @@ -3,7 +3,12 @@ package games.rednblack.editor; import com.badlogic.gdx.Graphics; import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationGLESFix; import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration; +import games.rednblack.editor.controller.StartupCommand; import games.rednblack.editor.proxy.SettingsManager; +import games.rednblack.editor.splash.SplashMediator; +import games.rednblack.h2d.common.HyperLog; +import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; import org.apache.commons.lang3.SystemUtils; import java.io.*; @@ -26,7 +31,10 @@ public class Main { //Increase default lwjgl stack size System.setProperty("org.lwjgl.system.stackSize", "256"); - HyperLap2DFacade.getInstance(); + Facade instance = Facade.getInstance(); + instance.registerMediator(new SplashMediator()); + instance.registerCommand(MsgAPI.STARTUP, StartupCommand.class); + HyperLog.setFacade(instance); Graphics.DisplayMode dm = Lwjgl3ApplicationConfiguration.getDisplayMode(); diff --git a/src/main/java/games/rednblack/editor/controller/BootstrapCommand.java b/src/main/java/games/rednblack/editor/controller/BootstrapCommand.java index 074630f4..e9c4f62a 100644 --- a/src/main/java/games/rednblack/editor/controller/BootstrapCommand.java +++ b/src/main/java/games/rednblack/editor/controller/BootstrapCommand.java @@ -18,14 +18,13 @@ package games.rednblack.editor.controller; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.*; import games.rednblack.editor.controller.commands.component.*; import games.rednblack.editor.controller.commands.resource.*; import games.rednblack.editor.splash.SplashScreenAdapter; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.command.SimpleCommand; +import games.rednblack.puremvc.commands.SimpleCommand; +import games.rednblack.puremvc.interfaces.INotification; /** * Created by azakhary on 4/28/2015. @@ -35,96 +34,96 @@ public class BootstrapCommand extends SimpleCommand { @Override public void execute(INotification notification) { super.execute(notification); - facade = HyperLap2DFacade.getInstance(); + facade.sendNotification(SplashScreenAdapter.UPDATE_SPLASH, "Loading Commands..."); - facade.registerCommand(MsgAPI.ACTION_CUT, CutItemsCommand::new); - facade.registerCommand(MsgAPI.ACTION_COPY, CopyItemsCommand::new); - facade.registerCommand(MsgAPI.ACTION_PASTE, PasteItemsCommand::new); - facade.registerCommand(MsgAPI.ACTION_DELETE, DeleteItemsCommand::new); - facade.registerCommand(MsgAPI.ACTION_CREATE_ITEM, CreateItemCommand::new); - facade.registerCommand(MsgAPI.ACTION_CAMERA_CHANGE_COMPOSITE, CompositeCameraChangeCommand::new); - facade.registerCommand(MsgAPI.ACTION_CREATE_PRIMITIVE, CreatePrimitiveCommand::new); - facade.registerCommand(MsgAPI.ACTION_CREATE_STICKY_NOTE, CreateStickyNoteCommand::new); - facade.registerCommand(MsgAPI.ACTION_CREATE_STICKY_NOTE, CreateStickyNoteCommand::new); - facade.registerCommand(MsgAPI.ACTION_REMOVE_STICKY_NOTE, RemoveStickyNoteCommand::new); - facade.registerCommand(MsgAPI.ACTION_MODIFY_STICKY_NOTE, ModifyStickyNoteCommand::new); + facade.registerCommand(MsgAPI.ACTION_CUT, CutItemsCommand.class); + facade.registerCommand(MsgAPI.ACTION_COPY, CopyItemsCommand.class); + facade.registerCommand(MsgAPI.ACTION_PASTE, PasteItemsCommand.class); + facade.registerCommand(MsgAPI.ACTION_DELETE, DeleteItemsCommand.class); + facade.registerCommand(MsgAPI.ACTION_CREATE_ITEM, CreateItemCommand.class); + facade.registerCommand(MsgAPI.ACTION_CAMERA_CHANGE_COMPOSITE, CompositeCameraChangeCommand.class); + facade.registerCommand(MsgAPI.ACTION_CREATE_PRIMITIVE, CreatePrimitiveCommand.class); + facade.registerCommand(MsgAPI.ACTION_CREATE_STICKY_NOTE, CreateStickyNoteCommand.class); + facade.registerCommand(MsgAPI.ACTION_CREATE_STICKY_NOTE, CreateStickyNoteCommand.class); + facade.registerCommand(MsgAPI.ACTION_REMOVE_STICKY_NOTE, RemoveStickyNoteCommand.class); + facade.registerCommand(MsgAPI.ACTION_MODIFY_STICKY_NOTE, ModifyStickyNoteCommand.class); - facade.registerCommand(MsgAPI.ACTION_DELETE_LAYER, DeleteLayerCommand::new); - facade.registerCommand(MsgAPI.ACTION_NEW_LAYER, NewLayerCommand::new); - facade.registerCommand(MsgAPI.ACTION_SWAP_LAYERS, LayerSwapCommand::new); - facade.registerCommand(MsgAPI.ACTION_JUMP_LAYERS, LayerJumpCommand::new); - facade.registerCommand(MsgAPI.ACTION_RENAME_LAYER, RenameLayerCommand::new); + facade.registerCommand(MsgAPI.ACTION_DELETE_LAYER, DeleteLayerCommand.class); + facade.registerCommand(MsgAPI.ACTION_NEW_LAYER, NewLayerCommand.class); + facade.registerCommand(MsgAPI.ACTION_SWAP_LAYERS, LayerSwapCommand.class); + facade.registerCommand(MsgAPI.ACTION_JUMP_LAYERS, LayerJumpCommand.class); + facade.registerCommand(MsgAPI.ACTION_RENAME_LAYER, RenameLayerCommand.class); - facade.registerCommand(MsgAPI.ACTION_ADD_COMPONENT, AddComponentToItemCommand::new); - facade.registerCommand(MsgAPI.ACTION_REMOVE_COMPONENT, RemoveComponentFromItemCommand::new); - facade.registerCommand(MsgAPI.CUSTOM_VARIABLE_MODIFY, CustomVariableModifyCommand::new); + facade.registerCommand(MsgAPI.ACTION_ADD_COMPONENT, AddComponentToItemCommand.class); + facade.registerCommand(MsgAPI.ACTION_REMOVE_COMPONENT, RemoveComponentFromItemCommand.class); + facade.registerCommand(MsgAPI.CUSTOM_VARIABLE_MODIFY, CustomVariableModifyCommand.class); - facade.registerCommand(MsgAPI.ACTION_ITEMS_MOVE_TO, ItemsMoveCommand::new); + facade.registerCommand(MsgAPI.ACTION_ITEMS_MOVE_TO, ItemsMoveCommand.class); - facade.registerCommand(MsgAPI.ACTION_ITEM_AND_CHILDREN_TO, ItemChildrenTransformCommand::new); + facade.registerCommand(MsgAPI.ACTION_ITEM_AND_CHILDREN_TO, ItemChildrenTransformCommand.class); - facade.registerCommand(MsgAPI.ACTION_ITEM_TRANSFORM_TO, ItemTransformCommand::new); - facade.registerCommand(MsgAPI.ACTION_REPLACE_REGION_DATA, ReplaceRegionCommand::new); - facade.registerCommand(MsgAPI.ACTION_REPLACE_SPRITE_ANIMATION_DATA, ReplaceSpriteAnimationCommand::new); - facade.registerCommand(MsgAPI.ACTION_REPLACE_SPINE_ANIMATION_DATA, ReplaceSpineCommand::new); - facade.registerCommand(MsgAPI.ACTION_ADD_TO_LIBRARY, AddToLibraryCommand::new); - facade.registerCommand(MsgAPI.ACTION_ADD_TO_LIBRARY_ACTION, AddToLibraryAction::new); - facade.registerCommand(MsgAPI.ACTION_CHANGE_LIBRARY_ACTION, ChangeLibraryActionCommand::new); - facade.registerCommand(MsgAPI.ACTION_CONVERT_TO_BUTTON, ConvertToButtonCommand::new); - facade.registerCommand(MsgAPI.ACTION_GROUP_ITEMS, ConvertToCompositeCommand::new); + facade.registerCommand(MsgAPI.ACTION_ITEM_TRANSFORM_TO, ItemTransformCommand.class); + facade.registerCommand(MsgAPI.ACTION_REPLACE_REGION_DATA, ReplaceRegionCommand.class); + facade.registerCommand(MsgAPI.ACTION_REPLACE_SPRITE_ANIMATION_DATA, ReplaceSpriteAnimationCommand.class); + facade.registerCommand(MsgAPI.ACTION_REPLACE_SPINE_ANIMATION_DATA, ReplaceSpineCommand.class); + facade.registerCommand(MsgAPI.ACTION_ADD_TO_LIBRARY, AddToLibraryCommand.class); + facade.registerCommand(MsgAPI.ACTION_ADD_TO_LIBRARY_ACTION, AddToLibraryAction.class); + facade.registerCommand(MsgAPI.ACTION_CHANGE_LIBRARY_ACTION, ChangeLibraryActionCommand.class); + facade.registerCommand(MsgAPI.ACTION_CONVERT_TO_BUTTON, ConvertToButtonCommand.class); + facade.registerCommand(MsgAPI.ACTION_GROUP_ITEMS, ConvertToCompositeCommand.class); - facade.registerCommand(MsgAPI.ACTION_SET_SELECTION, SetSelectionCommand::new); - facade.registerCommand(MsgAPI.ACTION_ADD_SELECTION, AddSelectionCommand::new); - facade.registerCommand(MsgAPI.ACTION_RELEASE_SELECTION, ReleaseSelectionCommand::new); + facade.registerCommand(MsgAPI.ACTION_SET_SELECTION, SetSelectionCommand.class); + facade.registerCommand(MsgAPI.ACTION_ADD_SELECTION, AddSelectionCommand.class); + facade.registerCommand(MsgAPI.ACTION_RELEASE_SELECTION, ReleaseSelectionCommand.class); - facade.registerCommand(MsgAPI.ACTION_UPDATE_RULER_POSITION, ChangeRulerPositionCommand::new); - facade.registerCommand(MsgAPI.ACTION_CHANGE_POLYGON_VERTEX_POSITION, ChangePolygonVertexPositionCommand::new); - facade.registerCommand(MsgAPI.ACTION_DELETE_POLYGON_VERTEX, DeletePolygonVertexCommand::new); - facade.registerCommand(MsgAPI.ACTION_CHANGE_ORIGIN_POSITION, ChangeOriginPointPosition::new); - facade.registerCommand(MsgAPI.ACTION_CENTER_ORIGIN_POSITION, CenterOriginPointCommand::new); + facade.registerCommand(MsgAPI.ACTION_UPDATE_RULER_POSITION, ChangeRulerPositionCommand.class); + facade.registerCommand(MsgAPI.ACTION_CHANGE_POLYGON_VERTEX_POSITION, ChangePolygonVertexPositionCommand.class); + facade.registerCommand(MsgAPI.ACTION_DELETE_POLYGON_VERTEX, DeletePolygonVertexCommand.class); + facade.registerCommand(MsgAPI.ACTION_CHANGE_ORIGIN_POSITION, ChangeOriginPointPosition.class); + facade.registerCommand(MsgAPI.ACTION_CENTER_ORIGIN_POSITION, CenterOriginPointCommand.class); // DATA MODIFY by components - facade.registerCommand(MsgAPI.ACTION_UPDATE_SCENE_DATA, UpdateSceneDataCommand::new); - facade.registerCommand(MsgAPI.ACTION_UPDATE_ITEM_DATA, UpdateEntityComponentsCommand::new); - facade.registerCommand(MsgAPI.ACTION_UPDATE_LABEL_DATA, UpdateLabelDataCommand::new); - facade.registerCommand(MsgAPI.ACTION_UPDATE_LIGHT_DATA, UpdateLightDataCommand::new); - facade.registerCommand(MsgAPI.ACTION_UPDATE_COMPOSITE_DATA, UpdateCompositeDataCommand::new); - facade.registerCommand(MsgAPI.ACTION_UPDATE_PARTICLE_DATA, UpdateParticleDataCommand::new); - facade.registerCommand(MsgAPI.ACTION_UPDATE_TALOS_DATA, UpdateTalosDataCommand::new); - facade.registerCommand(MsgAPI.ACTION_UPDATE_BODY_LIGHT_DATA, UpdateLightBodyDataCommand::new); - facade.registerCommand(MsgAPI.ACTION_UPDATE_CIRCLE_SHAPE, UpdateCircleShapeCommand::new); - facade.registerCommand(MsgAPI.ACTION_UPDATE_PHYSICS_BODY_DATA, UpdatePhysicsDataCommand::new); - facade.registerCommand(MsgAPI.ACTION_UPDATE_SENSOR_DATA, UpdateSensorDataCommand::new); - facade.registerCommand(MsgAPI.ACTION_UPDATE_SHADER_DATA, UpdateShaderDataCommand::new); - facade.registerCommand(MsgAPI.ACTION_UPDATE_IMAGE_ITEM_DATA, UpdateImageItemDataCommand::new); - facade.registerCommand(MsgAPI.ACTION_UPDATE_SPRITE_ANIMATION_DATA, UpdateSpriteAnimationDataCommand::new); - facade.registerCommand(MsgAPI.ACTION_UPDATE_SPINE_ANIMATION_DATA, UpdateSpineDataCommand::new); + facade.registerCommand(MsgAPI.ACTION_UPDATE_SCENE_DATA, UpdateSceneDataCommand.class); + facade.registerCommand(MsgAPI.ACTION_UPDATE_ITEM_DATA, UpdateEntityComponentsCommand.class); + facade.registerCommand(MsgAPI.ACTION_UPDATE_LABEL_DATA, UpdateLabelDataCommand.class); + facade.registerCommand(MsgAPI.ACTION_UPDATE_LIGHT_DATA, UpdateLightDataCommand.class); + facade.registerCommand(MsgAPI.ACTION_UPDATE_COMPOSITE_DATA, UpdateCompositeDataCommand.class); + facade.registerCommand(MsgAPI.ACTION_UPDATE_PARTICLE_DATA, UpdateParticleDataCommand.class); + facade.registerCommand(MsgAPI.ACTION_UPDATE_TALOS_DATA, UpdateTalosDataCommand.class); + facade.registerCommand(MsgAPI.ACTION_UPDATE_BODY_LIGHT_DATA, UpdateLightBodyDataCommand.class); + facade.registerCommand(MsgAPI.ACTION_UPDATE_CIRCLE_SHAPE, UpdateCircleShapeCommand.class); + facade.registerCommand(MsgAPI.ACTION_UPDATE_PHYSICS_BODY_DATA, UpdatePhysicsDataCommand.class); + facade.registerCommand(MsgAPI.ACTION_UPDATE_SENSOR_DATA, UpdateSensorDataCommand.class); + facade.registerCommand(MsgAPI.ACTION_UPDATE_SHADER_DATA, UpdateShaderDataCommand.class); + facade.registerCommand(MsgAPI.ACTION_UPDATE_IMAGE_ITEM_DATA, UpdateImageItemDataCommand.class); + facade.registerCommand(MsgAPI.ACTION_UPDATE_SPRITE_ANIMATION_DATA, UpdateSpriteAnimationDataCommand.class); + facade.registerCommand(MsgAPI.ACTION_UPDATE_SPINE_ANIMATION_DATA, UpdateSpineDataCommand.class); - facade.registerCommand(MsgAPI.ACTION_UPDATE_MESH_DATA, UpdatePolygonVerticesCommand::new); - facade.registerCommand(MsgAPI.ACTION_UPDATE_POLYGON_DATA, UpdatePolygonDataCommand::new); + facade.registerCommand(MsgAPI.ACTION_UPDATE_MESH_DATA, UpdatePolygonVerticesCommand.class); + facade.registerCommand(MsgAPI.ACTION_UPDATE_POLYGON_DATA, UpdatePolygonDataCommand.class); - facade.registerCommand(MsgAPI.ACTION_EXPORT_PROJECT, ExportProjectCommand::new); - facade.registerCommand(MsgAPI.SAVE_EXPORT_PATH, SaveExportPathCommand::new); + facade.registerCommand(MsgAPI.ACTION_EXPORT_PROJECT, ExportProjectCommand.class); + facade.registerCommand(MsgAPI.SAVE_EXPORT_PATH, SaveExportPathCommand.class); - facade.registerCommand(MsgAPI.ACTION_PLUGIN_PROXY_COMMAND, PluginItemCommand::new); + facade.registerCommand(MsgAPI.ACTION_PLUGIN_PROXY_COMMAND, PluginItemCommand.class); // Resources - facade.registerCommand(MsgAPI.ACTION_DELETE_IMAGE_RESOURCE, DeleteImageResource::new); - facade.registerCommand(MsgAPI.ACTION_DELETE_TINY_VG_RESOURCE, DeleteTinyVGResource::new); - facade.registerCommand(MsgAPI.ACTION_DELETE_SHADER, DeleteShaderCommand::new); - facade.registerCommand(MsgAPI.ACTION_DELETE_LIBRARY_ITEM, DeleteLibraryItem::new); - facade.registerCommand(MsgAPI.ACTION_DELETE_LIBRARY_ACTION, DeleteLibraryAction::new); - facade.registerCommand(MsgAPI.ACTION_DUPLICATE_LIBRARY_ACTION, DuplicateLibraryAction::new); - facade.registerCommand(MsgAPI.ACTION_EXPORT_LIBRARY_ITEM, ExportLibraryItemCommand::new); - facade.registerCommand(MsgAPI.ACTION_EXPORT_ACTION_ITEM, ExportActionCommand::new); - facade.registerCommand(MsgAPI.ACTION_RENAME_ACTION_ITEM, RenameLibraryActionCommand::new); - facade.registerCommand(MsgAPI.ACTION_DELETE_PARTICLE_EFFECT, DeleteParticleEffect::new); - facade.registerCommand(MsgAPI.ACTION_DELETE_TALOS_VFX, DeleteTalosVFX::new); - facade.registerCommand(MsgAPI.ACTION_DELETE_SPINE_ANIMATION_RESOURCE, DeleteSpineAnimation::new); - facade.registerCommand(MsgAPI.ACTION_DELETE_SPRITE_ANIMATION_RESOURCE, DeleteSpriteAnimation::new); - facade.registerCommand(MsgAPI.ACTION_DELETE_MULTIPLE_RESOURCE, DeleteMultipleResources::new); + facade.registerCommand(MsgAPI.ACTION_DELETE_IMAGE_RESOURCE, DeleteImageResource.class); + facade.registerCommand(MsgAPI.ACTION_DELETE_TINY_VG_RESOURCE, DeleteTinyVGResource.class); + facade.registerCommand(MsgAPI.ACTION_DELETE_SHADER, DeleteShaderCommand.class); + facade.registerCommand(MsgAPI.ACTION_DELETE_LIBRARY_ITEM, DeleteLibraryItem.class); + facade.registerCommand(MsgAPI.ACTION_DELETE_LIBRARY_ACTION, DeleteLibraryAction.class); + facade.registerCommand(MsgAPI.ACTION_DUPLICATE_LIBRARY_ACTION, DuplicateLibraryAction.class); + facade.registerCommand(MsgAPI.ACTION_EXPORT_LIBRARY_ITEM, ExportLibraryItemCommand.class); + facade.registerCommand(MsgAPI.ACTION_EXPORT_ACTION_ITEM, ExportActionCommand.class); + facade.registerCommand(MsgAPI.ACTION_RENAME_ACTION_ITEM, RenameLibraryActionCommand.class); + facade.registerCommand(MsgAPI.ACTION_DELETE_PARTICLE_EFFECT, DeleteParticleEffect.class); + facade.registerCommand(MsgAPI.ACTION_DELETE_TALOS_VFX, DeleteTalosVFX.class); + facade.registerCommand(MsgAPI.ACTION_DELETE_SPINE_ANIMATION_RESOURCE, DeleteSpineAnimation.class); + facade.registerCommand(MsgAPI.ACTION_DELETE_SPRITE_ANIMATION_RESOURCE, DeleteSpriteAnimation.class); + facade.registerCommand(MsgAPI.ACTION_DELETE_MULTIPLE_RESOURCE, DeleteMultipleResources.class); - facade.registerCommand(MsgAPI.SHOW_NOTIFICATION, ShowNotificationCommand::new); + facade.registerCommand(MsgAPI.SHOW_NOTIFICATION, ShowNotificationCommand.class); } } diff --git a/src/main/java/games/rednblack/editor/controller/BootstrapInfoCommand.java b/src/main/java/games/rednblack/editor/controller/BootstrapInfoCommand.java index e78d07e0..24fe49e7 100644 --- a/src/main/java/games/rednblack/editor/controller/BootstrapInfoCommand.java +++ b/src/main/java/games/rednblack/editor/controller/BootstrapInfoCommand.java @@ -4,9 +4,9 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.GL20; import games.rednblack.editor.utils.AppConfig; import games.rednblack.h2d.common.HyperLog; +import games.rednblack.puremvc.commands.SimpleCommand; +import games.rednblack.puremvc.interfaces.INotification; import org.apache.commons.lang3.SystemUtils; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.command.SimpleCommand; public class BootstrapInfoCommand extends SimpleCommand { diff --git a/src/main/java/games/rednblack/editor/controller/BootstrapPlugins.java b/src/main/java/games/rednblack/editor/controller/BootstrapPlugins.java index b8306ec8..e653e9f7 100644 --- a/src/main/java/games/rednblack/editor/controller/BootstrapPlugins.java +++ b/src/main/java/games/rednblack/editor/controller/BootstrapPlugins.java @@ -18,16 +18,16 @@ package games.rednblack.editor.controller; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.PluginManager; import games.rednblack.editor.proxy.SettingsManager; import games.rednblack.editor.splash.SplashScreenAdapter; import games.rednblack.h2d.common.plugins.H2DPlugin; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.commands.SimpleCommand; +import games.rednblack.puremvc.interfaces.INotification; import net.mountainblade.modular.Module; import net.mountainblade.modular.ModuleManager; import net.mountainblade.modular.impl.DefaultModuleManager; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.command.SimpleCommand; import java.io.File; import java.lang.reflect.InvocationTargetException; @@ -37,7 +37,6 @@ public class BootstrapPlugins extends SimpleCommand { public void execute(INotification notification) { super.execute(notification); - facade = HyperLap2DFacade.getInstance(); SettingsManager settingsManager = facade.retrieveProxy(SettingsManager.NAME); if (!settingsManager.editorConfigVO.enablePlugins) diff --git a/src/main/java/games/rednblack/editor/controller/BootstrapProxyCommand.java b/src/main/java/games/rednblack/editor/controller/BootstrapProxyCommand.java index 550c446c..f717f05c 100644 --- a/src/main/java/games/rednblack/editor/controller/BootstrapProxyCommand.java +++ b/src/main/java/games/rednblack/editor/controller/BootstrapProxyCommand.java @@ -18,12 +18,11 @@ package games.rednblack.editor.controller; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.*; import games.rednblack.editor.splash.SplashScreenAdapter; import games.rednblack.h2d.common.proxy.CursorManager; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.command.SimpleCommand; +import games.rednblack.puremvc.commands.SimpleCommand; +import games.rednblack.puremvc.interfaces.INotification; /** * Created by sargis on 4/1/15. @@ -32,7 +31,7 @@ public class BootstrapProxyCommand extends SimpleCommand { @Override public void execute(INotification notification) { super.execute(notification); - facade = HyperLap2DFacade.getInstance(); + facade.sendNotification(SplashScreenAdapter.UPDATE_SPLASH, "Loading Proxies..."); facade.registerProxy(new WindowTitleManager()); diff --git a/src/main/java/games/rednblack/editor/controller/BootstrapViewCommand.java b/src/main/java/games/rednblack/editor/controller/BootstrapViewCommand.java index d4b50321..ca18e623 100644 --- a/src/main/java/games/rednblack/editor/controller/BootstrapViewCommand.java +++ b/src/main/java/games/rednblack/editor/controller/BootstrapViewCommand.java @@ -18,7 +18,6 @@ package games.rednblack.editor.controller; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.splash.SplashScreenAdapter; import games.rednblack.editor.view.HyperLap2DScreenMediator; import games.rednblack.editor.view.menu.HyperLap2DMenuBarMediator; @@ -29,8 +28,8 @@ import games.rednblack.editor.view.ui.box.*; import games.rednblack.editor.view.ui.box.bottom.*; import games.rednblack.editor.view.ui.dialog.*; import games.rednblack.editor.view.ui.panel.*; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.command.SimpleCommand; +import games.rednblack.puremvc.commands.SimpleCommand; +import games.rednblack.puremvc.interfaces.INotification; /** * Created by sargis on 4/1/15. @@ -39,7 +38,7 @@ public class BootstrapViewCommand extends SimpleCommand { @Override public void execute(INotification notification) { super.execute(notification); - facade = HyperLap2DFacade.getInstance(); + facade.sendNotification(SplashScreenAdapter.UPDATE_SPLASH, "Loading Views..."); facade.registerMediator(new HyperLap2DScreenMediator()); diff --git a/src/main/java/games/rednblack/editor/controller/SandboxCommand.java b/src/main/java/games/rednblack/editor/controller/SandboxCommand.java index ed9d0d2e..1722f6ca 100644 --- a/src/main/java/games/rednblack/editor/controller/SandboxCommand.java +++ b/src/main/java/games/rednblack/editor/controller/SandboxCommand.java @@ -18,9 +18,8 @@ package games.rednblack.editor.controller; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.stage.Sandbox; -import org.puremvc.java.patterns.command.SimpleCommand; +import games.rednblack.puremvc.commands.SimpleCommand; /** * Created by azakhary on 4/28/2015. @@ -31,6 +30,5 @@ public class SandboxCommand extends SimpleCommand { public SandboxCommand() { sandbox = Sandbox.getInstance(); - facade = HyperLap2DFacade.getInstance(); } } diff --git a/src/main/java/games/rednblack/editor/controller/StartupCommand.java b/src/main/java/games/rednblack/editor/controller/StartupCommand.java index 9840d870..773d22cd 100644 --- a/src/main/java/games/rednblack/editor/controller/StartupCommand.java +++ b/src/main/java/games/rednblack/editor/controller/StartupCommand.java @@ -18,7 +18,7 @@ package games.rednblack.editor.controller; -import org.puremvc.java.patterns.command.MacroCommand; +import games.rednblack.puremvc.commands.MacroCommand; /** * Created by sargis on 3/30/15. @@ -28,10 +28,10 @@ public class StartupCommand extends MacroCommand { protected void initializeMacroCommand() { super.initializeMacroCommand(); - addSubCommand(BootstrapProxyCommand::new); - addSubCommand(BootstrapViewCommand::new); - addSubCommand(BootstrapInfoCommand::new); - addSubCommand(BootstrapCommand::new); - addSubCommand(BootstrapPlugins::new); + addSubCommand(new BootstrapProxyCommand()); + addSubCommand(new BootstrapViewCommand()); + addSubCommand(new BootstrapInfoCommand()); + addSubCommand(new BootstrapCommand()); + addSubCommand(new BootstrapPlugins()); } } diff --git a/src/main/java/games/rednblack/editor/controller/commands/AddComponentToItemCommand.java b/src/main/java/games/rednblack/editor/controller/commands/AddComponentToItemCommand.java index 05ca9950..84df254f 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/AddComponentToItemCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/AddComponentToItemCommand.java @@ -1,9 +1,9 @@ package games.rednblack.editor.controller.commands; import com.artemis.Component; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; /** * Created by CyberJoe on 7/2/2015. @@ -29,8 +29,8 @@ public class AddComponentToItemCommand extends EntityModifyRevertibleCommand { Component newComponent = Sandbox.getInstance().getEngine().edit(entity).create(component); sandbox.getEngine().inject(newComponent); - HyperLap2DFacade.getInstance().sendNotification(DONE, entity); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(DONE, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } @Override @@ -38,8 +38,8 @@ public class AddComponentToItemCommand extends EntityModifyRevertibleCommand { Sandbox.getInstance().getEngine().edit(entity).remove(component); Sandbox.getInstance().getEngine().process(); - HyperLap2DFacade.getInstance().sendNotification(DONE, entity); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(DONE, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } public static Object[] payload(int entity, Class component) { diff --git a/src/main/java/games/rednblack/editor/controller/commands/AddToLibraryAction.java b/src/main/java/games/rednblack/editor/controller/commands/AddToLibraryAction.java index bbc0d0e1..837454c9 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/AddToLibraryAction.java +++ b/src/main/java/games/rednblack/editor/controller/commands/AddToLibraryAction.java @@ -1,8 +1,8 @@ package games.rednblack.editor.controller.commands; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.data.GraphVO; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; public class AddToLibraryAction extends NonRevertibleCommand { @@ -17,7 +17,7 @@ public class AddToLibraryAction extends NonRevertibleCommand { GraphVO data = (GraphVO) payload[1]; libraryActions.put(key, data); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.LIBRARY_ACTIONS_UPDATED); + Facade.getInstance().sendNotification(MsgAPI.LIBRARY_ACTIONS_UPDATED); } public static Object[] getPayload(String key, GraphVO data) { diff --git a/src/main/java/games/rednblack/editor/controller/commands/AddToLibraryCommand.java b/src/main/java/games/rednblack/editor/controller/commands/AddToLibraryCommand.java index 715a630c..d3eff10e 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/AddToLibraryCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/AddToLibraryCommand.java @@ -18,13 +18,13 @@ package games.rednblack.editor.controller.commands; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.renderer.components.MainItemComponent; import games.rednblack.editor.renderer.data.CompositeItemVO; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; import java.util.HashMap; @@ -49,7 +49,7 @@ public class AddToLibraryCommand extends HistoricRevertibleCommand { MainItemComponent mainItemComponent = SandboxComponentRetriever.get(item, MainItemComponent.class); if(createdLibraryItemName.length() > 0) { - ProjectManager projectManager = HyperLap2DFacade.getInstance().retrieveProxy(ProjectManager.NAME); + ProjectManager projectManager = Facade.getInstance().retrieveProxy(ProjectManager.NAME); HashMap libraryItems = projectManager.currentProjectInfoVO.libraryItems; if (libraryItems.containsKey(createdLibraryItemName)) { @@ -74,7 +74,7 @@ public class AddToLibraryCommand extends HistoricRevertibleCommand { @Override public void undoAction() { - ProjectManager projectManager = HyperLap2DFacade.getInstance().retrieveProxy(ProjectManager.NAME); + ProjectManager projectManager = Facade.getInstance().retrieveProxy(ProjectManager.NAME); HashMap libraryItems = projectManager.currentProjectInfoVO.libraryItems; if(createdLibraryItemName.length() > 0) { diff --git a/src/main/java/games/rednblack/editor/controller/commands/CenterOriginPointCommand.java b/src/main/java/games/rednblack/editor/controller/commands/CenterOriginPointCommand.java index 4d33ae31..b125d116 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/CenterOriginPointCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/CenterOriginPointCommand.java @@ -1,11 +1,11 @@ package games.rednblack.editor.controller.commands; import com.badlogic.gdx.math.Vector2; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.components.DimensionsComponent; import games.rednblack.editor.renderer.components.TransformComponent; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.h2d.common.command.TransformCommandBuilder; +import games.rednblack.puremvc.Facade; public class CenterOriginPointCommand extends EntityModifyRevertibleCommand { @@ -30,7 +30,7 @@ public class CenterOriginPointCommand extends EntityModifyRevertibleCommand { originY = dimensionsComponent.polygon.getBoundingRectangle().height * 0.5f; } commandBuilder.setOrigin(originX, originY); - commandBuilder.execute(HyperLap2DFacade.getInstance()); + commandBuilder.execute(Facade.getInstance()); } @Override @@ -38,6 +38,6 @@ public class CenterOriginPointCommand extends EntityModifyRevertibleCommand { TransformCommandBuilder commandBuilder = new TransformCommandBuilder(); commandBuilder.begin(entity, sandbox.getEngine()); commandBuilder.setOrigin(backupOrigin.x, backupOrigin.y); - commandBuilder.execute(HyperLap2DFacade.getInstance()); + commandBuilder.execute(Facade.getInstance()); } } diff --git a/src/main/java/games/rednblack/editor/controller/commands/ChangeOriginPointPosition.java b/src/main/java/games/rednblack/editor/controller/commands/ChangeOriginPointPosition.java index 63faba70..186163e1 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/ChangeOriginPointPosition.java +++ b/src/main/java/games/rednblack/editor/controller/commands/ChangeOriginPointPosition.java @@ -1,6 +1,5 @@ package games.rednblack.editor.controller.commands; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.SandboxCommand; import games.rednblack.editor.renderer.components.TransformComponent; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; @@ -8,7 +7,8 @@ import games.rednblack.editor.view.ui.validator.FloatInputValidator; import games.rednblack.h2d.common.command.TransformCommandBuilder; import games.rednblack.h2d.common.view.ui.dialog.MultipleInputDialog; import games.rednblack.h2d.common.view.ui.listener.MultipleInputDialogListener; -import org.puremvc.java.interfaces.INotification; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.interfaces.INotification; public class ChangeOriginPointPosition extends SandboxCommand { @@ -25,7 +25,7 @@ public class ChangeOriginPointPosition extends SandboxCommand { TransformCommandBuilder commandBuilder = new TransformCommandBuilder(); commandBuilder.begin(entity, sandbox.getEngine()); commandBuilder.setOrigin(Float.parseFloat(input[0]), Float.parseFloat(input[1])); - commandBuilder.execute(HyperLap2DFacade.getInstance()); + commandBuilder.execute(Facade.getInstance()); } @Override diff --git a/src/main/java/games/rednblack/editor/controller/commands/ChangePolygonVertexPositionCommand.java b/src/main/java/games/rednblack/editor/controller/commands/ChangePolygonVertexPositionCommand.java index 950ccc9d..fd802b5f 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/ChangePolygonVertexPositionCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/ChangePolygonVertexPositionCommand.java @@ -3,7 +3,6 @@ package games.rednblack.editor.controller.commands; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.IntSet; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.SandboxCommand; import games.rednblack.editor.controller.commands.component.UpdatePolygonVerticesCommand; import games.rednblack.editor.renderer.components.shape.PolygonShapeComponent; @@ -14,7 +13,8 @@ import games.rednblack.editor.view.ui.validator.FloatInputValidator; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.view.ui.dialog.MultipleInputDialog; import games.rednblack.h2d.common.view.ui.listener.MultipleInputDialogListener; -import org.puremvc.java.interfaces.INotification; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.interfaces.INotification; public class ChangePolygonVertexPositionCommand extends SandboxCommand { @@ -42,7 +42,7 @@ public class ChangePolygonVertexPositionCommand extends SandboxCommand { if (polygonShapeComponent.openEnded) { UpdatePolygonVerticesCommand.payload(currentCommandPayload, polygonShapeComponent.vertices, polygonShapeComponent.polygonizedVertices); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_UPDATE_MESH_DATA, currentCommandPayload); + Facade.getInstance().sendNotification(MsgAPI.ACTION_UPDATE_MESH_DATA, currentCommandPayload); return; } @@ -56,7 +56,7 @@ public class ChangePolygonVertexPositionCommand extends SandboxCommand { polygonShapeComponent.polygonizedVertices = PolygonUtils.polygonize(polygonShapeComponent.vertices.toArray()); UpdatePolygonVerticesCommand.payload(currentCommandPayload, polygonShapeComponent.vertices, polygonShapeComponent.polygonizedVertices); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_UPDATE_MESH_DATA, currentCommandPayload); + Facade.getInstance().sendNotification(MsgAPI.ACTION_UPDATE_MESH_DATA, currentCommandPayload); } else { points.get(anchor).set(backup); } diff --git a/src/main/java/games/rednblack/editor/controller/commands/ConvertToCompositeCommand.java b/src/main/java/games/rednblack/editor/controller/commands/ConvertToCompositeCommand.java index fadbf1ea..eb9eeaf1 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/ConvertToCompositeCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/ConvertToCompositeCommand.java @@ -19,7 +19,6 @@ package games.rednblack.editor.controller.commands; import com.badlogic.gdx.math.Vector2; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.factory.ItemFactory; import games.rednblack.editor.renderer.components.DimensionsComponent; import games.rednblack.editor.renderer.components.TransformComponent; @@ -29,6 +28,7 @@ import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.editor.view.ui.FollowersUIMediator; import games.rednblack.editor.view.ui.box.UILayerBoxMediator; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; import java.util.HashMap; import java.util.HashSet; @@ -99,15 +99,15 @@ public class ConvertToCompositeCommand extends EntityModifyRevertibleCommand { sandbox.getEngine().process(); //let everyone know - HyperLap2DFacade.getInstance().sendNotification(DONE); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.NEW_ITEM_ADDED, entity); + Facade.getInstance().sendNotification(DONE); + Facade.getInstance().sendNotification(MsgAPI.NEW_ITEM_ADDED, entity); sandbox.getSelector().setSelection(entity, true); } @Override public void undoAction() { - FollowersUIMediator followersUIMediator = HyperLap2DFacade.getInstance().retrieveMediator(FollowersUIMediator.NAME); + FollowersUIMediator followersUIMediator = Facade.getInstance().retrieveMediator(FollowersUIMediator.NAME); //get the entity int entity = EntityUtils.getByUniqueId(entityId); @@ -139,7 +139,7 @@ public class ConvertToCompositeCommand extends EntityModifyRevertibleCommand { sandbox.getEngine().delete(entity); sandbox.getEngine().process(); - HyperLap2DFacade.getInstance().sendNotification(DONE); + Facade.getInstance().sendNotification(DONE); sandbox.getSelector().setSelections(children, true); diff --git a/src/main/java/games/rednblack/editor/controller/commands/CreateItemCommand.java b/src/main/java/games/rednblack/editor/controller/commands/CreateItemCommand.java index 0f9d2f41..f00df22a 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/CreateItemCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/CreateItemCommand.java @@ -18,7 +18,6 @@ package games.rednblack.editor.controller.commands; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.components.NodeComponent; import games.rednblack.editor.renderer.components.ZIndexComponent; import games.rednblack.editor.renderer.factory.EntityFactory; @@ -27,6 +26,7 @@ import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.ui.FollowersUIMediator; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; import java.util.HashSet; import java.util.Set; @@ -60,7 +60,7 @@ public class CreateItemCommand extends EntityModifyRevertibleCommand { zindexComponent.setZIndex(nodeComponent.children.size); sandbox.getEngine().process(); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.NEW_ITEM_ADDED, entity); + Facade.getInstance().sendNotification(MsgAPI.NEW_ITEM_ADDED, entity); Set items = new HashSet<>(); items.add(entity); @@ -72,7 +72,7 @@ public class CreateItemCommand extends EntityModifyRevertibleCommand { int entity = EntityUtils.getByUniqueId(entityId); serializedEntity = EntityUtils.getJsonStringFromEntity(entity); - FollowersUIMediator followersUIMediator = HyperLap2DFacade.getInstance().retrieveMediator(FollowersUIMediator.NAME); + FollowersUIMediator followersUIMediator = Facade.getInstance().retrieveMediator(FollowersUIMediator.NAME); followersUIMediator.removeFollower(entity); sandbox.getEngine().delete(entity); diff --git a/src/main/java/games/rednblack/editor/controller/commands/CutItemsCommand.java b/src/main/java/games/rednblack/editor/controller/commands/CutItemsCommand.java index e068ca16..b2cdb688 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/CutItemsCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/CutItemsCommand.java @@ -19,12 +19,12 @@ package games.rednblack.editor.controller.commands; import com.badlogic.gdx.utils.Json; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.data.CompositeItemVO; import games.rednblack.editor.renderer.utils.HyperJson; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; import java.util.Set; @@ -54,7 +54,7 @@ public class CutItemsCommand extends EntityModifyRevertibleCommand { sandbox.getEngine().process(); for (int entity : newEntitiesList) { - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.NEW_ITEM_ADDED, entity); + Facade.getInstance().sendNotification(MsgAPI.NEW_ITEM_ADDED, entity); } sandbox.getSelector().setSelections(newEntitiesList, true); diff --git a/src/main/java/games/rednblack/editor/controller/commands/DeleteItemsCommand.java b/src/main/java/games/rednblack/editor/controller/commands/DeleteItemsCommand.java index 72746ac6..57d8ae62 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/DeleteItemsCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/DeleteItemsCommand.java @@ -20,12 +20,12 @@ package games.rednblack.editor.controller.commands; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Json; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.data.CompositeItemVO; import games.rednblack.editor.renderer.utils.HyperJson; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.view.ui.FollowersUIMediator; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; import java.util.HashSet; import java.util.Set; @@ -59,7 +59,7 @@ public class DeleteItemsCommand extends EntityModifyRevertibleCommand { public void doAction() { backup(); - FollowersUIMediator followersUIMediator = HyperLap2DFacade.getInstance().retrieveMediator(FollowersUIMediator.NAME); + FollowersUIMediator followersUIMediator = Facade.getInstance().retrieveMediator(FollowersUIMediator.NAME); for (Integer entityId : entityIdsToDelete) { int item = EntityUtils.getByUniqueId(entityId); followersUIMediator.removeFollower(item); @@ -81,7 +81,7 @@ public class DeleteItemsCommand extends EntityModifyRevertibleCommand { sandbox.getEngine().process(); for (int entity : newEntitiesList) { - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.NEW_ITEM_ADDED, entity); + Facade.getInstance().sendNotification(MsgAPI.NEW_ITEM_ADDED, entity); } sandbox.getSelector().setSelections(newEntitiesList, true); diff --git a/src/main/java/games/rednblack/editor/controller/commands/DeletePolygonVertexCommand.java b/src/main/java/games/rednblack/editor/controller/commands/DeletePolygonVertexCommand.java index 9f21baaa..fb718f23 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/DeletePolygonVertexCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/DeletePolygonVertexCommand.java @@ -3,7 +3,6 @@ package games.rednblack.editor.controller.commands; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; import com.kotcrab.vis.ui.util.dialog.Dialogs; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.SandboxCommand; import games.rednblack.editor.controller.commands.component.UpdatePolygonVerticesCommand; import games.rednblack.editor.renderer.components.shape.PolygonShapeComponent; @@ -11,7 +10,8 @@ import games.rednblack.editor.utils.poly.PolygonUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.editor.view.ui.followers.PolygonFollower; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.interfaces.INotification; public class DeletePolygonVertexCommand extends SandboxCommand { @@ -53,7 +53,7 @@ public class DeletePolygonVertexCommand extends SandboxCommand { } UpdatePolygonVerticesCommand.payload(currentCommandPayload, polygonShapeComponent.vertices, polygonShapeComponent.polygonizedVertices); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_UPDATE_MESH_DATA, currentCommandPayload); + Facade.getInstance().sendNotification(MsgAPI.ACTION_UPDATE_MESH_DATA, currentCommandPayload); follower.update(); } diff --git a/src/main/java/games/rednblack/editor/controller/commands/EntityModifyRevertibleCommand.java b/src/main/java/games/rednblack/editor/controller/commands/EntityModifyRevertibleCommand.java index 1954060e..934b885f 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/EntityModifyRevertibleCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/EntityModifyRevertibleCommand.java @@ -19,7 +19,6 @@ package games.rednblack.editor.controller.commands; import com.badlogic.gdx.utils.Array; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.renderer.components.MainItemComponent; import games.rednblack.editor.renderer.components.NodeComponent; @@ -27,6 +26,7 @@ import games.rednblack.editor.renderer.data.CompositeItemVO; import games.rednblack.editor.renderer.factory.EntityFactory; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; +import games.rednblack.puremvc.Facade; import java.util.HashMap; @@ -55,7 +55,7 @@ public abstract class EntityModifyRevertibleCommand extends HistoricRevertibleCo String link = mainItemComponent.libraryLink; if(link != null && link.length() > 0) { - ProjectManager projectManager = HyperLap2DFacade.getInstance().retrieveProxy(ProjectManager.NAME); + ProjectManager projectManager = Facade.getInstance().retrieveProxy(ProjectManager.NAME); HashMap libraryItems = projectManager.currentProjectInfoVO.libraryItems; if (libraryItems.containsKey(mainItemComponent.libraryLink)) { CompositeItemVO itemVO = new CompositeItemVO(); diff --git a/src/main/java/games/rednblack/editor/controller/commands/ExportProjectCommand.java b/src/main/java/games/rednblack/editor/controller/commands/ExportProjectCommand.java index 22722999..0b141baf 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/ExportProjectCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/ExportProjectCommand.java @@ -21,7 +21,7 @@ package games.rednblack.editor.controller.commands; import games.rednblack.editor.controller.SandboxCommand; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; +import games.rednblack.puremvc.interfaces.INotification; public class ExportProjectCommand extends SandboxCommand { diff --git a/src/main/java/games/rednblack/editor/controller/commands/ItemChildrenTransformCommand.java b/src/main/java/games/rednblack/editor/controller/commands/ItemChildrenTransformCommand.java index dbe89804..0b010b98 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/ItemChildrenTransformCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/ItemChildrenTransformCommand.java @@ -2,12 +2,12 @@ package games.rednblack.editor.controller.commands; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.components.DimensionsComponent; import games.rednblack.editor.renderer.components.TransformComponent; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; import java.util.HashMap; import java.util.Map; @@ -85,7 +85,7 @@ public class ItemChildrenTransformCommand extends EntityModifyRevertibleCommand transformComponent.x = newPos.x; transformComponent.y = newPos.y; } - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } @Override @@ -99,7 +99,7 @@ public class ItemChildrenTransformCommand extends EntityModifyRevertibleCommand transformComponent.x = oldPosition.x; transformComponent.y = oldPosition.y; } - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } private void setState(TransformComponent tC, Vector2 position, DimensionsComponent dC, Vector2 size) { diff --git a/src/main/java/games/rednblack/editor/controller/commands/ItemTransformCommand.java b/src/main/java/games/rednblack/editor/controller/commands/ItemTransformCommand.java index c6fa650a..3b5db89d 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/ItemTransformCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/ItemTransformCommand.java @@ -2,12 +2,12 @@ package games.rednblack.editor.controller.commands; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.components.DimensionsComponent; import games.rednblack.editor.renderer.components.TransformComponent; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; /** * Created by Osman on 01.08.2015. @@ -47,7 +47,7 @@ public class ItemTransformCommand extends EntityModifyRevertibleCommand { EntityUtils.refreshComponents(entity); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } @Override @@ -80,6 +80,6 @@ public class ItemTransformCommand extends EntityModifyRevertibleCommand { EntityUtils.refreshComponents(entity); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } } diff --git a/src/main/java/games/rednblack/editor/controller/commands/ItemsMoveCommand.java b/src/main/java/games/rednblack/editor/controller/commands/ItemsMoveCommand.java index abf30d89..874adcb7 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/ItemsMoveCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/ItemsMoveCommand.java @@ -20,11 +20,11 @@ package games.rednblack.editor.controller.commands; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.components.TransformComponent; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; import java.util.HashMap; import java.util.Map; @@ -60,7 +60,7 @@ public class ItemsMoveCommand extends EntityModifyRevertibleCommand { transformComponent.y = newLocation.y; // pining UI to update current item properties tools - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity, TAG); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity, TAG); } } @@ -77,7 +77,7 @@ public class ItemsMoveCommand extends EntityModifyRevertibleCommand { transformComponent.y = prevLocation.y; // pining UI to update current item properties tools - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity, TAG); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity, TAG); } } diff --git a/src/main/java/games/rednblack/editor/controller/commands/NonRevertibleCommand.java b/src/main/java/games/rednblack/editor/controller/commands/NonRevertibleCommand.java index 8f70824f..8c7da437 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/NonRevertibleCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/NonRevertibleCommand.java @@ -7,7 +7,8 @@ import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.proxy.SettingsManager; import games.rednblack.editor.renderer.data.CompositeItemVO; import games.rednblack.editor.renderer.data.GraphVO; -import org.puremvc.java.interfaces.INotification; +import games.rednblack.puremvc.Notification; +import games.rednblack.puremvc.interfaces.INotification; import java.util.HashMap; @@ -36,7 +37,7 @@ public abstract class NonRevertibleCommand extends SandboxCommand { @Override public void execute(INotification notification) { commandManager = facade.retrieveProxy(CommandManager.NAME); - this.notification = notification; + this.notification = ((Notification) notification).copy(); if (showConfirmDialog) { Dialogs.showConfirmDialog(sandbox.getUIStage(), confirmDialogTitle(), confirmDialogMessage(), diff --git a/src/main/java/games/rednblack/editor/controller/commands/PasteItemsCommand.java b/src/main/java/games/rednblack/editor/controller/commands/PasteItemsCommand.java index 3ef9003c..f5875200 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/PasteItemsCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/PasteItemsCommand.java @@ -21,7 +21,6 @@ package games.rednblack.editor.controller.commands; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Json; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.components.TransformComponent; import games.rednblack.editor.renderer.components.ZIndexComponent; import games.rednblack.editor.renderer.data.CompositeItemVO; @@ -34,6 +33,7 @@ import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.ui.FollowersUIMediator; import games.rednblack.editor.view.ui.box.UILayerBoxMediator; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; import java.util.HashSet; import java.util.Set; @@ -73,7 +73,7 @@ public class PasteItemsCommand extends EntityModifyRevertibleCommand { ZIndexComponent zIndexComponent = SandboxComponentRetriever.get(entity, ZIndexComponent.class); // UILayerBoxMediator layerBoxMediator = facade.retrieveMediator(UILayerBoxMediator.NAME); zIndexComponent.layerName = layerBoxMediator.getCurrentSelectedLayerName(); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.NEW_ITEM_ADDED, entity); + Facade.getInstance().sendNotification(MsgAPI.NEW_ITEM_ADDED, entity); pastedEntityIds.add(EntityUtils.getEntityId(entity)); } sandbox.getSelector().setSelections(newEntitiesList, true); @@ -81,7 +81,7 @@ public class PasteItemsCommand extends EntityModifyRevertibleCommand { @Override public void undoAction() { - FollowersUIMediator followersUIMediator = HyperLap2DFacade.getInstance().retrieveMediator(FollowersUIMediator.NAME); + FollowersUIMediator followersUIMediator = Facade.getInstance().retrieveMediator(FollowersUIMediator.NAME); for (Integer entityId : pastedEntityIds) { int entity = EntityUtils.getByUniqueId(entityId); followersUIMediator.removeFollower(entity); diff --git a/src/main/java/games/rednblack/editor/controller/commands/RemoveComponentFromItemCommand.java b/src/main/java/games/rednblack/editor/controller/commands/RemoveComponentFromItemCommand.java index 7c2a7057..5297f642 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/RemoveComponentFromItemCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/RemoveComponentFromItemCommand.java @@ -1,11 +1,11 @@ package games.rednblack.editor.controller.commands; import com.artemis.Component; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.utils.runtime.ComponentCloner; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; /** * Created by CyberJoe on 7/2/2015. @@ -32,8 +32,8 @@ public class RemoveComponentFromItemCommand extends EntityModifyRevertibleComman sandbox.getEngine().edit(entity).remove(component.getClass()); sandbox.getEngine().process(); - HyperLap2DFacade.getInstance().sendNotification(DONE, entity); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(DONE, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); Sandbox.getInstance().getSceneControl().sceneLoader.getRenderer().removeSpecialEntity(entity); } @@ -45,8 +45,8 @@ public class RemoveComponentFromItemCommand extends EntityModifyRevertibleComman ComponentCloner.set(newComponent, component); } - HyperLap2DFacade.getInstance().sendNotification(DONE, entity); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(DONE, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } public static Object[] payload(int entity, Class componentClass) { diff --git a/src/main/java/games/rednblack/editor/controller/commands/RenameLibraryActionCommand.java b/src/main/java/games/rednblack/editor/controller/commands/RenameLibraryActionCommand.java index 43159606..2bc61823 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/RenameLibraryActionCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/RenameLibraryActionCommand.java @@ -4,7 +4,7 @@ import com.kotcrab.vis.ui.util.dialog.Dialogs; import com.kotcrab.vis.ui.util.dialog.InputDialogAdapter; import games.rednblack.editor.controller.SandboxCommand; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; +import games.rednblack.puremvc.interfaces.INotification; public class RenameLibraryActionCommand extends SandboxCommand { private static final String CLASS_NAME = "games.rednblack.editor.controller.commands.resource.RenameActionCommand"; diff --git a/src/main/java/games/rednblack/editor/controller/commands/RevertibleCommand.java b/src/main/java/games/rednblack/editor/controller/commands/RevertibleCommand.java index 41d97c52..19f072c2 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/RevertibleCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/RevertibleCommand.java @@ -20,7 +20,8 @@ package games.rednblack.editor.controller.commands; import games.rednblack.editor.controller.SandboxCommand; import games.rednblack.editor.proxy.CommandManager; -import org.puremvc.java.interfaces.INotification; +import games.rednblack.puremvc.Notification; +import games.rednblack.puremvc.interfaces.INotification; public abstract class RevertibleCommand extends SandboxCommand { @@ -33,7 +34,7 @@ public abstract class RevertibleCommand extends SandboxCommand { @Override public void execute(INotification notification) { commandManager = facade.retrieveProxy(CommandManager.NAME); - this.notification = notification; + this.notification = ((Notification) notification).copy();; callDoAction(); stateDone = true; if(!isCancelled) commandManager.addCommand(this); diff --git a/src/main/java/games/rednblack/editor/controller/commands/SaveExportPathCommand.java b/src/main/java/games/rednblack/editor/controller/commands/SaveExportPathCommand.java index 14a39e2b..e5fe90c5 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/SaveExportPathCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/SaveExportPathCommand.java @@ -20,7 +20,7 @@ package games.rednblack.editor.controller.commands; import games.rednblack.editor.controller.SandboxCommand; import games.rednblack.editor.proxy.ProjectManager; -import org.puremvc.java.interfaces.INotification; +import games.rednblack.puremvc.interfaces.INotification; /** * Created by azakhary on 11/12/2015. diff --git a/src/main/java/games/rednblack/editor/controller/commands/ShowNotificationCommand.java b/src/main/java/games/rednblack/editor/controller/commands/ShowNotificationCommand.java index 01e7e013..e8d7bdb1 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/ShowNotificationCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/ShowNotificationCommand.java @@ -3,7 +3,7 @@ package games.rednblack.editor.controller.commands; import com.kotcrab.vis.ui.widget.toast.MessageToast; import games.rednblack.editor.controller.SandboxCommand; import games.rednblack.h2d.common.HyperLog; -import org.puremvc.java.interfaces.INotification; +import games.rednblack.puremvc.interfaces.INotification; public class ShowNotificationCommand extends SandboxCommand { private static final String CLASS_NAME = "games.rednblack.editor.controller.commands.ShowNotificationCommand"; diff --git a/src/main/java/games/rednblack/editor/controller/commands/TransactiveCommand.java b/src/main/java/games/rednblack/editor/controller/commands/TransactiveCommand.java index f6ee5cb6..eaefd4d8 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/TransactiveCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/TransactiveCommand.java @@ -1,7 +1,7 @@ package games.rednblack.editor.controller.commands; import com.badlogic.gdx.utils.Array; -import org.puremvc.java.interfaces.INotification; +import games.rednblack.puremvc.interfaces.INotification; /** * Created by CyberJoe on 7/25/2015. diff --git a/src/main/java/games/rednblack/editor/controller/commands/UpdateEntityComponentsCommand.java b/src/main/java/games/rednblack/editor/controller/commands/UpdateEntityComponentsCommand.java index 1d268bef..6b77d7b4 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/UpdateEntityComponentsCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/UpdateEntityComponentsCommand.java @@ -20,11 +20,11 @@ package games.rednblack.editor.controller.commands; import com.artemis.Component; import com.badlogic.gdx.utils.Array; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.utils.runtime.ComponentCloner; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; /** * Created by azakhary on 6/3/2015. @@ -53,7 +53,7 @@ public class UpdateEntityComponentsCommand extends EntityModifyRevertibleCommand EntityUtils.refreshComponents(entity); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } @Override diff --git a/src/main/java/games/rednblack/editor/controller/commands/UpdatePolygonDataCommand.java b/src/main/java/games/rednblack/editor/controller/commands/UpdatePolygonDataCommand.java index c27ec0f3..e9b9b114 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/UpdatePolygonDataCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/UpdatePolygonDataCommand.java @@ -2,12 +2,12 @@ package games.rednblack.editor.controller.commands; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.components.shape.PolygonShapeComponent; import games.rednblack.editor.utils.poly.PolygonUtils; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; public class UpdatePolygonDataCommand extends EntityModifyRevertibleCommand { @@ -29,7 +29,7 @@ public class UpdatePolygonDataCommand extends EntityModifyRevertibleCommand { checkPolygon(polygonShapeComponent); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } @Override @@ -41,7 +41,7 @@ public class UpdatePolygonDataCommand extends EntityModifyRevertibleCommand { checkPolygon(polygonShapeComponent); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } private void checkPolygon(PolygonShapeComponent polygonShapeComponent) { diff --git a/src/main/java/games/rednblack/editor/controller/commands/component/ReplaceRegionCommand.java b/src/main/java/games/rednblack/editor/controller/commands/component/ReplaceRegionCommand.java index d7294a4a..18086a96 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/component/ReplaceRegionCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/component/ReplaceRegionCommand.java @@ -1,7 +1,6 @@ package games.rednblack.editor.controller.commands.component; import com.badlogic.gdx.graphics.g2d.TextureRegion; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.EntityModifyRevertibleCommand; import games.rednblack.editor.renderer.components.DimensionsComponent; import games.rednblack.editor.renderer.components.TextureRegionComponent; @@ -11,6 +10,7 @@ import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; public class ReplaceRegionCommand extends EntityModifyRevertibleCommand { @@ -44,7 +44,7 @@ public class ReplaceRegionCommand extends EntityModifyRevertibleCommand { transformComponent.originX = size.width / 2; transformComponent.originY = size.height / 2; - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } @Override @@ -65,6 +65,6 @@ public class ReplaceRegionCommand extends EntityModifyRevertibleCommand { transformComponent.originX = size.width / 2; transformComponent.originY = size.height / 2; - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } } diff --git a/src/main/java/games/rednblack/editor/controller/commands/component/ReplaceSpineCommand.java b/src/main/java/games/rednblack/editor/controller/commands/component/ReplaceSpineCommand.java index 102ed299..e3475454 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/component/ReplaceSpineCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/component/ReplaceSpineCommand.java @@ -1,7 +1,6 @@ package games.rednblack.editor.controller.commands.component; import com.esotericsoftware.spine.*; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.EntityModifyRevertibleCommand; import games.rednblack.editor.renderer.components.DimensionsComponent; import games.rednblack.editor.renderer.components.TransformComponent; @@ -9,6 +8,7 @@ import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.extension.spine.SpineComponent; +import games.rednblack.puremvc.Facade; public class ReplaceSpineCommand extends EntityModifyRevertibleCommand { @@ -55,7 +55,7 @@ public class ReplaceSpineCommand extends EntityModifyRevertibleCommand { spineComponent.currentAnimationName = currentAnimName; spineComponent.setAnimation(currentAnimName); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } @Override @@ -85,6 +85,6 @@ public class ReplaceSpineCommand extends EntityModifyRevertibleCommand { spineComponent.currentAnimationName = currentAnimName; spineComponent.setAnimation(currentAnimName); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } } diff --git a/src/main/java/games/rednblack/editor/controller/commands/component/ReplaceSpriteAnimationCommand.java b/src/main/java/games/rednblack/editor/controller/commands/component/ReplaceSpriteAnimationCommand.java index ecef60b4..714d65a8 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/component/ReplaceSpriteAnimationCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/component/ReplaceSpriteAnimationCommand.java @@ -3,7 +3,6 @@ package games.rednblack.editor.controller.commands.component; import com.badlogic.gdx.graphics.g2d.Animation; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.utils.Array; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.EntityModifyRevertibleCommand; import games.rednblack.editor.renderer.components.DimensionsComponent; import games.rednblack.editor.renderer.components.TextureRegionComponent; @@ -16,6 +15,7 @@ import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; public class ReplaceSpriteAnimationCommand extends EntityModifyRevertibleCommand { @@ -61,7 +61,7 @@ public class ReplaceSpriteAnimationCommand extends EntityModifyRevertibleCommand transformComponent.originX = size.width / 2; transformComponent.originY = size.height / 2; - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } @Override @@ -94,6 +94,6 @@ public class ReplaceSpriteAnimationCommand extends EntityModifyRevertibleCommand transformComponent.originX = size.width / 2; transformComponent.originY = size.height / 2; - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } } diff --git a/src/main/java/games/rednblack/editor/controller/commands/component/UpdateCircleShapeCommand.java b/src/main/java/games/rednblack/editor/controller/commands/component/UpdateCircleShapeCommand.java index 5c30611d..659484cd 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/component/UpdateCircleShapeCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/component/UpdateCircleShapeCommand.java @@ -1,12 +1,12 @@ package games.rednblack.editor.controller.commands.component; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.EntityModifyRevertibleCommand; import games.rednblack.editor.renderer.components.shape.CircleShapeComponent; import games.rednblack.editor.renderer.components.physics.PhysicsBodyComponent; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; public class UpdateCircleShapeCommand extends EntityModifyRevertibleCommand { private int entityId; @@ -29,7 +29,7 @@ public class UpdateCircleShapeCommand extends EntityModifyRevertibleCommand { if (physicsBodyComponent != null) physicsBodyComponent.scheduleRefresh(); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } @Override @@ -43,7 +43,7 @@ public class UpdateCircleShapeCommand extends EntityModifyRevertibleCommand { if (physicsBodyComponent != null) physicsBodyComponent.scheduleRefresh(); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } public static Object payload(int entity, float radius) { diff --git a/src/main/java/games/rednblack/editor/controller/commands/component/UpdateCompositeDataCommand.java b/src/main/java/games/rednblack/editor/controller/commands/component/UpdateCompositeDataCommand.java index 27ac9a09..701f1f5a 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/component/UpdateCompositeDataCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/component/UpdateCompositeDataCommand.java @@ -1,6 +1,5 @@ package games.rednblack.editor.controller.commands.component; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.EntityModifyRevertibleCommand; import games.rednblack.editor.renderer.components.CompositeTransformComponent; import games.rednblack.editor.renderer.components.MainItemComponent; @@ -8,6 +7,7 @@ import games.rednblack.editor.renderer.data.CompositeItemVO; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; public class UpdateCompositeDataCommand extends EntityModifyRevertibleCommand { private Integer entityId; @@ -28,7 +28,7 @@ public class UpdateCompositeDataCommand extends EntityModifyRevertibleCommand { transformComponent.scissorsEnabled = vo.scissorsEnabled; transformComponent.renderToFBO = vo.renderToFBO; - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); if (!transformComponent.renderToFBO) { String tag = SandboxComponentRetriever.get(entity, MainItemComponent.class).itemIdentifier; @@ -45,7 +45,7 @@ public class UpdateCompositeDataCommand extends EntityModifyRevertibleCommand { transformComponent.scissorsEnabled = backup.scissorsEnabled; transformComponent.renderToFBO = backup.renderToFBO; - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); if (!transformComponent.renderToFBO) { String tag = SandboxComponentRetriever.get(entity, MainItemComponent.class).itemIdentifier; diff --git a/src/main/java/games/rednblack/editor/controller/commands/component/UpdateImageItemDataCommand.java b/src/main/java/games/rednblack/editor/controller/commands/component/UpdateImageItemDataCommand.java index 520b3338..46c82d59 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/component/UpdateImageItemDataCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/component/UpdateImageItemDataCommand.java @@ -1,6 +1,5 @@ package games.rednblack.editor.controller.commands.component; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.EntityModifyRevertibleCommand; import games.rednblack.editor.renderer.components.DimensionsComponent; import games.rednblack.editor.renderer.components.TextureRegionComponent; @@ -8,6 +7,7 @@ import games.rednblack.editor.renderer.data.SimpleImageVO; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; public class UpdateImageItemDataCommand extends EntityModifyRevertibleCommand { @@ -31,7 +31,7 @@ public class UpdateImageItemDataCommand extends EntityModifyRevertibleCommand { updateEntity(entity); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } @Override @@ -44,7 +44,7 @@ public class UpdateImageItemDataCommand extends EntityModifyRevertibleCommand { updateEntity(entity); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } private void updateEntity(int entity) { diff --git a/src/main/java/games/rednblack/editor/controller/commands/component/UpdateLightBodyDataCommand.java b/src/main/java/games/rednblack/editor/controller/commands/component/UpdateLightBodyDataCommand.java index 0d7c0551..a74b92ac 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/component/UpdateLightBodyDataCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/component/UpdateLightBodyDataCommand.java @@ -1,12 +1,12 @@ package games.rednblack.editor.controller.commands.component; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.EntityModifyRevertibleCommand; import games.rednblack.editor.renderer.components.light.LightBodyComponent; import games.rednblack.editor.renderer.data.LightBodyDataVO; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; public class UpdateLightBodyDataCommand extends EntityModifyRevertibleCommand { @@ -43,7 +43,7 @@ public class UpdateLightBodyDataCommand extends EntityModifyRevertibleCommand { lightComponent.scheduleRefresh(); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } @Override @@ -69,7 +69,7 @@ public class UpdateLightBodyDataCommand extends EntityModifyRevertibleCommand { lightComponent.scheduleRefresh(); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } public static Object payload(int entity, LightBodyDataVO vo) { diff --git a/src/main/java/games/rednblack/editor/controller/commands/component/UpdateLightDataCommand.java b/src/main/java/games/rednblack/editor/controller/commands/component/UpdateLightDataCommand.java index 2a9f6230..c71c6bfd 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/component/UpdateLightDataCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/component/UpdateLightDataCommand.java @@ -18,13 +18,13 @@ package games.rednblack.editor.controller.commands.component; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.EntityModifyRevertibleCommand; import games.rednblack.editor.renderer.components.light.LightObjectComponent; import games.rednblack.editor.renderer.data.LightVO; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; public class UpdateLightDataCommand extends EntityModifyRevertibleCommand { @@ -56,7 +56,7 @@ public class UpdateLightDataCommand extends EntityModifyRevertibleCommand { lightObjectComponent.isSoft = vo.isSoft; lightObjectComponent.isActive = vo.isActive; - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } @Override @@ -77,7 +77,7 @@ public class UpdateLightDataCommand extends EntityModifyRevertibleCommand { lightObjectComponent.isActive = backup.isActive; lightObjectComponent.isSoft = backup.isSoft; - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } public static Object payload(int entity, LightVO vo) { diff --git a/src/main/java/games/rednblack/editor/controller/commands/component/UpdateParticleDataCommand.java b/src/main/java/games/rednblack/editor/controller/commands/component/UpdateParticleDataCommand.java index f142b7e0..ce9966d5 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/component/UpdateParticleDataCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/component/UpdateParticleDataCommand.java @@ -1,12 +1,12 @@ package games.rednblack.editor.controller.commands.component; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.EntityModifyRevertibleCommand; import games.rednblack.editor.renderer.components.particle.ParticleComponent; import games.rednblack.editor.renderer.data.ParticleEffectVO; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; public class UpdateParticleDataCommand extends EntityModifyRevertibleCommand { @@ -29,7 +29,7 @@ public class UpdateParticleDataCommand extends EntityModifyRevertibleCommand { particleComponent.particleEffect.setPosition(0, 0); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } @Override @@ -40,7 +40,7 @@ public class UpdateParticleDataCommand extends EntityModifyRevertibleCommand { particleComponent.transform = backup.transform; particleComponent.autoStart = backup.autoStart; - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } public static Object payload(int entity, ParticleEffectVO vo) { diff --git a/src/main/java/games/rednblack/editor/controller/commands/component/UpdatePhysicsDataCommand.java b/src/main/java/games/rednblack/editor/controller/commands/component/UpdatePhysicsDataCommand.java index cf76ec2d..83908bfa 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/component/UpdatePhysicsDataCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/component/UpdatePhysicsDataCommand.java @@ -1,12 +1,12 @@ package games.rednblack.editor.controller.commands.component; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.EntityModifyRevertibleCommand; import games.rednblack.editor.renderer.components.physics.PhysicsBodyComponent; import games.rednblack.editor.renderer.data.PhysicsBodyDataVO; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; public class UpdatePhysicsDataCommand extends EntityModifyRevertibleCommand { @@ -49,7 +49,7 @@ public class UpdatePhysicsDataCommand extends EntityModifyRevertibleCommand { physicsComponent.scheduleRefresh(); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } @Override @@ -81,7 +81,7 @@ public class UpdatePhysicsDataCommand extends EntityModifyRevertibleCommand { physicsComponent.scheduleRefresh(); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } public static Object payload(int entity, PhysicsBodyDataVO vo) { diff --git a/src/main/java/games/rednblack/editor/controller/commands/component/UpdatePolygonVerticesCommand.java b/src/main/java/games/rednblack/editor/controller/commands/component/UpdatePolygonVerticesCommand.java index a1a2008e..08d5e075 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/component/UpdatePolygonVerticesCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/component/UpdatePolygonVerticesCommand.java @@ -2,13 +2,13 @@ package games.rednblack.editor.controller.commands.component; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.EntityModifyRevertibleCommand; import games.rednblack.editor.renderer.components.TextureRegionComponent; import games.rednblack.editor.renderer.components.shape.PolygonShapeComponent; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; public class UpdatePolygonVerticesCommand extends EntityModifyRevertibleCommand { @@ -49,7 +49,7 @@ public class UpdatePolygonVerticesCommand extends EntityModifyRevertibleCommand if (textureRegionComponent != null) textureRegionComponent.executeRefresh(entity); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } @@ -68,7 +68,7 @@ public class UpdatePolygonVerticesCommand extends EntityModifyRevertibleCommand if (textureRegionComponent != null) textureRegionComponent.executeRefresh(entity); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } public static Object[] payloadInitialState(int entity) { diff --git a/src/main/java/games/rednblack/editor/controller/commands/component/UpdateSensorDataCommand.java b/src/main/java/games/rednblack/editor/controller/commands/component/UpdateSensorDataCommand.java index a65e91cf..dc6b0e23 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/component/UpdateSensorDataCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/component/UpdateSensorDataCommand.java @@ -1,12 +1,12 @@ package games.rednblack.editor.controller.commands.component; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.EntityModifyRevertibleCommand; import games.rednblack.editor.renderer.components.physics.SensorComponent; import games.rednblack.editor.renderer.data.SensorDataVO; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; /** * Update command for the sensor data. @@ -43,7 +43,7 @@ public class UpdateSensorDataCommand extends EntityModifyRevertibleCommand { sensorComponent.rightSpanPercent = vo.rightSpanPercent; sensorComponent.topSpanPercent = vo.topSpanPercent; - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } @Override @@ -61,7 +61,7 @@ public class UpdateSensorDataCommand extends EntityModifyRevertibleCommand { sensorComponent.rightSpanPercent = backup.rightSpanPercent; sensorComponent.topSpanPercent = backup.topSpanPercent; - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } public static Object payload(int entity, SensorDataVO vo) { diff --git a/src/main/java/games/rednblack/editor/controller/commands/component/UpdateSpineDataCommand.java b/src/main/java/games/rednblack/editor/controller/commands/component/UpdateSpineDataCommand.java index f0b8020e..4cbde4e3 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/component/UpdateSpineDataCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/component/UpdateSpineDataCommand.java @@ -1,12 +1,12 @@ package games.rednblack.editor.controller.commands.component; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.EntityModifyRevertibleCommand; import games.rednblack.h2d.extension.spine.SpineVO; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.extension.spine.SpineComponent; +import games.rednblack.puremvc.Facade; public class UpdateSpineDataCommand extends EntityModifyRevertibleCommand { @@ -30,7 +30,7 @@ public class UpdateSpineDataCommand extends EntityModifyRevertibleCommand { spineComponent.setAnimation(vo.currentAnimationName); spineComponent.setSkin(vo.currentSkinName); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } @Override @@ -43,7 +43,7 @@ public class UpdateSpineDataCommand extends EntityModifyRevertibleCommand { spineComponent.setAnimation(backup.currentAnimationName); spineComponent.setSkin(backup.currentSkinName); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } public static Object payload(int entity, SpineVO vo) { diff --git a/src/main/java/games/rednblack/editor/controller/commands/component/UpdateSpriteAnimationDataCommand.java b/src/main/java/games/rednblack/editor/controller/commands/component/UpdateSpriteAnimationDataCommand.java index 6063b27a..acd73b0b 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/component/UpdateSpriteAnimationDataCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/component/UpdateSpriteAnimationDataCommand.java @@ -1,13 +1,13 @@ package games.rednblack.editor.controller.commands.component; import com.badlogic.gdx.graphics.g2d.Animation; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.EntityModifyRevertibleCommand; import games.rednblack.editor.renderer.components.sprite.SpriteAnimationComponent; import games.rednblack.editor.renderer.components.sprite.SpriteAnimationStateComponent; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; /** * Created by CyberJoe on 6/18/2015. @@ -41,7 +41,7 @@ public class UpdateSpriteAnimationDataCommand extends EntityModifyRevertibleComm spriteAnimationComponent.playMode = playMode; spriteAnimationStateComponent.set(spriteAnimationComponent); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } @Override @@ -55,7 +55,7 @@ public class UpdateSpriteAnimationDataCommand extends EntityModifyRevertibleComm spriteAnimationComponent.playMode = previousPlayMode; spriteAnimationStateComponent.set(spriteAnimationComponent); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } public static Object payload(int entity, int fps, String animName, Animation.PlayMode playMode) { diff --git a/src/main/java/games/rednblack/editor/controller/commands/component/UpdateTalosDataCommand.java b/src/main/java/games/rednblack/editor/controller/commands/component/UpdateTalosDataCommand.java index 4160f845..e1c3e7a1 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/component/UpdateTalosDataCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/component/UpdateTalosDataCommand.java @@ -1,12 +1,12 @@ package games.rednblack.editor.controller.commands.component; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.EntityModifyRevertibleCommand; import games.rednblack.h2d.extension.talos.TalosVO; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.extension.talos.TalosComponent; +import games.rednblack.puremvc.Facade; public class UpdateTalosDataCommand extends EntityModifyRevertibleCommand { @@ -27,7 +27,7 @@ public class UpdateTalosDataCommand extends EntityModifyRevertibleCommand { talosComponent.transform = vo.transform; talosComponent.effect.setPosition(0, 0); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } @Override @@ -38,7 +38,7 @@ public class UpdateTalosDataCommand extends EntityModifyRevertibleCommand { talosComponent.effect.setPosition(0, 0); talosComponent.transform = backup.transform; - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } public static Object payload(int entity, TalosVO vo) { diff --git a/src/main/java/games/rednblack/editor/controller/commands/resource/DuplicateLibraryAction.java b/src/main/java/games/rednblack/editor/controller/commands/resource/DuplicateLibraryAction.java index 557a611b..cea9acff 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/resource/DuplicateLibraryAction.java +++ b/src/main/java/games/rednblack/editor/controller/commands/resource/DuplicateLibraryAction.java @@ -3,7 +3,6 @@ package games.rednblack.editor.controller.commands.resource; import com.badlogic.gdx.utils.Json; import com.kotcrab.vis.ui.util.dialog.Dialogs; import com.kotcrab.vis.ui.util.dialog.InputDialogListener; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.AddToLibraryAction; import games.rednblack.editor.controller.commands.NonRevertibleCommand; import games.rednblack.editor.proxy.ProjectManager; @@ -12,6 +11,7 @@ import games.rednblack.editor.renderer.utils.HyperJson; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.ui.validator.StringNameValidator; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; import java.util.HashMap; @@ -25,7 +25,7 @@ public class DuplicateLibraryAction extends NonRevertibleCommand { public void doAction() { String libraryActionName = notification.getBody(); - ProjectManager projectManager = HyperLap2DFacade.getInstance().retrieveProxy(ProjectManager.NAME); + ProjectManager projectManager = Facade.getInstance().retrieveProxy(ProjectManager.NAME); HashMap libraryActions = projectManager.currentProjectInfoVO.libraryActions; GraphVO actionToDuplicate = libraryActions.get(libraryActionName); @@ -41,7 +41,7 @@ public class DuplicateLibraryAction extends NonRevertibleCommand { GraphVO duplicated = json.fromJson(GraphVO.class, json.toJson(actionToDuplicate)); Object[] payload = AddToLibraryAction.getPayload(input, duplicated); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_ADD_TO_LIBRARY_ACTION, payload); + Facade.getInstance().sendNotification(MsgAPI.ACTION_ADD_TO_LIBRARY_ACTION, payload); } @Override diff --git a/src/main/java/games/rednblack/editor/data/migrations/migrators/VersionMigTo005.java b/src/main/java/games/rednblack/editor/data/migrations/migrators/VersionMigTo005.java index 45a31b68..9b222481 100644 --- a/src/main/java/games/rednblack/editor/data/migrations/migrators/VersionMigTo005.java +++ b/src/main/java/games/rednblack/editor/data/migrations/migrators/VersionMigTo005.java @@ -23,11 +23,11 @@ import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.utils.Json; import com.badlogic.gdx.utils.JsonReader; import com.badlogic.gdx.utils.JsonWriter; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.data.migrations.IVersionMigrator; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.renderer.data.ProjectInfoVO; import games.rednblack.h2d.common.vo.ProjectVO; +import games.rednblack.puremvc.Facade; import org.apache.commons.io.FileUtils; import java.io.File; @@ -42,12 +42,12 @@ public class VersionMigTo005 implements IVersionMigrator { private Json json = new Json(); private JsonReader jsonReader = new JsonReader(); - private HyperLap2DFacade facade; + private Facade facade; private ProjectManager projectManager; @Override public void setProject(String path, ProjectVO vo, ProjectInfoVO projectInfoVO) { - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); projectManager = facade.retrieveProxy(ProjectManager.NAME); projectPath = path; json.setOutputType(JsonWriter.OutputType.json); diff --git a/src/main/java/games/rednblack/editor/data/migrations/migrators/VersionMigTo009.java b/src/main/java/games/rednblack/editor/data/migrations/migrators/VersionMigTo009.java index 8883c46c..8161363a 100644 --- a/src/main/java/games/rednblack/editor/data/migrations/migrators/VersionMigTo009.java +++ b/src/main/java/games/rednblack/editor/data/migrations/migrators/VersionMigTo009.java @@ -24,11 +24,11 @@ import com.badlogic.gdx.utils.Json; import com.badlogic.gdx.utils.JsonReader; import com.badlogic.gdx.utils.JsonValue; import com.badlogic.gdx.utils.JsonWriter; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.data.migrations.IVersionMigrator; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.renderer.data.ProjectInfoVO; import games.rednblack.h2d.common.vo.ProjectVO; +import games.rednblack.puremvc.Facade; import org.apache.commons.io.FileUtils; import java.io.File; @@ -44,12 +44,12 @@ public class VersionMigTo009 implements IVersionMigrator { private Json json = new Json(); private JsonReader jsonReader = new JsonReader(); - private HyperLap2DFacade facade; + private Facade facade; private ProjectManager projectManager; @Override public void setProject(String path, ProjectVO vo, ProjectInfoVO projectInfoVO) { - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); projectManager = facade.retrieveProxy(ProjectManager.NAME); projectPath = path; json.setOutputType(JsonWriter.OutputType.json); diff --git a/src/main/java/games/rednblack/editor/event/ButtonToNotificationListener.java b/src/main/java/games/rednblack/editor/event/ButtonToNotificationListener.java index b62a1ba3..366bd57f 100644 --- a/src/main/java/games/rednblack/editor/event/ButtonToNotificationListener.java +++ b/src/main/java/games/rednblack/editor/event/ButtonToNotificationListener.java @@ -2,7 +2,7 @@ package games.rednblack.editor.event; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; -import games.rednblack.editor.HyperLap2DFacade; +import games.rednblack.puremvc.Facade; /** * Created by azakhary on 7/2/2015. @@ -23,6 +23,6 @@ public class ButtonToNotificationListener extends ClickListener{ public void touchUp(InputEvent event, float x, float y, int pointer, int button) { super.touchUp(event, x, y, pointer, button); - HyperLap2DFacade.getInstance().sendNotification(notificationName, payload); + Facade.getInstance().sendNotification(notificationName, payload); } } diff --git a/src/main/java/games/rednblack/editor/event/CheckBoxChangeListener.java b/src/main/java/games/rednblack/editor/event/CheckBoxChangeListener.java index c8d18fff..4cfdb746 100644 --- a/src/main/java/games/rednblack/editor/event/CheckBoxChangeListener.java +++ b/src/main/java/games/rednblack/editor/event/CheckBoxChangeListener.java @@ -21,7 +21,7 @@ package games.rednblack.editor.event; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.kotcrab.vis.ui.widget.VisCheckBox; -import games.rednblack.editor.HyperLap2DFacade; +import games.rednblack.puremvc.Facade; /** * Created by azakhary on 4/16/2015. @@ -41,7 +41,7 @@ public class CheckBoxChangeListener extends ChangeListener { @Override public void changed(ChangeEvent changeEvent, Actor actor) { - HyperLap2DFacade facade = HyperLap2DFacade.getInstance(); + Facade facade = Facade.getInstance(); facade.sendNotification(eventName, ((VisCheckBox) actor).isChecked(), type); } } \ No newline at end of file diff --git a/src/main/java/games/rednblack/editor/event/ClickNotifier.java b/src/main/java/games/rednblack/editor/event/ClickNotifier.java index b774bf3e..c52c23ec 100644 --- a/src/main/java/games/rednblack/editor/event/ClickNotifier.java +++ b/src/main/java/games/rednblack/editor/event/ClickNotifier.java @@ -20,7 +20,7 @@ package games.rednblack.editor.event; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; -import games.rednblack.editor.HyperLap2DFacade; +import games.rednblack.puremvc.Facade; /** * Created by azakhary on 4/29/2015. @@ -35,7 +35,7 @@ public class ClickNotifier extends ClickListener { @Override public void clicked(InputEvent event, float x, float y) { - HyperLap2DFacade facade = HyperLap2DFacade.getInstance(); + Facade facade = Facade.getInstance(); facade.sendNotification(eventName); } } diff --git a/src/main/java/games/rednblack/editor/event/EditableSelectBoxChangeListener.java b/src/main/java/games/rednblack/editor/event/EditableSelectBoxChangeListener.java index 13451454..a33b29fc 100644 --- a/src/main/java/games/rednblack/editor/event/EditableSelectBoxChangeListener.java +++ b/src/main/java/games/rednblack/editor/event/EditableSelectBoxChangeListener.java @@ -20,8 +20,8 @@ package games.rednblack.editor.event; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.ui.widget.EditableSelectBox; +import games.rednblack.puremvc.Facade; /** * Created by azakhary on 4/30/2015. @@ -38,7 +38,7 @@ public class EditableSelectBoxChangeListener extends ChangeListener { @Override public void changed(ChangeEvent changeEvent, Actor actor) { - HyperLap2DFacade facade = HyperLap2DFacade.getInstance(); + Facade facade = Facade.getInstance(); String selected = ((EditableSelectBox) actor).getSelected(); if(!lastSelected.equals(selected)) { lastSelected = selected; diff --git a/src/main/java/games/rednblack/editor/event/KeyboardListener.java b/src/main/java/games/rednblack/editor/event/KeyboardListener.java index 635ada7e..9cb8c55b 100644 --- a/src/main/java/games/rednblack/editor/event/KeyboardListener.java +++ b/src/main/java/games/rednblack/editor/event/KeyboardListener.java @@ -24,7 +24,7 @@ import com.badlogic.gdx.scenes.scene2d.EventListener; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.utils.FocusListener; import com.kotcrab.vis.ui.widget.VisTextField; -import games.rednblack.editor.HyperLap2DFacade; +import games.rednblack.puremvc.Facade; /** * Created by azakhary on 4/15/2015. @@ -98,7 +98,7 @@ public class KeyboardListener implements EventListener { lastValue = target.getText(); - HyperLap2DFacade facade = HyperLap2DFacade.getInstance(); + Facade facade = Facade.getInstance(); facade.sendNotification(eventName, target.getText()); } } \ No newline at end of file diff --git a/src/main/java/games/rednblack/editor/event/MenuItemListener.java b/src/main/java/games/rednblack/editor/event/MenuItemListener.java index f11a0a5f..d964005c 100644 --- a/src/main/java/games/rednblack/editor/event/MenuItemListener.java +++ b/src/main/java/games/rednblack/editor/event/MenuItemListener.java @@ -2,7 +2,7 @@ package games.rednblack.editor.event; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; -import games.rednblack.editor.HyperLap2DFacade; +import games.rednblack.puremvc.Facade; /** * Created by CyberJoe on 4/21/2015. @@ -14,7 +14,7 @@ public class MenuItemListener extends ChangeListener { private final String menuType; private final Object data; - private HyperLap2DFacade facade; + private final Facade facade; public MenuItemListener(String menuCommand) { this(menuCommand, null, null); @@ -29,7 +29,7 @@ public class MenuItemListener extends ChangeListener { this.data = data; this.menuType = menuType; - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); } @Override diff --git a/src/main/java/games/rednblack/editor/event/NumberSelectorOverlapListener.java b/src/main/java/games/rednblack/editor/event/NumberSelectorOverlapListener.java index 2d1a4652..bc21f325 100644 --- a/src/main/java/games/rednblack/editor/event/NumberSelectorOverlapListener.java +++ b/src/main/java/games/rednblack/editor/event/NumberSelectorOverlapListener.java @@ -21,7 +21,7 @@ package games.rednblack.editor.event; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.kotcrab.vis.ui.widget.spinner.Spinner; -import games.rednblack.editor.HyperLap2DFacade; +import games.rednblack.puremvc.Facade; /** * Created by azakhary on 6/12/2015. @@ -36,7 +36,7 @@ public class NumberSelectorOverlapListener extends ChangeListener { @Override public void changed(ChangeEvent event, Actor actor) { - HyperLap2DFacade facade = HyperLap2DFacade.getInstance(); + Facade facade = Facade.getInstance(); facade.sendNotification(eventName, ((Spinner)actor).getTextField().getText()); } } diff --git a/src/main/java/games/rednblack/editor/event/SelectBoxChangeListener.java b/src/main/java/games/rednblack/editor/event/SelectBoxChangeListener.java index 94ad52e6..85ae3b77 100644 --- a/src/main/java/games/rednblack/editor/event/SelectBoxChangeListener.java +++ b/src/main/java/games/rednblack/editor/event/SelectBoxChangeListener.java @@ -21,7 +21,7 @@ package games.rednblack.editor.event; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.kotcrab.vis.ui.widget.VisSelectBox; -import games.rednblack.editor.HyperLap2DFacade; +import games.rednblack.puremvc.Facade; /** * Created by azakhary on 4/16/2015. @@ -38,7 +38,7 @@ public class SelectBoxChangeListener extends ChangeListener { @Override public void changed(ChangeEvent changeEvent, Actor actor) { - HyperLap2DFacade facade = HyperLap2DFacade.getInstance(); + Facade facade = Facade.getInstance(); String selected = (String) ((VisSelectBox) actor).getSelected(); if(!lastSelected.equals(selected)) { lastSelected = selected; diff --git a/src/main/java/games/rednblack/editor/factory/ItemFactory.java b/src/main/java/games/rednblack/editor/factory/ItemFactory.java index eadc8fb0..bf3060d8 100644 --- a/src/main/java/games/rednblack/editor/factory/ItemFactory.java +++ b/src/main/java/games/rednblack/editor/factory/ItemFactory.java @@ -3,8 +3,6 @@ package games.rednblack.editor.factory; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Pools; -import games.rednblack.editor.HyperLap2DFacade; -import games.rednblack.editor.controller.commands.PasteItemsCommand; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.proxy.ResourceManager; import games.rednblack.editor.renderer.SceneLoader; @@ -21,6 +19,7 @@ import games.rednblack.h2d.common.factory.IFactory; import games.rednblack.h2d.extension.spine.SpineItemType; import games.rednblack.h2d.extension.talos.TalosItemType; import games.rednblack.h2d.extension.tinyvg.TinyVGItemType; +import games.rednblack.puremvc.Facade; import java.util.HashMap; @@ -48,7 +47,7 @@ public class ItemFactory implements IFactory { } private boolean setEssentialData(MainItemVO vo, Vector2 position) { - UILayerBoxMediator layerBoxMediator = HyperLap2DFacade.getInstance().retrieveMediator(UILayerBoxMediator.NAME); + UILayerBoxMediator layerBoxMediator = Facade.getInstance().retrieveMediator(UILayerBoxMediator.NAME); String layerName = layerBoxMediator.getCurrentSelectedLayerName(); if(layerName == null) return false; @@ -66,7 +65,7 @@ public class ItemFactory implements IFactory { } private boolean setEssentialData(ComponentFactory.InitialData vo, Vector2 position) { - UILayerBoxMediator layerBoxMediator = HyperLap2DFacade.getInstance().retrieveMediator(UILayerBoxMediator.NAME); + UILayerBoxMediator layerBoxMediator = Facade.getInstance().retrieveMediator(UILayerBoxMediator.NAME); String layerName = layerBoxMediator.getCurrentSelectedLayerName(); if(layerName == null) return false; @@ -94,7 +93,7 @@ public class ItemFactory implements IFactory { data.data = regionName; createdEntity = entityFactory.createEntity(sandbox.getCurrentViewingEntity(), EntityFactory.IMAGE_TYPE, data); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_CREATE_ITEM, createdEntity); + Facade.getInstance().sendNotification(MsgAPI.ACTION_CREATE_ITEM, createdEntity); Pools.free(data); return true; @@ -114,7 +113,7 @@ public class ItemFactory implements IFactory { data.data = regionName; createdEntity = entityFactory.createEntity(sandbox.getCurrentViewingEntity(), EntityFactory.NINE_PATCH, data); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_CREATE_ITEM, createdEntity); + Facade.getInstance().sendNotification(MsgAPI.ACTION_CREATE_ITEM, createdEntity); Pools.free(data); return true; @@ -130,7 +129,7 @@ public class ItemFactory implements IFactory { data.data = animationName; createdEntity = entityFactory.createEntity(sandbox.getCurrentViewingEntity(), EntityFactory.SPRITE_TYPE, data); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_CREATE_ITEM, createdEntity); + Facade.getInstance().sendNotification(MsgAPI.ACTION_CREATE_ITEM, createdEntity); Pools.free(data); return true; @@ -146,7 +145,7 @@ public class ItemFactory implements IFactory { data.data = animationName; createdEntity = entityFactory.createEntity(sandbox.getCurrentViewingEntity(), SpineItemType.SPINE_TYPE, data); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_CREATE_ITEM, createdEntity); + Facade.getInstance().sendNotification(MsgAPI.ACTION_CREATE_ITEM, createdEntity); Pools.free(data); return true; @@ -163,14 +162,14 @@ public class ItemFactory implements IFactory { params[0] = shape.clone().vertices; params[1] = shape.clone().polygonizedVertices; createdEntity = entityFactory.createEntity(sandbox.getCurrentViewingEntity(), EntityFactory.COLOR_PRIMITIVE, data); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_CREATE_ITEM, createdEntity); + Facade.getInstance().sendNotification(MsgAPI.ACTION_CREATE_ITEM, createdEntity); Pools.free(data); return true; } @Override public boolean createItemFromLibrary(String libraryName, Vector2 position) { - ProjectManager projectManager = HyperLap2DFacade.getInstance().retrieveProxy(ProjectManager.NAME); + ProjectManager projectManager = Facade.getInstance().retrieveProxy(ProjectManager.NAME); HashMap libraryItems = projectManager.currentProjectInfoVO.libraryItems; CompositeItemVO itemVO = libraryItems.get(libraryName); @@ -183,7 +182,7 @@ public class ItemFactory implements IFactory { MainItemComponent mainItemComponent = SandboxComponentRetriever.get(createdEntity, MainItemComponent.class); mainItemComponent.libraryLink = libraryName; - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_CREATE_ITEM, createdEntity); + Facade.getInstance().sendNotification(MsgAPI.ACTION_CREATE_ITEM, createdEntity); return true; } @@ -213,7 +212,7 @@ public class ItemFactory implements IFactory { int entity = entityFactory.createEntity(sandbox.getCurrentViewingEntity(), EntityFactory.LIGHT_TYPE, data); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_CREATE_ITEM, entity); + Facade.getInstance().sendNotification(MsgAPI.ACTION_CREATE_ITEM, entity); Pools.free(data); return entity; @@ -233,7 +232,7 @@ public class ItemFactory implements IFactory { data.data = name; int entity = entityFactory.createEntity(sandbox.getCurrentViewingEntity(), TinyVGItemType.TINYVG_TYPE, data); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_CREATE_ITEM, entity); + Facade.getInstance().sendNotification(MsgAPI.ACTION_CREATE_ITEM, entity); Pools.free(data); return entity; } @@ -252,7 +251,7 @@ public class ItemFactory implements IFactory { data.data = particleName; int entity = entityFactory.createEntity(sandbox.getCurrentViewingEntity(), EntityFactory.PARTICLE_TYPE, data); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_CREATE_ITEM, entity); + Facade.getInstance().sendNotification(MsgAPI.ACTION_CREATE_ITEM, entity); Pools.free(data); return entity; } @@ -271,7 +270,7 @@ public class ItemFactory implements IFactory { data.data = particleName; int entity = entityFactory.createEntity(sandbox.getCurrentViewingEntity(), TalosItemType.TALOS_TYPE, data); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_CREATE_ITEM, entity); + Facade.getInstance().sendNotification(MsgAPI.ACTION_CREATE_ITEM, entity); Pools.free(data); return entity; @@ -283,7 +282,7 @@ public class ItemFactory implements IFactory { Pools.free(data); return -1; } - HyperLap2DFacade facade = HyperLap2DFacade.getInstance(); + Facade facade = Facade.getInstance(); ResourceManager resourceManager = facade.retrieveProxy(ResourceManager.NAME); resourceManager.prepareEmbeddingFont(textSettings.getFontFamily(), textSettings.getFontSize(), false); @@ -298,7 +297,7 @@ public class ItemFactory implements IFactory { int entity = entityFactory.createEntity(sandbox.getCurrentViewingEntity(), EntityFactory.LABEL_TYPE, data); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_CREATE_ITEM, entity); + Facade.getInstance().sendNotification(MsgAPI.ACTION_CREATE_ITEM, entity); Pools.free(data); return entity; } diff --git a/src/main/java/games/rednblack/editor/live/LivePreviewScreen.java b/src/main/java/games/rednblack/editor/live/LivePreviewScreen.java index ba46d285..013a4cb8 100644 --- a/src/main/java/games/rednblack/editor/live/LivePreviewScreen.java +++ b/src/main/java/games/rednblack/editor/live/LivePreviewScreen.java @@ -11,7 +11,6 @@ import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer; import com.badlogic.gdx.utils.viewport.ExtendViewport; import com.badlogic.gdx.utils.viewport.Viewport; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.proxy.ResolutionManager; import games.rednblack.editor.proxy.ResourceManager; @@ -25,7 +24,7 @@ import games.rednblack.h2d.extension.talos.TalosItemType; import games.rednblack.h2d.extension.tinyvg.TinyVGItemType; import games.rednblack.h2d.extension.typinglabel.TypingLabelItemType; import games.rednblack.h2d.extension.spine.SpineItemType; -import org.puremvc.java.interfaces.IFacade; +import games.rednblack.puremvc.Facade; public class LivePreviewScreen extends ScreenAdapter implements GestureDetector.GestureListener { private final Vector3 vec3Zero = new Vector3(0, 0, 0); @@ -37,7 +36,7 @@ public class LivePreviewScreen extends ScreenAdapter implements GestureDetector. private final ProjectManager projectManager; private final Box2DDebugRenderer mBox2DDebugRenderer; - private final IFacade facade = HyperLap2DFacade.getInstance(); + private final Facade facade = Facade.getInstance(); private final Color bgColor; private final OrthographicCamera mCamera; diff --git a/src/main/java/games/rednblack/editor/proxy/CommandManager.java b/src/main/java/games/rednblack/editor/proxy/CommandManager.java index 7169f8b1..27d710ac 100644 --- a/src/main/java/games/rednblack/editor/proxy/CommandManager.java +++ b/src/main/java/games/rednblack/editor/proxy/CommandManager.java @@ -18,11 +18,10 @@ package games.rednblack.editor.proxy; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.HistoricRevertibleCommand; import games.rednblack.editor.controller.commands.RevertibleCommand; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.patterns.proxy.Proxy; +import games.rednblack.puremvc.Proxy; import java.util.ArrayList; @@ -36,13 +35,7 @@ public class CommandManager extends Proxy { final private ArrayList commands = new ArrayList<>(); public CommandManager() { - super(NAME); - } - - @Override - public void onRegister() { - super.onRegister(); - facade = HyperLap2DFacade.getInstance(); + super(NAME, null); } public void addCommand(RevertibleCommand revertibleCommand) { diff --git a/src/main/java/games/rednblack/editor/proxy/FontManager.java b/src/main/java/games/rednblack/editor/proxy/FontManager.java index ce9961bc..8914b2e7 100644 --- a/src/main/java/games/rednblack/editor/proxy/FontManager.java +++ b/src/main/java/games/rednblack/editor/proxy/FontManager.java @@ -4,13 +4,13 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Preferences; import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.utils.Array; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.utils.AppConfig; import games.rednblack.editor.utils.NativeDialogs; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.Proxy; import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.SystemUtils; -import org.puremvc.java.patterns.proxy.Proxy; import java.awt.*; import java.io.File; @@ -34,13 +34,12 @@ public class FontManager extends Proxy { private HashMap systemFontMap = new HashMap<>(); public FontManager() { - super(NAME); + super(NAME, null); } @Override public void onRegister() { super.onRegister(); - facade = HyperLap2DFacade.getInstance(); prefs = Gdx.app.getPreferences(cache_name); generateFontsMap(); } diff --git a/src/main/java/games/rednblack/editor/proxy/PluginManager.java b/src/main/java/games/rednblack/editor/proxy/PluginManager.java index 9f02eee2..098e3587 100644 --- a/src/main/java/games/rednblack/editor/proxy/PluginManager.java +++ b/src/main/java/games/rednblack/editor/proxy/PluginManager.java @@ -23,7 +23,6 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.utils.Array; import com.kotcrab.vis.ui.widget.VisImageButton; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.PluginItemCommand; import games.rednblack.editor.factory.ItemFactory; import games.rednblack.editor.renderer.SceneLoader; @@ -51,8 +50,8 @@ import games.rednblack.h2d.common.vo.CursorData; import games.rednblack.h2d.common.vo.EditorConfigVO; import games.rednblack.h2d.common.vo.ProjectVO; import games.rednblack.h2d.common.vo.SceneConfigVO; -import org.puremvc.java.interfaces.IFacade; -import org.puremvc.java.patterns.proxy.Proxy; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.Proxy; import java.util.*; @@ -69,8 +68,7 @@ public class PluginManager extends Proxy implements PluginAPI { private HashSet pluginEntities; public PluginManager() { - super(NAME); - facade = HyperLap2DFacade.getInstance(); + super(NAME, null); } public H2DPlugin registerPlugin(H2DPlugin plugin) { @@ -135,7 +133,7 @@ public class PluginManager extends Proxy implements PluginAPI { @Override public void removeFollower(int entity) { - FollowersUIMediator followersUIMediator = HyperLap2DFacade.getInstance().retrieveMediator(FollowersUIMediator.NAME); + FollowersUIMediator followersUIMediator = Facade.getInstance().retrieveMediator(FollowersUIMediator.NAME); followersUIMediator.removeFollower(entity); } @@ -206,7 +204,7 @@ public class PluginManager extends Proxy implements PluginAPI { } @Override - public IFacade getFacade() { + public Facade getFacade() { return facade; } @@ -258,7 +256,7 @@ public class PluginManager extends Proxy implements PluginAPI { @Override public void setCursor(CursorData cursorData, TextureRegion region) { - CursorManager cursorManager = HyperLap2DFacade.getInstance().retrieveProxy(CursorManager.NAME); + CursorManager cursorManager = Facade.getInstance().retrieveProxy(CursorManager.NAME); cursorManager.setCursor(cursorData, region); } diff --git a/src/main/java/games/rednblack/editor/proxy/ProjectManager.java b/src/main/java/games/rednblack/editor/proxy/ProjectManager.java index 5a7d6f7e..798f80a7 100755 --- a/src/main/java/games/rednblack/editor/proxy/ProjectManager.java +++ b/src/main/java/games/rednblack/editor/proxy/ProjectManager.java @@ -27,7 +27,6 @@ import com.badlogic.gdx.tools.texturepacker.TexturePacker.Settings; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Json; import com.kotcrab.vis.ui.util.dialog.Dialogs; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.data.manager.PreferencesManager; import games.rednblack.editor.data.migrations.ProjectVersionMigrator; import games.rednblack.editor.renderer.data.*; @@ -45,6 +44,8 @@ import games.rednblack.h2d.common.ProgressHandler; import games.rednblack.h2d.common.vo.ProjectVO; import games.rednblack.h2d.common.vo.SceneConfigVO; import games.rednblack.h2d.common.vo.TexturePackerVO; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.Proxy; import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.monitor.FileAlterationListener; @@ -52,7 +53,6 @@ import org.apache.commons.io.monitor.FileAlterationListenerAdaptor; import org.apache.commons.io.monitor.FileAlterationMonitor; import org.apache.commons.io.monitor.FileAlterationObserver; import org.lwjgl.util.tinyfd.TinyFileDialogs; -import org.puremvc.java.patterns.proxy.Proxy; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; @@ -87,7 +87,7 @@ public class ProjectManager extends Proxy { private String currentProjectPath; public ProjectManager() { - super(NAME); + super(NAME, null); } private ProjectExportSettings projectExportSettings; @@ -98,7 +98,6 @@ public class ProjectManager extends Proxy { @Override public void onRegister() { super.onRegister(); - facade = HyperLap2DFacade.getInstance(); projectExportSettings = new ProjectExportSettings(); livePreviewSettings = new LivePreviewSettings(); diff --git a/src/main/java/games/rednblack/editor/proxy/ResolutionManager.java b/src/main/java/games/rednblack/editor/proxy/ResolutionManager.java index da1bd945..a37b6704 100644 --- a/src/main/java/games/rednblack/editor/proxy/ResolutionManager.java +++ b/src/main/java/games/rednblack/editor/proxy/ResolutionManager.java @@ -25,7 +25,6 @@ import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.ObjectMap; import com.kotcrab.vis.ui.util.dialog.Dialogs; import com.mortennobel.imagescaling.ResampleOp; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.data.ProjectInfoVO; import games.rednblack.editor.renderer.data.ResolutionEntryVO; import games.rednblack.editor.renderer.data.TexturePackVO; @@ -34,9 +33,10 @@ import games.rednblack.editor.utils.NinePatchUtils; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.ProgressHandler; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.Proxy; import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; -import org.puremvc.java.patterns.proxy.Proxy; import javax.imageio.ImageIO; import java.awt.*; @@ -63,7 +63,7 @@ public class ResolutionManager extends Proxy { private ProgressHandler handler; public ResolutionManager() { - super(NAME); + super(NAME, null); } public static BufferedImage imageResize(File file, float ratio) { @@ -132,7 +132,6 @@ public class ResolutionManager extends Proxy { @Override public void onRegister() { super.onRegister(); - facade = HyperLap2DFacade.getInstance(); } public void createNewResolution(ResolutionEntryVO resolutionEntryVO) { @@ -153,7 +152,7 @@ public class ResolutionManager extends Proxy { if (resizeWarnings > 0) { Dialogs.showOKDialog(Sandbox.getInstance().getUIStage(), "Warning", resizeWarnings + " images were not resized for smaller resolutions due to already small size ( < 3px )"); } - HyperLap2DFacade.getInstance().sendNotification(RESOLUTION_LIST_CHANGED); + Facade.getInstance().sendNotification(RESOLUTION_LIST_CHANGED); }); executor.execute(() -> { try { @@ -371,7 +370,7 @@ public class ResolutionManager extends Proxy { ProjectInfoVO projectInfo = projectManager.getCurrentProjectInfoVO(); projectInfo.resolutions.removeValue(resolutionEntryVO, false); - HyperLap2DFacade.getInstance().sendNotification(RESOLUTION_LIST_CHANGED); + Facade.getInstance().sendNotification(RESOLUTION_LIST_CHANGED); projectManager.saveCurrentProject(); projectManager.openProjectAndLoadAllData(projectManager.getCurrentProjectPath(), "orig"); } diff --git a/src/main/java/games/rednblack/editor/proxy/ResourceManager.java b/src/main/java/games/rednblack/editor/proxy/ResourceManager.java index 5df52c42..9b561733 100644 --- a/src/main/java/games/rednblack/editor/proxy/ResourceManager.java +++ b/src/main/java/games/rednblack/editor/proxy/ResourceManager.java @@ -18,7 +18,6 @@ import com.talosvfx.talos.runtime.ParticleEffectDescriptor; import com.talosvfx.talos.runtime.utils.ShaderDescriptor; import com.talosvfx.talos.runtime.utils.VectorField; import dev.lyze.gdxtinyvg.TinyVG; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.data.*; import games.rednblack.editor.renderer.resources.FontSizePair; import games.rednblack.editor.renderer.resources.IResourceRetriever; @@ -33,9 +32,9 @@ import games.rednblack.h2d.extension.talos.ResourceRetrieverAssetProvider; import games.rednblack.h2d.extension.talos.TalosItemType; import games.rednblack.h2d.extension.tinyvg.TinyVGItemType; import games.rednblack.h2d.extension.tinyvg.TinyVGUtils; +import games.rednblack.puremvc.Proxy; import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; -import org.puremvc.java.patterns.proxy.Proxy; import java.io.File; import java.io.FileNotFoundException; @@ -72,13 +71,12 @@ public class ResourceManager extends Proxy implements IResourceRetriever { private PixmapPacker fontPacker; public ResourceManager() { - super(NAME); + super(NAME, null); } @Override public void onRegister() { super.onRegister(); - facade = HyperLap2DFacade.getInstance(); resolutionManager = facade.retrieveProxy(ResolutionManager.NAME); settingsManager = facade.retrieveProxy(SettingsManager.NAME); diff --git a/src/main/java/games/rednblack/editor/proxy/SceneDataManager.java b/src/main/java/games/rednblack/editor/proxy/SceneDataManager.java index d0bb5146..50fd2daf 100644 --- a/src/main/java/games/rednblack/editor/proxy/SceneDataManager.java +++ b/src/main/java/games/rednblack/editor/proxy/SceneDataManager.java @@ -22,13 +22,12 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Json; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.data.CompositeItemVO; import games.rednblack.editor.renderer.data.MainItemVO; import games.rednblack.editor.renderer.data.SceneVO; import games.rednblack.editor.renderer.utils.HyperJson; +import games.rednblack.puremvc.Proxy; import org.apache.commons.io.FileUtils; -import org.puremvc.java.patterns.proxy.Proxy; import java.io.File; import java.io.IOException; @@ -43,13 +42,7 @@ public class SceneDataManager extends Proxy { public static final String NAME = TAG; public SceneDataManager() { - super(NAME); - } - - @Override - public void onRegister() { - super.onRegister(); - facade = HyperLap2DFacade.getInstance(); + super(NAME, null); } public SceneVO createNewScene(String name) { diff --git a/src/main/java/games/rednblack/editor/proxy/SettingsManager.java b/src/main/java/games/rednblack/editor/proxy/SettingsManager.java index ab349379..3c8958ac 100644 --- a/src/main/java/games/rednblack/editor/proxy/SettingsManager.java +++ b/src/main/java/games/rednblack/editor/proxy/SettingsManager.java @@ -3,15 +3,15 @@ package games.rednblack.editor.proxy; import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.utils.Json; import games.rednblack.editor.CustomExceptionHandler; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.Main; import games.rednblack.editor.renderer.utils.HyperJson; import games.rednblack.editor.utils.HyperLap2DUtils; import games.rednblack.editor.utils.KeyBindingsLayout; import games.rednblack.h2d.common.vo.EditorConfigVO; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.Proxy; import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; -import org.puremvc.java.patterns.proxy.Proxy; import java.io.*; import java.util.List; @@ -29,14 +29,13 @@ public class SettingsManager extends Proxy { public File cacheDir; public SettingsManager() { - super(NAME); + super(NAME, null); initWorkspace(); } @Override public void onRegister() { super.onRegister(); - facade = HyperLap2DFacade.getInstance(); KeyBindingsLayout.init(); } diff --git a/src/main/java/games/rednblack/editor/proxy/WindowTitleManager.java b/src/main/java/games/rednblack/editor/proxy/WindowTitleManager.java index 3cca9bb9..b61b0a38 100644 --- a/src/main/java/games/rednblack/editor/proxy/WindowTitleManager.java +++ b/src/main/java/games/rednblack/editor/proxy/WindowTitleManager.java @@ -1,10 +1,9 @@ package games.rednblack.editor.proxy; import com.badlogic.gdx.Gdx; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.ui.UIWindowTitle; import games.rednblack.editor.view.ui.UIWindowTitleMediator; -import org.puremvc.java.patterns.proxy.Proxy; +import games.rednblack.puremvc.Proxy; public class WindowTitleManager extends Proxy { private static final String TAG = WindowTitleManager.class.getCanonicalName(); @@ -13,13 +12,7 @@ public class WindowTitleManager extends Proxy { private String currentWindowTitle = ""; public WindowTitleManager() { - super(NAME); - } - - @Override - public void onRegister() { - super.onRegister(); - facade = HyperLap2DFacade.getInstance(); + super(NAME, null); } public void setWindowTitle(String title) { diff --git a/src/main/java/games/rednblack/editor/splash/SplashMediator.java b/src/main/java/games/rednblack/editor/splash/SplashMediator.java index 088667d8..0cd1c1e9 100644 --- a/src/main/java/games/rednblack/editor/splash/SplashMediator.java +++ b/src/main/java/games/rednblack/editor/splash/SplashMediator.java @@ -3,15 +3,15 @@ package games.rednblack.editor.splash; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.utils.Json; import games.rednblack.editor.HyperLap2DApp; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.utils.Version; import games.rednblack.editor.utils.AppConfig; import games.rednblack.h2d.common.network.HttpDownloadUtility; import games.rednblack.h2d.common.network.model.GithubReleaseData; import games.rednblack.h2d.common.network.model.SnapshotReleaseData; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import org.lwjgl.util.tinyfd.TinyFileDialogs; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -26,17 +26,9 @@ public class SplashMediator extends Mediator { } @Override - public void onRegister() { - super.onRegister(); - facade = HyperLap2DFacade.getInstance(); - } - - @Override - public String[] listNotificationInterests() { - return new String[]{ - SplashScreenAdapter.UPDATE_SPLASH, - SplashScreenAdapter.CLOSE_SPLASH - }; + public void listNotificationInterests(Interests interests) { + interests.add(SplashScreenAdapter.UPDATE_SPLASH, + SplashScreenAdapter.CLOSE_SPLASH); } @Override diff --git a/src/main/java/games/rednblack/editor/utils/AssetIOManager.java b/src/main/java/games/rednblack/editor/utils/AssetIOManager.java index 88d501d4..1892fd92 100644 --- a/src/main/java/games/rednblack/editor/utils/AssetIOManager.java +++ b/src/main/java/games/rednblack/editor/utils/AssetIOManager.java @@ -4,7 +4,6 @@ import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.ObjectMap; import com.kotcrab.vis.ui.util.dialog.Dialogs; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.SettingsManager; import games.rednblack.editor.renderer.data.*; import games.rednblack.editor.utils.asset.Asset; @@ -17,6 +16,7 @@ import games.rednblack.h2d.common.vo.ExportMapperVO; import games.rednblack.h2d.extension.spine.SpineVO; import games.rednblack.h2d.extension.talos.TalosVO; import games.rednblack.h2d.extension.tinyvg.TinyVGVO; +import games.rednblack.puremvc.Facade; import java.io.File; import java.io.IOException; @@ -102,7 +102,7 @@ public class AssetIOManager { } private void initImportUI(int type, Array files) { - SettingsManager settingsManager = HyperLap2DFacade.getInstance().retrieveProxy(SettingsManager.NAME); + SettingsManager settingsManager = Facade.getInstance().retrieveProxy(SettingsManager.NAME); settingsManager.setLastImportedPath(files.get(0).parent().path()); int count = (type != AssetsUtils.TYPE_ANIMATION_PNG_SEQUENCE) ? files.size : 1; diff --git a/src/main/java/games/rednblack/editor/utils/HyperLap2DUtils.java b/src/main/java/games/rednblack/editor/utils/HyperLap2DUtils.java index bd5a0760..ae99c76e 100644 --- a/src/main/java/games/rednblack/editor/utils/HyperLap2DUtils.java +++ b/src/main/java/games/rednblack/editor/utils/HyperLap2DUtils.java @@ -5,9 +5,9 @@ import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.InputListener; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.ui.UIWindowTitle; import games.rednblack.editor.view.ui.UIWindowTitleMediator; +import games.rednblack.puremvc.Facade; import org.apache.commons.io.filefilter.SuffixFileFilter; import org.apache.commons.lang3.SystemUtils; import org.lwjgl.BufferUtils; @@ -228,7 +228,7 @@ public class HyperLap2DUtils { } //Test if the pointer is in Title Bar - UIWindowTitleMediator uiWindowTitleMediator = HyperLap2DFacade.getInstance().retrieveMediator(UIWindowTitleMediator.NAME); + UIWindowTitleMediator uiWindowTitleMediator = Facade.getInstance().retrieveMediator(UIWindowTitleMediator.NAME); UIWindowTitle uiWindowTitle = uiWindowTitleMediator.getViewComponent(); int glfwX = getX(); diff --git a/src/main/java/games/rednblack/editor/utils/KeyBindingsLayout.java b/src/main/java/games/rednblack/editor/utils/KeyBindingsLayout.java index 9e558727..e85524aa 100644 --- a/src/main/java/games/rednblack/editor/utils/KeyBindingsLayout.java +++ b/src/main/java/games/rednblack/editor/utils/KeyBindingsLayout.java @@ -5,8 +5,8 @@ import com.badlogic.gdx.Input; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Json; import com.badlogic.gdx.utils.ObjectMap; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.SettingsManager; +import games.rednblack.puremvc.Facade; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.SystemUtils; @@ -108,7 +108,7 @@ public class KeyBindingsLayout { private static final Array mapping = new Array<>(); public static void init() { - SettingsManager settingsManager = HyperLap2DFacade.getInstance().retrieveProxy(SettingsManager.NAME); + SettingsManager settingsManager = Facade.getInstance().retrieveProxy(SettingsManager.NAME); if (!settingsManager.editorConfigVO.keyBindingLayout.equals("default")) { String mapPath = HyperLap2DUtils.getKeyMapPath() + File.separator + settingsManager.editorConfigVO.keyBindingLayout + ".keymap"; File mapFile = new File(mapPath); diff --git a/src/main/java/games/rednblack/editor/utils/MoveCommandBuilder.java b/src/main/java/games/rednblack/editor/utils/MoveCommandBuilder.java index c46508cc..58336ce7 100644 --- a/src/main/java/games/rednblack/editor/utils/MoveCommandBuilder.java +++ b/src/main/java/games/rednblack/editor/utils/MoveCommandBuilder.java @@ -20,11 +20,11 @@ package games.rednblack.editor.utils; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.components.TransformComponent; import games.rednblack.editor.renderer.utils.ComponentRetriever; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; /** * Created by azakhary on 6/5/2015. @@ -59,7 +59,7 @@ public class MoveCommandBuilder { } public void execute() { - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_ITEMS_MOVE_TO, payload); + Facade.getInstance().sendNotification(MsgAPI.ACTION_ITEMS_MOVE_TO, payload); } } diff --git a/src/main/java/games/rednblack/editor/utils/ResourceListAdapter.java b/src/main/java/games/rednblack/editor/utils/ResourceListAdapter.java index 84c24e97..04ac58a9 100644 --- a/src/main/java/games/rednblack/editor/utils/ResourceListAdapter.java +++ b/src/main/java/games/rednblack/editor/utils/ResourceListAdapter.java @@ -8,8 +8,8 @@ import com.badlogic.gdx.utils.Scaling; import com.kotcrab.vis.ui.util.adapter.SimpleListAdapter; import com.kotcrab.vis.ui.widget.VisLabel; import com.kotcrab.vis.ui.widget.VisTable; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ResourceManager; +import games.rednblack.puremvc.Facade; public class ResourceListAdapter extends SimpleListAdapter { public ResourceListAdapter(Array array) { @@ -26,7 +26,7 @@ public class ResourceListAdapter extends SimpleListAdapter { @Override protected VisTable createView(String item) { - ResourceManager rm = HyperLap2DFacade.getInstance().retrieveProxy(ResourceManager.NAME); + ResourceManager rm = Facade.getInstance().retrieveProxy(ResourceManager.NAME); VisTable table = new VisTable(); table.left(); diff --git a/src/main/java/games/rednblack/editor/utils/asset/Asset.java b/src/main/java/games/rednblack/editor/utils/asset/Asset.java index a79a7abe..e3c95c95 100644 --- a/src/main/java/games/rednblack/editor/utils/asset/Asset.java +++ b/src/main/java/games/rednblack/editor/utils/asset/Asset.java @@ -2,7 +2,6 @@ package games.rednblack.editor.utils.asset; import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.utils.Array; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.proxy.ResolutionManager; import games.rednblack.editor.proxy.ResourceManager; @@ -11,8 +10,8 @@ import games.rednblack.editor.utils.AssetsUtils; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.ProgressHandler; import games.rednblack.h2d.common.vo.ExportMapperVO; +import games.rednblack.puremvc.Facade; import org.apache.commons.io.FileUtils; -import org.puremvc.java.patterns.facade.Facade; import java.io.File; import java.io.IOException; @@ -33,7 +32,7 @@ public abstract class Asset implements IAsset { protected String currentProjectPath; public Asset() { - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); projectManager = facade.retrieveProxy(ProjectManager.NAME); resolutionManager = facade.retrieveProxy(ResolutionManager.NAME); resourceManager = facade.retrieveProxy(ResourceManager.NAME); diff --git a/src/main/java/games/rednblack/editor/utils/asset/impl/HyperLap2DLibraryAsset.java b/src/main/java/games/rednblack/editor/utils/asset/impl/HyperLap2DLibraryAsset.java index bc7f78ac..9a198060 100644 --- a/src/main/java/games/rednblack/editor/utils/asset/impl/HyperLap2DLibraryAsset.java +++ b/src/main/java/games/rednblack/editor/utils/asset/impl/HyperLap2DLibraryAsset.java @@ -5,7 +5,6 @@ import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.GdxRuntimeException; import com.badlogic.gdx.utils.Json; import com.kotcrab.vis.ui.util.dialog.Dialogs; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ResolutionManager; import games.rednblack.editor.renderer.components.MainItemComponent; import games.rednblack.editor.renderer.data.CompositeItemVO; @@ -20,6 +19,7 @@ import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.ProgressHandler; import games.rednblack.h2d.common.vo.ExportMapperVO; +import games.rednblack.puremvc.Facade; import org.apache.commons.io.FileUtils; import java.io.File; @@ -132,7 +132,7 @@ public class HyperLap2DLibraryAsset extends Asset { e.printStackTrace(); } - ResolutionManager resolutionManager = HyperLap2DFacade.getInstance().retrieveProxy(ResolutionManager.NAME); + ResolutionManager resolutionManager = Facade.getInstance().retrieveProxy(ResolutionManager.NAME); resolutionManager.rePackProjectImagesForAllResolutionsSync(); progressHandler.progressChanged(100); diff --git a/src/main/java/games/rednblack/editor/view/HyperLap2DScreen.java b/src/main/java/games/rednblack/editor/view/HyperLap2DScreen.java index 555f380a..4592e6c9 100644 --- a/src/main/java/games/rednblack/editor/view/HyperLap2DScreen.java +++ b/src/main/java/games/rednblack/editor/view/HyperLap2DScreen.java @@ -29,7 +29,6 @@ import com.badlogic.gdx.scenes.scene2d.actions.Actions; import com.badlogic.gdx.scenes.scene2d.ui.Image; import com.badlogic.gdx.utils.Align; import games.rednblack.editor.HyperLap2DApp; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.proxy.SettingsManager; import games.rednblack.editor.utils.KeyBindingsLayout; @@ -43,6 +42,7 @@ import games.rednblack.editor.view.ui.widget.actors.basic.WhitePixel; import games.rednblack.h2d.common.MenuAPI; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.vo.SceneConfigVO; +import games.rednblack.puremvc.Facade; public class HyperLap2DScreen implements Screen, InputProcessor { private static final String TAG = HyperLap2DScreen.class.getCanonicalName(); @@ -51,7 +51,7 @@ public class HyperLap2DScreen implements Screen, InputProcessor { private com.artemis.World engine; - private final HyperLap2DFacade facade; + private final Facade facade; private Sandbox sandbox; private SandboxBackUI sandboxBackUI; @@ -65,7 +65,7 @@ public class HyperLap2DScreen implements Screen, InputProcessor { private boolean isDrawingBgLogo; public HyperLap2DScreen() { - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); defaultBackgroundColor = new Color(0.15f, 0.15f, 0.15f, 1.0f); SettingsManager settingsManager = facade.retrieveProxy(SettingsManager.NAME); backgroundColor = settingsManager.editorConfigVO.backgroundColor; @@ -105,7 +105,7 @@ public class HyperLap2DScreen implements Screen, InputProcessor { } private void updateCameraPosition() { - ProjectManager projectManager = HyperLap2DFacade.getInstance().retrieveProxy(ProjectManager.NAME); + ProjectManager projectManager = Facade.getInstance().retrieveProxy(ProjectManager.NAME); SceneConfigVO sceneConfigVO = projectManager.getCurrentSceneConfigVO(); if (sceneConfigVO != null) sandbox.getCamera().position.set(sceneConfigVO.cameraPosition[0], sceneConfigVO.cameraPosition[1], 0); diff --git a/src/main/java/games/rednblack/editor/view/HyperLap2DScreenMediator.java b/src/main/java/games/rednblack/editor/view/HyperLap2DScreenMediator.java index f28e74b0..ae2b01d7 100644 --- a/src/main/java/games/rednblack/editor/view/HyperLap2DScreenMediator.java +++ b/src/main/java/games/rednblack/editor/view/HyperLap2DScreenMediator.java @@ -18,15 +18,16 @@ package games.rednblack.editor.view; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.proxy.SettingsManager; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.stage.SandboxMediator; import games.rednblack.editor.view.ui.widget.actors.basic.SandboxBackUI; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; /** * Created by sargis on 3/30/15. @@ -40,25 +41,17 @@ public class HyperLap2DScreenMediator extends Mediator { } @Override - public void onRegister() { - super.onRegister(); - facade = HyperLap2DFacade.getInstance(); - } - - @Override - public String[] listNotificationInterests() { - return new String[]{ - MsgAPI.CREATE, + public void listNotificationInterests(Interests interests) { + interests.add(MsgAPI.CREATE, MsgAPI.PAUSE, MsgAPI.RESUME, - MsgAPI.RENDER, - MsgAPI.RESIZE, + MsgAPI.RENDER); + interests.add(MsgAPI.RESIZE, MsgAPI.DISPOSE, MsgAPI.SCENE_LOADED, - MsgAPI.SAVE_EDITOR_CONFIG, - MsgAPI.SHOW_BLACK_OVERLAY, - MsgAPI.HIDE_BLACK_OVERLAY - }; + MsgAPI.SAVE_EDITOR_CONFIG); + interests.add(MsgAPI.SHOW_BLACK_OVERLAY, + MsgAPI.HIDE_BLACK_OVERLAY); } @Override @@ -67,8 +60,7 @@ public class HyperLap2DScreenMediator extends Mediator { switch (notification.getName()) { case MsgAPI.CREATE: setViewComponent(new HyperLap2DScreen()); - //TODO this must be changed to Command - facade = HyperLap2DFacade.getInstance(); + //TODO this must be changed to Command SandboxMediator sandboxMediator = facade.retrieveMediator(SandboxMediator.NAME); com.artemis.World engine = sandboxMediator.getViewComponent().getEngine(); @@ -77,7 +69,6 @@ public class HyperLap2DScreenMediator extends Mediator { viewComponent.show(); break; case MsgAPI.SCENE_LOADED: - facade = HyperLap2DFacade.getInstance(); SandboxBackUI sandboxBackUI = new SandboxBackUI(Sandbox.getInstance().getUIStage().getBatch()); getViewComponent().setBackUI(sandboxBackUI); getViewComponent().disableDrawingBgLogo(); diff --git a/src/main/java/games/rednblack/editor/view/SceneControlMediator.java b/src/main/java/games/rednblack/editor/view/SceneControlMediator.java index 07c28939..693ba02d 100644 --- a/src/main/java/games/rednblack/editor/view/SceneControlMediator.java +++ b/src/main/java/games/rednblack/editor/view/SceneControlMediator.java @@ -19,7 +19,6 @@ package games.rednblack.editor.view; import com.badlogic.gdx.utils.viewport.ScreenViewport; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.proxy.ResolutionManager; import games.rednblack.editor.proxy.ResourceManager; @@ -28,6 +27,7 @@ import games.rednblack.editor.renderer.data.CompositeItemVO; import games.rednblack.editor.renderer.data.ProjectInfoVO; import games.rednblack.editor.renderer.data.SceneVO; import games.rednblack.editor.view.stage.Sandbox; +import games.rednblack.puremvc.Facade; /** * Mediates scene communication between editor and current runtime @@ -36,7 +36,7 @@ import games.rednblack.editor.view.stage.Sandbox; */ public class SceneControlMediator { - private final HyperLap2DFacade facade; + private final Facade facade; private final ProjectManager projectManager; /** * main holder of the scene @@ -56,7 +56,7 @@ public class SceneControlMediator { public SceneControlMediator(SceneLoader sceneLoader) { this.sceneLoader = sceneLoader; - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); projectManager = facade.retrieveProxy(ProjectManager.NAME); } diff --git a/src/main/java/games/rednblack/editor/view/menu/HyperLap2DMenuBarMediator.java b/src/main/java/games/rednblack/editor/view/menu/HyperLap2DMenuBarMediator.java index 1c3985fd..f00dcc68 100644 --- a/src/main/java/games/rednblack/editor/view/menu/HyperLap2DMenuBarMediator.java +++ b/src/main/java/games/rednblack/editor/view/menu/HyperLap2DMenuBarMediator.java @@ -21,7 +21,6 @@ package games.rednblack.editor.view.menu; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.files.FileHandle; import games.rednblack.editor.HyperLap2DApp; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.ShowNotificationCommand; import games.rednblack.editor.data.manager.PreferencesManager; import games.rednblack.editor.proxy.CommandManager; @@ -31,11 +30,12 @@ import games.rednblack.editor.renderer.data.SceneVO; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.MenuAPI; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import org.lwjgl.PointerBuffer; import org.lwjgl.system.MemoryStack; import org.lwjgl.util.tinyfd.TinyFileDialogs; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -57,35 +57,29 @@ public class HyperLap2DMenuBarMediator extends Mediator { @Override public void onRegister() { super.onRegister(); - facade = HyperLap2DFacade.getInstance(); projectManager = facade.retrieveProxy(ProjectManager.NAME); settingsManager = facade.retrieveProxy(SettingsManager.NAME); } @Override - public String[] listNotificationInterests() { - return new String[]{ - //FILE - FileMenu.NEW_PROJECT, + public void listNotificationInterests(Interests interests) { + interests.add(FileMenu.NEW_PROJECT, FileMenu.OPEN_PROJECT, FileMenu.SAVE_PROJECT, - FileMenu.SAVE_PROJECT_AS, - FileMenu.EXPORT, + FileMenu.SAVE_PROJECT_AS); + interests.add(FileMenu.EXPORT, FileMenu.RECENT_PROJECTS, FileMenu.CLEAR_RECENT, - FileMenu.EXIT, - //EDIT - EditMenu.CUT, + FileMenu.EXIT); + interests.add(EditMenu.CUT, EditMenu.COPY, EditMenu.PASTE, - EditMenu.UNDO, - EditMenu.REDO, - //General + EditMenu.UNDO); + interests.add(EditMenu.REDO, ProjectManager.PROJECT_OPENED, HyperLap2DMenuBar.RECENT_LIST_MODIFIED, - MsgAPI.CREATE, - MsgAPI.AUTO_SAVE_PROJECT - }; + MsgAPI.CREATE); + interests.add(MsgAPI.AUTO_SAVE_PROJECT); } @Override diff --git a/src/main/java/games/rednblack/editor/view/stage/ItemSelector.java b/src/main/java/games/rednblack/editor/view/stage/ItemSelector.java index 83e8e411..27a1ab0e 100644 --- a/src/main/java/games/rednblack/editor/view/stage/ItemSelector.java +++ b/src/main/java/games/rednblack/editor/view/stage/ItemSelector.java @@ -20,7 +20,6 @@ package games.rednblack.editor.view.stage; import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.SnapshotArray; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.components.NodeComponent; import games.rednblack.editor.renderer.data.LayerItemVO; import games.rednblack.editor.utils.Constants; @@ -31,6 +30,7 @@ import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.editor.view.SceneControlMediator; import games.rednblack.editor.view.ui.FollowersUIMediator; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; import java.util.Arrays; import java.util.HashSet; @@ -62,7 +62,7 @@ public class ItemSelector { this.sandbox = sandbox; sceneControl = sandbox.sceneControl; - followersUIMediator = HyperLap2DFacade.getInstance().retrieveMediator(FollowersUIMediator.NAME); + followersUIMediator = Facade.getInstance().retrieveMediator(FollowersUIMediator.NAME); } /***************************** Getters *********************************/ @@ -215,7 +215,7 @@ public class ItemSelector { currentSelection.add(item); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_SELECTION_CHANGED, currentSelection); + Facade.getInstance().sendNotification(MsgAPI.ITEM_SELECTION_CHANGED, currentSelection); } /** @@ -241,18 +241,18 @@ public class ItemSelector { currentSelection.clear(); if(items == null) { - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_SELECTION_CHANGED, currentSelection); + Facade.getInstance().sendNotification(MsgAPI.ITEM_SELECTION_CHANGED, currentSelection); return; } currentSelection.addAll(items.stream().collect(Collectors.toList())); if (alsoShow) { - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.SHOW_SELECTIONS, currentSelection); + Facade.getInstance().sendNotification(MsgAPI.SHOW_SELECTIONS, currentSelection); } else { - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.HIDE_SELECTIONS, currentSelection); + Facade.getInstance().sendNotification(MsgAPI.HIDE_SELECTIONS, currentSelection); } - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_SELECTION_CHANGED, currentSelection); + Facade.getInstance().sendNotification(MsgAPI.ITEM_SELECTION_CHANGED, currentSelection); } /** @@ -272,7 +272,7 @@ public class ItemSelector { public void releaseSelection(int item) { currentSelection.remove(item); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_SELECTION_CHANGED, currentSelection); + Facade.getInstance().sendNotification(MsgAPI.ITEM_SELECTION_CHANGED, currentSelection); } /** @@ -281,7 +281,7 @@ public class ItemSelector { public void clearSelections() { currentSelection.clear(); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_SELECTION_CHANGED, currentSelection); + Facade.getInstance().sendNotification(MsgAPI.ITEM_SELECTION_CHANGED, currentSelection); } @@ -520,7 +520,7 @@ public class ItemSelector { public void moveSelectedItemsBy(float x, float y) { for (int entity : currentSelection) { sandbox.itemControl.moveItemBy(entity, x, y); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } } diff --git a/src/main/java/games/rednblack/editor/view/stage/Sandbox.java b/src/main/java/games/rednblack/editor/view/stage/Sandbox.java index da3cb614..0b5e9659 100644 --- a/src/main/java/games/rednblack/editor/view/stage/Sandbox.java +++ b/src/main/java/games/rednblack/editor/view/stage/Sandbox.java @@ -33,7 +33,6 @@ import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Json; import com.badlogic.gdx.utils.viewport.Viewport; import com.kotcrab.vis.ui.util.ToastManager; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.*; import games.rednblack.editor.renderer.ExternalTypesConfiguration; import games.rednblack.editor.renderer.SceneConfiguration; @@ -66,6 +65,7 @@ import games.rednblack.h2d.extension.talos.TalosSystem; import games.rednblack.h2d.extension.tinyvg.TinyVGItemType; import games.rednblack.h2d.extension.typinglabel.TypingLabelItemType; import games.rednblack.h2d.extension.spine.SpineItemType; +import games.rednblack.puremvc.Facade; import java.util.HashMap; @@ -93,7 +93,7 @@ public class Sandbox { public String currentLoadedSceneFileName; private UIStage uiStage; private ItemSelector selector; - private HyperLap2DFacade facade; + private Facade facade; private ProjectManager projectManager; private ResourceManager resourceManager; @@ -131,7 +131,7 @@ public class Sandbox { final WorldSerializationManager manager = new WorldSerializationManager(); private void init() { - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); projectManager = facade.retrieveProxy(ProjectManager.NAME); resourceManager = facade.retrieveProxy(ResourceManager.NAME); diff --git a/src/main/java/games/rednblack/editor/view/stage/SandboxMediator.java b/src/main/java/games/rednblack/editor/view/stage/SandboxMediator.java index 6a84514e..9602980c 100644 --- a/src/main/java/games/rednblack/editor/view/stage/SandboxMediator.java +++ b/src/main/java/games/rednblack/editor/view/stage/SandboxMediator.java @@ -27,7 +27,6 @@ import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.SnapshotArray; import com.kotcrab.vis.ui.FocusManager; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.AddComponentToItemCommand; import games.rednblack.editor.controller.commands.CompositeCameraChangeCommand; import games.rednblack.editor.controller.commands.RemoveComponentFromItemCommand; @@ -43,8 +42,10 @@ import games.rednblack.editor.view.stage.tools.TransformTool; import games.rednblack.editor.view.ui.box.UIToolBoxMediator; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.view.tools.Tool; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import java.util.HashMap; @@ -76,8 +77,6 @@ public class SandboxMediator extends Mediator { public void onRegister() { super.onRegister(); - facade = HyperLap2DFacade.getInstance(); - stageListener = new SandboxStageEventListener(); getViewComponent().addListener(stageListener); @@ -99,20 +98,18 @@ public class SandboxMediator extends Mediator { } @Override - public String[] listNotificationInterests() { - return new String[]{ - MsgAPI.SCENE_LOADED, + public void listNotificationInterests(Interests interests) { + interests.add(MsgAPI.SCENE_LOADED, MsgAPI.TOOL_SELECTED, MsgAPI.NEW_ITEM_ADDED, - MsgAPI.NEW_TOOL_ADDED, - MsgAPI.RESIZE, + MsgAPI.NEW_TOOL_ADDED); + interests.add(MsgAPI.RESIZE, MsgAPI.DISPOSE, CompositeCameraChangeCommand.DONE, - AddComponentToItemCommand.DONE, - RemoveComponentFromItemCommand.DONE, + AddComponentToItemCommand.DONE); + interests.add(RemoveComponentFromItemCommand.DONE, MsgAPI.ITEM_SELECTION_CHANGED, - PanTool.SCENE_PANNED - }; + PanTool.SCENE_PANNED); } @Override @@ -233,7 +230,7 @@ public class SandboxMediator extends Mediator { if (button == Input.Buttons.RIGHT) { // if right clicked on an item, drop down for current selection - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_RIGHT_CLICK); + Facade.getInstance().sendNotification(MsgAPI.ITEM_RIGHT_CLICK); } } diff --git a/src/main/java/games/rednblack/editor/view/stage/UIStage.java b/src/main/java/games/rednblack/editor/view/stage/UIStage.java index 5e8ba353..35a6f9ed 100644 --- a/src/main/java/games/rednblack/editor/view/stage/UIStage.java +++ b/src/main/java/games/rednblack/editor/view/stage/UIStage.java @@ -23,11 +23,11 @@ import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.viewport.ScreenViewport; import com.kotcrab.vis.ui.util.ToastManager; import com.kotcrab.vis.ui.widget.VisTable; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.SettingsManager; import games.rednblack.editor.renderer.utils.TextureArrayCpuPolygonSpriteBatch; import games.rednblack.editor.view.ui.*; import games.rednblack.h2d.common.proxy.CursorManager; +import games.rednblack.puremvc.Facade; public class UIStage extends Stage { @@ -35,7 +35,7 @@ public class UIStage extends Stage { public static final int SANDBOX_BOTTOM_MARGIN = 38; public static final int SANDBOX_LEFT_MARGIN = 40; - private final HyperLap2DFacade facade; + private final Facade facade; public Group dummyTarget; public UIMainTable uiMainTable; public Group contextMenuContainer; @@ -46,7 +46,7 @@ public class UIStage extends Stage { public UIStage() { super(new ScreenViewport(), new TextureArrayCpuPolygonSpriteBatch(10_000)); - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); getViewport().getCamera().position.setZero(); updateViewportDensity(); diff --git a/src/main/java/games/rednblack/editor/view/stage/UIStageMediator.java b/src/main/java/games/rednblack/editor/view/stage/UIStageMediator.java index 966c438f..5dfe32db 100644 --- a/src/main/java/games/rednblack/editor/view/stage/UIStageMediator.java +++ b/src/main/java/games/rednblack/editor/view/stage/UIStageMediator.java @@ -21,10 +21,10 @@ package games.rednblack.editor.view.stage; import com.badlogic.gdx.Gdx; import com.kotcrab.vis.ui.util.dialog.Dialogs; import com.kotcrab.vis.ui.util.dialog.InputDialogListener; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; /** * Created by sargis on 4/20/15. @@ -40,15 +40,12 @@ public class UIStageMediator extends Mediator { @Override public void onRegister() { super.onRegister(); - facade = HyperLap2DFacade.getInstance(); } @Override - public String[] listNotificationInterests() { - return new String[]{ - MsgAPI.SHOW_ADD_LIBRARY_DIALOG, - MsgAPI.SAVE_EDITOR_CONFIG - }; + public void listNotificationInterests(Interests interests) { + interests.add(MsgAPI.SHOW_ADD_LIBRARY_DIALOG, + MsgAPI.SAVE_EDITOR_CONFIG); } @Override diff --git a/src/main/java/games/rednblack/editor/view/stage/input/SandboxInputAdapter.java b/src/main/java/games/rednblack/editor/view/stage/input/SandboxInputAdapter.java index 927a8531..7025c3a6 100644 --- a/src/main/java/games/rednblack/editor/view/stage/input/SandboxInputAdapter.java +++ b/src/main/java/games/rednblack/editor/view/stage/input/SandboxInputAdapter.java @@ -9,7 +9,6 @@ import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.SnapshotArray; import com.badlogic.gdx.utils.viewport.Viewport; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.components.NodeComponent; import games.rednblack.editor.renderer.components.ParentNodeComponent; import games.rednblack.editor.renderer.components.TransformComponent; @@ -22,10 +21,11 @@ import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.stage.SandboxMediator; +import games.rednblack.puremvc.Facade; public class SandboxInputAdapter implements InputProcessor { - private HyperLap2DFacade facade; + private Facade facade; private int rootEntity; private InputListenerComponent inpputListenerComponent; private int target; @@ -34,7 +34,7 @@ public class SandboxInputAdapter implements InputProcessor { private final EntityBounds tempEntityBounds = new EntityBounds(); public SandboxInputAdapter() { - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); SandboxMediator sandboxMediator = facade.retrieveMediator(SandboxMediator.NAME); sandbox = sandboxMediator.getViewComponent(); } diff --git a/src/main/java/games/rednblack/editor/view/stage/tools/PanTool.java b/src/main/java/games/rednblack/editor/view/stage/tools/PanTool.java index 8deee610..8034f5e4 100644 --- a/src/main/java/games/rednblack/editor/view/stage/tools/PanTool.java +++ b/src/main/java/games/rednblack/editor/view/stage/tools/PanTool.java @@ -3,11 +3,11 @@ package games.rednblack.editor.view.stage.tools; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.math.Vector2; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ResourceManager; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.proxy.CursorManager; import games.rednblack.h2d.common.view.ui.Cursors; +import games.rednblack.puremvc.Facade; /** * Created by CyberJoe on 5/1/2015. @@ -37,7 +37,7 @@ public class PanTool extends SimpleTool { @Override public void initTool() { - CursorManager cursorManager = HyperLap2DFacade.getInstance().retrieveProxy(CursorManager.NAME); + CursorManager cursorManager = Facade.getInstance().retrieveProxy(CursorManager.NAME); cursorManager.setCursor(Cursors.HAND); } @@ -94,7 +94,7 @@ public class PanTool extends SimpleTool { float currX, currY; private void doPanning(float x, float y) { - ResourceManager resourceManager = HyperLap2DFacade.getInstance().retrieveProxy(ResourceManager.NAME); + ResourceManager resourceManager = Facade.getInstance().retrieveProxy(ResourceManager.NAME); Sandbox sandbox = Sandbox.getInstance(); OrthographicCamera camera = sandbox.getCamera(); @@ -106,6 +106,6 @@ public class PanTool extends SimpleTool { lastCoordinates.set(Gdx.input.getX(), Gdx.input.getY()); - HyperLap2DFacade.getInstance().sendNotification(SCENE_PANNED); + Facade.getInstance().sendNotification(SCENE_PANNED); } } diff --git a/src/main/java/games/rednblack/editor/view/stage/tools/PolygonTool.java b/src/main/java/games/rednblack/editor/view/stage/tools/PolygonTool.java index f80eb69a..b06207a6 100644 --- a/src/main/java/games/rednblack/editor/view/stage/tools/PolygonTool.java +++ b/src/main/java/games/rednblack/editor/view/stage/tools/PolygonTool.java @@ -22,7 +22,6 @@ import com.badlogic.gdx.Input; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.IntSet; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.AddComponentToItemCommand; import games.rednblack.editor.controller.commands.RemoveComponentFromItemCommand; import games.rednblack.editor.controller.commands.component.UpdatePolygonVerticesCommand; @@ -35,7 +34,8 @@ import games.rednblack.editor.view.ui.followers.BasicFollower; import games.rednblack.editor.view.ui.followers.PolygonFollower; import games.rednblack.editor.view.ui.followers.PolygonTransformationListener; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.interfaces.INotification; import java.util.Set; @@ -80,7 +80,7 @@ public class PolygonTool extends SelectionTool implements PolygonTransformationL public void initTool() { super.initTool(); - followersUIMediator = HyperLap2DFacade.getInstance().retrieveMediator(FollowersUIMediator.NAME); + followersUIMediator = Facade.getInstance().retrieveMediator(FollowersUIMediator.NAME); updateSubFollowerList(); } @@ -145,7 +145,7 @@ public class PolygonTool extends SelectionTool implements PolygonTransformationL follower.setProblems(null); UpdatePolygonVerticesCommand.payload(currentCommandPayload, polygonShapeComponent.vertices, polygonShapeComponent.polygonizedVertices); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_UPDATE_MESH_DATA, currentCommandPayload); + Facade.getInstance().sendNotification(MsgAPI.ACTION_UPDATE_MESH_DATA, currentCommandPayload); } @Override @@ -211,7 +211,7 @@ public class PolygonTool extends SelectionTool implements PolygonTransformationL Object[] payload = new Object[2]; payload[0] = follower; payload[1] = anchor; - HyperLap2DFacade.getInstance().sendNotification(PolygonTool.MANUAL_VERTEX_POSITION, payload); + Facade.getInstance().sendNotification(PolygonTool.MANUAL_VERTEX_POSITION, payload); return; } @@ -230,7 +230,7 @@ public class PolygonTool extends SelectionTool implements PolygonTransformationL } private PolygonFollower getMeshFollower(int entity) { - FollowersUIMediator followersUIMediator = HyperLap2DFacade.getInstance().retrieveMediator(FollowersUIMediator.NAME); + FollowersUIMediator followersUIMediator = Facade.getInstance().retrieveMediator(FollowersUIMediator.NAME); BasicFollower follower = followersUIMediator.getFollower(entity); PolygonFollower meshFollower = (PolygonFollower) (follower).getSubFollower(PolygonFollower.class); @@ -262,7 +262,7 @@ public class PolygonTool extends SelectionTool implements PolygonTransformationL } UpdatePolygonVerticesCommand.payload(currentCommandPayload, polygonShapeComponent.vertices, polygonShapeComponent.polygonizedVertices); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_UPDATE_MESH_DATA, currentCommandPayload); + Facade.getInstance().sendNotification(MsgAPI.ACTION_UPDATE_MESH_DATA, currentCommandPayload); follower.update(); diff --git a/src/main/java/games/rednblack/editor/view/stage/tools/SelectionTool.java b/src/main/java/games/rednblack/editor/view/stage/tools/SelectionTool.java index 86d55b82..ac13f7bf 100644 --- a/src/main/java/games/rednblack/editor/view/stage/tools/SelectionTool.java +++ b/src/main/java/games/rednblack/editor/view/stage/tools/SelectionTool.java @@ -25,7 +25,6 @@ import com.badlogic.gdx.math.*; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.viewport.Viewport; import com.kotcrab.vis.ui.util.OsUtils; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.components.DimensionsComponent; import games.rednblack.editor.renderer.components.ParentNodeComponent; import games.rednblack.editor.renderer.components.TransformComponent; @@ -38,6 +37,7 @@ import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.proxy.CursorManager; import games.rednblack.h2d.common.view.ui.Cursors; +import games.rednblack.puremvc.Facade; import java.util.HashMap; import java.util.HashSet; @@ -97,7 +97,7 @@ public class SelectionTool extends SimpleTool { sandbox = Sandbox.getInstance(); // set cursor - CursorManager cursorManager = HyperLap2DFacade.getInstance().retrieveProxy(CursorManager.NAME); + CursorManager cursorManager = Facade.getInstance().retrieveProxy(CursorManager.NAME); cursorManager.setCursor(Cursors.NORMAL); } @@ -140,7 +140,7 @@ public class SelectionTool extends SimpleTool { return; ParentNodeComponent parentNodeComponent = SandboxComponentRetriever.get(currentView, ParentNodeComponent.class); if (parentNodeComponent != null) { - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_CAMERA_CHANGE_COMPOSITE, parentNodeComponent.parentEntity); + Facade.getInstance().sendNotification(MsgAPI.ACTION_CAMERA_CHANGE_COMPOSITE, parentNodeComponent.parentEntity); } } @@ -148,7 +148,7 @@ public class SelectionTool extends SimpleTool { public boolean itemMouseDown(int entity, float x, float y) { isItemDown = true; sandbox = Sandbox.getInstance(); - HyperLap2DFacade facade = HyperLap2DFacade.getInstance(); + Facade facade = Facade.getInstance(); currentTouchedItemWasSelected = sandbox.getSelector().getCurrentSelection().contains(entity); @@ -184,7 +184,7 @@ public class SelectionTool extends SimpleTool { dragMouseStartPosition = new Vector2(x, y); // pining UI to update current item properties tools - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); return true; } @@ -197,8 +197,8 @@ public class SelectionTool extends SimpleTool { if (!isDragging && (Gdx.input.isKeyPressed(Input.Keys.ALT_LEFT) || Gdx.input.isKeyPressed(Input.Keys.ALT_RIGHT))) { // first drag iteration and is copy mode // we need to copy/paste the item in place, the set it as selection and draggable, then perform the drag. - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_COPY); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_PASTE); + Facade.getInstance().sendNotification(MsgAPI.ACTION_COPY); + Facade.getInstance().sendNotification(MsgAPI.ACTION_PASTE); dragStartPositions.clear(); dragTouchDiff.clear(); @@ -212,7 +212,7 @@ public class SelectionTool extends SimpleTool { dragMouseStartPosition = new Vector2(x, y); // pining UI to update current item properties tools - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } @@ -267,7 +267,7 @@ public class SelectionTool extends SimpleTool { //value.hide(); // pining UI to update current item properties tools - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, itemInstance); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, itemInstance); } } @@ -288,7 +288,7 @@ public class SelectionTool extends SimpleTool { transformComponent.rotation = (transformComponent.rotation + degreeAmount) % 360; // pining UI to update current item properties tools - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, itemInstance); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, itemInstance); } } @@ -299,7 +299,7 @@ public class SelectionTool extends SimpleTool { public void itemMouseUp(int entity, float x, float y) { isItemDown = false; sandbox = Sandbox.getInstance(); - HyperLap2DFacade facade = HyperLap2DFacade.getInstance(); + Facade facade = Facade.getInstance(); if (currentTouchedItemWasSelected && !isDragging) { // item was selected (and no dragging was performed), so we need to release it @@ -328,7 +328,7 @@ public class SelectionTool extends SimpleTool { payloads.add(payload); } - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_ITEMS_MOVE_TO, payloads); + Facade.getInstance().sendNotification(MsgAPI.ACTION_ITEMS_MOVE_TO, payloads); } isDragging = false; @@ -338,7 +338,7 @@ public class SelectionTool extends SimpleTool { @Override public void itemMouseDoubleClick(int item, float x, float y) { if (sandbox.getSelector().selectionIsComposite()) { - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_CAMERA_CHANGE_COMPOSITE, item); + Facade.getInstance().sendNotification(MsgAPI.ACTION_CAMERA_CHANGE_COMPOSITE, item); } } @@ -351,7 +351,7 @@ public class SelectionTool extends SimpleTool { private void selectionComplete() { sandbox = Sandbox.getInstance(); - HyperLap2DFacade facade = HyperLap2DFacade.getInstance(); + Facade facade = Facade.getInstance(); OrthographicCamera camera = Sandbox.getInstance().getCamera(); Viewport viewport = Sandbox.getInstance().getViewport(); @@ -471,12 +471,12 @@ public class SelectionTool extends SimpleTool { } if (payloads.size > 0) - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_ITEMS_MOVE_TO, payloads); + Facade.getInstance().sendNotification(MsgAPI.ACTION_ITEMS_MOVE_TO, payloads); } // Delete if (keycode == Input.Keys.DEL || keycode == Input.Keys.FORWARD_DEL) { - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_DELETE); + Facade.getInstance().sendNotification(MsgAPI.ACTION_DELETE); } } diff --git a/src/main/java/games/rednblack/editor/view/stage/tools/SimpleTool.java b/src/main/java/games/rednblack/editor/view/stage/tools/SimpleTool.java index 17e6c912..a3e7a4dd 100644 --- a/src/main/java/games/rednblack/editor/view/stage/tools/SimpleTool.java +++ b/src/main/java/games/rednblack/editor/view/stage/tools/SimpleTool.java @@ -1,12 +1,12 @@ package games.rednblack.editor.view.stage.tools; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.ui.FollowersUIMediator; import games.rednblack.editor.view.ui.followers.BasicFollower; import games.rednblack.editor.view.ui.followers.NormalSelectionFollower; import games.rednblack.h2d.common.view.tools.Tool; -import org.puremvc.java.interfaces.INotification; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.interfaces.INotification; import java.util.Set; @@ -19,7 +19,7 @@ public abstract class SimpleTool implements Tool { public void initTool() { Sandbox sandbox = Sandbox.getInstance(); Set currSelection = sandbox.getSelector().getCurrentSelection(); - FollowersUIMediator followersUIMediator = HyperLap2DFacade.getInstance().retrieveMediator(FollowersUIMediator.NAME); + FollowersUIMediator followersUIMediator = Facade.getInstance().retrieveMediator(FollowersUIMediator.NAME); for(int entity: currSelection) { BasicFollower follower = followersUIMediator.getFollower(entity); if(follower instanceof NormalSelectionFollower) { diff --git a/src/main/java/games/rednblack/editor/view/stage/tools/TextTool.java b/src/main/java/games/rednblack/editor/view/stage/tools/TextTool.java index 4f3b5ae2..abe5454d 100644 --- a/src/main/java/games/rednblack/editor/view/stage/tools/TextTool.java +++ b/src/main/java/games/rednblack/editor/view/stage/tools/TextTool.java @@ -21,13 +21,13 @@ package games.rednblack.editor.view.stage.tools; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Align; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.factory.ItemFactory; import games.rednblack.editor.renderer.factory.EntityFactory; import games.rednblack.editor.utils.AppConfig; import games.rednblack.editor.utils.NativeDialogs; import games.rednblack.h2d.common.proxy.CursorManager; import games.rednblack.h2d.common.view.ui.Cursors; +import games.rednblack.puremvc.Facade; import org.apache.commons.lang3.SystemUtils; /** @@ -72,7 +72,7 @@ public class TextTool extends ItemDropTool { @Override public void initTool() { super.initTool(); - CursorManager cursorManager = HyperLap2DFacade.getInstance().retrieveProxy(CursorManager.NAME); + CursorManager cursorManager = Facade.getInstance().retrieveProxy(CursorManager.NAME); cursorManager.setCursor(Cursors.TEXT_TOOL); } diff --git a/src/main/java/games/rednblack/editor/view/stage/tools/TransformTool.java b/src/main/java/games/rednblack/editor/view/stage/tools/TransformTool.java index c5b923d6..f15d4c42 100644 --- a/src/main/java/games/rednblack/editor/view/stage/tools/TransformTool.java +++ b/src/main/java/games/rednblack/editor/view/stage/tools/TransformTool.java @@ -21,7 +21,6 @@ package games.rednblack.editor.view.stage.tools; import com.badlogic.gdx.Input; import com.badlogic.gdx.math.Vector2; import com.kotcrab.vis.ui.util.OsUtils; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.components.TransformComponent; import games.rednblack.editor.renderer.factory.EntityFactory; import games.rednblack.editor.utils.KeyBindingsLayout; @@ -36,7 +35,8 @@ import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.command.TransformCommandBuilder; import games.rednblack.h2d.common.proxy.CursorManager; import games.rednblack.h2d.common.view.ui.Cursors; -import org.puremvc.java.interfaces.INotification; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.interfaces.INotification; import java.util.HashSet; import java.util.Set; @@ -98,7 +98,7 @@ public class TransformTool extends SelectionTool implements FollowerTransformati updateListeners(); // set cursor - cursorManager = HyperLap2DFacade.getInstance().retrieveProxy(CursorManager.NAME); + cursorManager = Facade.getInstance().retrieveProxy(CursorManager.NAME); cursorManager.setCursor(Cursors.CROSS); } @@ -136,7 +136,7 @@ public class TransformTool extends SelectionTool implements FollowerTransformati } private void updateListeners(Set entities) { - FollowersUIMediator followersUIMediator = HyperLap2DFacade.getInstance().retrieveMediator(FollowersUIMediator.NAME); + FollowersUIMediator followersUIMediator = Facade.getInstance().retrieveMediator(FollowersUIMediator.NAME); followersUIMediator.clearAllListeners(); for (int entity : entities) { @@ -197,11 +197,11 @@ public class TransformTool extends SelectionTool implements FollowerTransformati fixCursor = false; if (anchor == NormalSelectionFollower.ORIGIN && button == Input.Buttons.RIGHT) { - HyperLap2DFacade.getInstance().sendNotification(MANUAL_ORIGIN_POSITION, follower.getEntity()); + Facade.getInstance().sendNotification(MANUAL_ORIGIN_POSITION, follower.getEntity()); return; } - commandBuilder.execute(HyperLap2DFacade.getInstance()); + commandBuilder.execute(Facade.getInstance()); if (transformStrategy == compositeStrategy) { compositeStrategy.swapItemFinalAndInitialStates(follower.getEntity()); } @@ -218,7 +218,7 @@ public class TransformTool extends SelectionTool implements FollowerTransformati execute(mouseInitialCoordinates, mousePointStage, anchor, follower.getEntity()); mouseInitialCoordinates.set(mousePointStage.x, mousePointStage.y); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED); } @Override diff --git a/src/main/java/games/rednblack/editor/view/stage/tools/transformStrategy/BasicStrategy.java b/src/main/java/games/rednblack/editor/view/stage/tools/transformStrategy/BasicStrategy.java index 8cd4eaa8..b2e98aa6 100644 --- a/src/main/java/games/rednblack/editor/view/stage/tools/transformStrategy/BasicStrategy.java +++ b/src/main/java/games/rednblack/editor/view/stage/tools/transformStrategy/BasicStrategy.java @@ -3,7 +3,6 @@ package games.rednblack.editor.view.stage.tools.transformStrategy; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input; import com.badlogic.gdx.math.Vector2; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.components.DimensionsComponent; import games.rednblack.editor.renderer.components.TransformComponent; import games.rednblack.editor.utils.RoundUtils; @@ -12,7 +11,7 @@ import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.editor.view.ui.followers.NormalSelectionFollower; import games.rednblack.editor.view.ui.properties.panels.UIBasicItemPropertiesMediator; import games.rednblack.h2d.common.command.TransformCommandBuilder; -import org.puremvc.java.patterns.facade.Facade; +import games.rednblack.puremvc.Facade; /** * Created by Sasun Poghosyan on 4/13/2016. @@ -25,7 +24,7 @@ public class BasicStrategy extends AbstractTransformStrategy { private static final float[] tmp1 = new float[3]; private static final float[] tmp2 = new float[3]; - private final Facade facade = HyperLap2DFacade.getInstance(); + private final Facade facade = Facade.getInstance(); @Override public void calculate(float mouseDx, float mouseDy, int anchor, int entity, TransformCommandBuilder transformCommandBuilder, Vector2 mousePointStage, float lastTransformAngle, float lastEntityAngle) { diff --git a/src/main/java/games/rednblack/editor/view/stage/tools/transformStrategy/CompositeStrategy.java b/src/main/java/games/rednblack/editor/view/stage/tools/transformStrategy/CompositeStrategy.java index 41500cb7..01c7d7f5 100644 --- a/src/main/java/games/rednblack/editor/view/stage/tools/transformStrategy/CompositeStrategy.java +++ b/src/main/java/games/rednblack/editor/view/stage/tools/transformStrategy/CompositeStrategy.java @@ -5,7 +5,6 @@ import com.badlogic.gdx.Input; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.SnapshotArray; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.components.CompositeTransformComponent; import games.rednblack.editor.renderer.components.DimensionsComponent; import games.rednblack.editor.renderer.components.NodeComponent; @@ -16,7 +15,7 @@ import games.rednblack.editor.view.ui.followers.NormalSelectionFollower; import games.rednblack.editor.view.ui.properties.panels.UIBasicItemPropertiesMediator; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.command.TransformCommandBuilder; -import org.puremvc.java.patterns.facade.Facade; +import games.rednblack.puremvc.Facade; import java.util.HashMap; import java.util.Map; @@ -39,7 +38,7 @@ public class CompositeStrategy extends AbstractTransformStrategy { private static final float[] tmp1 = new float[3]; private static final float[] tmp2 = new float[3]; - private final Facade facade = HyperLap2DFacade.getInstance(); + private final Facade facade = Facade.getInstance(); public void getInitialPositions(int entity) { getParentState(entity, parentInitialPosition, parentInitialSize); @@ -68,7 +67,7 @@ public class CompositeStrategy extends AbstractTransformStrategy { payloads.add(payload); } if (!parentFinalPosition.equals(parentInitialPosition) || !parentFinalSize.equals(parentInitialSize)) - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_ITEM_AND_CHILDREN_TO, payloads); + Facade.getInstance().sendNotification(MsgAPI.ACTION_ITEM_AND_CHILDREN_TO, payloads); } private void setParentState(int entity, Vector2 position, Vector2 size) { diff --git a/src/main/java/games/rednblack/editor/view/ui/BoxItemResourceSelectionUIMediator.java b/src/main/java/games/rednblack/editor/view/ui/BoxItemResourceSelectionUIMediator.java index 19c4cf39..0f312c20 100644 --- a/src/main/java/games/rednblack/editor/view/ui/BoxItemResourceSelectionUIMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/BoxItemResourceSelectionUIMediator.java @@ -7,13 +7,14 @@ import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Source; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.ObjectSet; import com.kotcrab.vis.ui.widget.VisTable; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.ui.box.UIResourcesBoxMediator; import games.rednblack.editor.view.ui.box.resourcespanel.UIImagesTab; import games.rednblack.editor.view.ui.box.resourcespanel.draggable.box.BoxItemResource; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import java.util.HashSet; import java.util.Set; @@ -25,7 +26,7 @@ import java.util.TreeSet; * * @author Jan-Thierry Wegener */ -public class BoxItemResourceSelectionUIMediator extends Mediator { +public class BoxItemResourceSelectionUIMediator extends Mediator { public static final String NAME = BoxItemResourceSelectionUIMediator.class.getCanonicalName(); @@ -39,7 +40,7 @@ public class BoxItemResourceSelectionUIMediator extends Mediator { } @Override - public void onRegister() { - facade = HyperLap2DFacade.getInstance(); - } - - @Override - public String[] listNotificationInterests() { - return new String[]{ - MsgAPI.UPDATE_ALL_FOLLOWERS, + public void listNotificationInterests(Interests interests) { + interests.add(MsgAPI.UPDATE_ALL_FOLLOWERS, MsgAPI.SCENE_LOADED, MsgAPI.ITEM_DATA_UPDATED, - MsgAPI.ITEM_SELECTION_CHANGED, - MsgAPI.SHOW_SELECTIONS, + MsgAPI.ITEM_SELECTION_CHANGED); + interests.add(MsgAPI.SHOW_SELECTIONS, MsgAPI.HIDE_SELECTIONS, MsgAPI.NEW_ITEM_ADDED, - PanTool.SCENE_PANNED, - MsgAPI.TOOL_SELECTED, + PanTool.SCENE_PANNED); + interests.add(MsgAPI.TOOL_SELECTED, MsgAPI.ITEM_PROPERTY_DATA_FINISHED_MODIFYING, CompositeCameraChangeCommand.DONE, - MsgAPI.ZOOM_CHANGED, - ConvertToCompositeCommand.DONE - }; + MsgAPI.ZOOM_CHANGED); + interests.add(ConvertToCompositeCommand.DONE); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/RulersUI.java b/src/main/java/games/rednblack/editor/view/ui/RulersUI.java index c616d821..a4b33245 100644 --- a/src/main/java/games/rednblack/editor/view/ui/RulersUI.java +++ b/src/main/java/games/rednblack/editor/view/ui/RulersUI.java @@ -12,10 +12,10 @@ import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Pools; import com.kotcrab.vis.ui.widget.VisLabel; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.utils.Guide; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.ui.widget.actors.basic.WhitePixel; +import games.rednblack.puremvc.Facade; import space.earlygrey.shapedrawer.ShapeDrawer; import java.util.HashMap; @@ -163,11 +163,11 @@ public class RulersUI extends Actor { } else { if (button == Input.Buttons.RIGHT) { editableDraggingGuide = draggingGuide; - HyperLap2DFacade.getInstance().sendNotification(RIGHT_CLICK_RULER); + Facade.getInstance().sendNotification(RIGHT_CLICK_RULER); } } - HyperLap2DFacade.getInstance().sendNotification(ACTION_GUIDES_MODIFIED); + Facade.getInstance().sendNotification(ACTION_GUIDES_MODIFIED); } draggingGuide = null; } @@ -479,7 +479,7 @@ public class RulersUI extends Actor { public static void updateGuideManually(float destination) { editableDraggingGuide.pos = destination; - HyperLap2DFacade.getInstance().sendNotification(ACTION_GUIDES_MODIFIED); + Facade.getInstance().sendNotification(ACTION_GUIDES_MODIFIED); } public Array getGuides() { diff --git a/src/main/java/games/rednblack/editor/view/ui/RulersUIMediator.java b/src/main/java/games/rednblack/editor/view/ui/RulersUIMediator.java index 0a180843..84bee281 100644 --- a/src/main/java/games/rednblack/editor/view/ui/RulersUIMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/RulersUIMediator.java @@ -1,13 +1,13 @@ package games.rednblack.editor.view.ui; import com.badlogic.gdx.utils.Array; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.data.SceneVO; import games.rednblack.editor.utils.Guide; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; /** * Created by azakhary on 7/18/2015. @@ -25,17 +25,14 @@ public class RulersUIMediator extends Mediator { @Override public void onRegister() { - facade = HyperLap2DFacade.getInstance(); viewComponent.setVisible(false); } @Override - public String[] listNotificationInterests() { - return new String[]{ - MsgAPI.SCENE_LOADED, + public void listNotificationInterests(Interests interests) { + interests.add(MsgAPI.SCENE_LOADED, RulersUI.ACTION_GUIDES_MODIFIED, - MsgAPI.LOCK_LINES_CHANGED - }; + MsgAPI.LOCK_LINES_CHANGED); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/StickyNotesUIMediator.java b/src/main/java/games/rednblack/editor/view/ui/StickyNotesUIMediator.java index 54bf78e2..8b79f485 100644 --- a/src/main/java/games/rednblack/editor/view/ui/StickyNotesUIMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/StickyNotesUIMediator.java @@ -1,6 +1,5 @@ package games.rednblack.editor.view.ui; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.CompositeCameraChangeCommand; import games.rednblack.editor.controller.commands.CreateStickyNoteCommand; import games.rednblack.editor.controller.commands.ModifyStickyNoteCommand; @@ -9,8 +8,9 @@ import games.rednblack.editor.renderer.data.SceneVO; import games.rednblack.editor.renderer.data.StickyNoteVO; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; public class StickyNotesUIMediator extends Mediator { private static final String TAG = StickyNotesUIMediator.class.getCanonicalName(); @@ -25,19 +25,16 @@ public class StickyNotesUIMediator extends Mediator { @Override public void onRegister() { - facade = HyperLap2DFacade.getInstance(); viewComponent.setVisible(false); } @Override - public String[] listNotificationInterests() { - return new String[]{ - MsgAPI.SCENE_LOADED, + public void listNotificationInterests(Interests interests) { + interests.add(MsgAPI.SCENE_LOADED, CompositeCameraChangeCommand.DONE, CreateStickyNoteCommand.DONE, - RemoveStickyNoteCommand.DONE, - ModifyStickyNoteCommand.DONE - }; + RemoveStickyNoteCommand.DONE); + interests.add(ModifyStickyNoteCommand.DONE); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/UIBottomMenuBar.java b/src/main/java/games/rednblack/editor/view/ui/UIBottomMenuBar.java index b5395d53..5eb5fd69 100644 --- a/src/main/java/games/rednblack/editor/view/ui/UIBottomMenuBar.java +++ b/src/main/java/games/rednblack/editor/view/ui/UIBottomMenuBar.java @@ -4,16 +4,16 @@ import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.kotcrab.vis.ui.VisUI; import com.kotcrab.vis.ui.widget.VisScrollPane; import com.kotcrab.vis.ui.widget.VisTable; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.ui.box.bottom.*; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; +import games.rednblack.puremvc.Facade; public class UIBottomMenuBar extends VisTable { - private final HyperLap2DFacade facade; + private final Facade facade; public UIBottomMenuBar() { Skin skin = VisUI.getSkin(); - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); setBackground(skin.getDrawable("sub-menu-bg")); diff --git a/src/main/java/games/rednblack/editor/view/ui/UIDropDownMenuMediator.java b/src/main/java/games/rednblack/editor/view/ui/UIDropDownMenuMediator.java index 9b0157f6..4590fd96 100644 --- a/src/main/java/games/rednblack/editor/view/ui/UIDropDownMenuMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/UIDropDownMenuMediator.java @@ -20,7 +20,6 @@ package games.rednblack.editor.view.ui; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.PluginManager; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.stage.UIStage; @@ -28,8 +27,9 @@ import games.rednblack.editor.view.stage.tools.PolygonTool; import games.rednblack.editor.view.stage.tools.TransformTool; import games.rednblack.editor.view.ui.box.UIResourcesBoxMediator; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import java.util.HashMap; @@ -126,28 +126,24 @@ public class UIDropDownMenuMediator extends Mediator { actionSets.put(ORIGIN_POINT_ACTION_SET, new Array<>()); actionSets.get(ORIGIN_POINT_ACTION_SET).add(MsgAPI.ACTION_CHANGE_ORIGIN_POSITION); actionSets.get(ORIGIN_POINT_ACTION_SET).add(MsgAPI.ACTION_CENTER_ORIGIN_POSITION); - - facade = HyperLap2DFacade.getInstance(); } @Override - public String[] listNotificationInterests() { - return new String[]{ - MsgAPI.SCENE_RIGHT_CLICK, + public void listNotificationInterests(Interests interests) { + interests.add(MsgAPI.SCENE_RIGHT_CLICK, MsgAPI.ITEM_RIGHT_CLICK, UIDropDownMenu.ITEM_CLICKED, - UIResourcesBoxMediator.IMAGE_RIGHT_CLICK, - UIResourcesBoxMediator.TINY_VG_RIGHT_CLICK, + UIResourcesBoxMediator.IMAGE_RIGHT_CLICK); + interests.add(UIResourcesBoxMediator.TINY_VG_RIGHT_CLICK, UIResourcesBoxMediator.SPINE_ANIMATION_RIGHT_CLICK, UIResourcesBoxMediator.SPRITE_ANIMATION_RIGHT_CLICK, - UIResourcesBoxMediator.LIBRARY_ITEM_RIGHT_CLICK, - UIResourcesBoxMediator.PARTICLE_EFFECT_RIGHT_CLICK, + UIResourcesBoxMediator.LIBRARY_ITEM_RIGHT_CLICK); + interests.add(UIResourcesBoxMediator.PARTICLE_EFFECT_RIGHT_CLICK, UIResourcesBoxMediator.TALOS_VFX_RIGHT_CLICK, UIResourcesBoxMediator.LIBRARY_ACTION_RIGHT_CLICK, - RulersUI.RIGHT_CLICK_RULER, - PolygonTool.MANUAL_VERTEX_POSITION, - TransformTool.MANUAL_ORIGIN_POSITION - }; + RulersUI.RIGHT_CLICK_RULER); + interests.add(PolygonTool.MANUAL_VERTEX_POSITION, + TransformTool.MANUAL_ORIGIN_POSITION); } private void applyItemTypeMutators(Array actionsSet) { diff --git a/src/main/java/games/rednblack/editor/view/ui/UIMainTable.java b/src/main/java/games/rednblack/editor/view/ui/UIMainTable.java index e4354aa6..e82b9480 100644 --- a/src/main/java/games/rednblack/editor/view/ui/UIMainTable.java +++ b/src/main/java/games/rednblack/editor/view/ui/UIMainTable.java @@ -19,20 +19,20 @@ package games.rednblack.editor.view.ui; import com.kotcrab.vis.ui.widget.VisTable; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.utils.HyperLap2DUtils; import games.rednblack.editor.view.menu.HyperLap2DMenuBar; import games.rednblack.editor.view.menu.HyperLap2DMenuBarMediator; import games.rednblack.editor.view.ui.box.*; import games.rednblack.editor.view.ui.widget.H2DLogo; +import games.rednblack.puremvc.Facade; import org.apache.commons.lang3.SystemUtils; public class UIMainTable extends VisTable { private final VisTable topTable, middleTable; - private final HyperLap2DFacade facade; + private final Facade facade; public UIMainTable() { - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); setFillParent(true); top(); diff --git a/src/main/java/games/rednblack/editor/view/ui/UISubmenuBar.java b/src/main/java/games/rednblack/editor/view/ui/UISubmenuBar.java index c007b6b5..9580a367 100644 --- a/src/main/java/games/rednblack/editor/view/ui/UISubmenuBar.java +++ b/src/main/java/games/rednblack/editor/view/ui/UISubmenuBar.java @@ -21,16 +21,16 @@ package games.rednblack.editor.view.ui; import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.kotcrab.vis.ui.VisUI; import com.kotcrab.vis.ui.widget.VisTable; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.ui.box.UICompositeHierarchy; import games.rednblack.editor.view.ui.box.UICompositeHierarchyMediator; +import games.rednblack.puremvc.Facade; public class UISubmenuBar extends VisTable { - private final HyperLap2DFacade facade; + private final Facade facade; public UISubmenuBar() { Skin skin = VisUI.getSkin(); - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); setBackground(skin.getDrawable("sub-menu-bg")); diff --git a/src/main/java/games/rednblack/editor/view/ui/UIWindowActionMediator.java b/src/main/java/games/rednblack/editor/view/ui/UIWindowActionMediator.java index 4bf14951..cf0b68dd 100644 --- a/src/main/java/games/rednblack/editor/view/ui/UIWindowActionMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/UIWindowActionMediator.java @@ -1,30 +1,21 @@ package games.rednblack.editor.view.ui; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; public class UIWindowActionMediator extends Mediator { private static final String TAG = UIWindowActionMediator.class.getCanonicalName(); public static final String NAME = TAG; - public UIWindowActionMediator() { super(NAME, new UIWindowAction()); } @Override - public void onRegister() { - super.onRegister(); - facade = HyperLap2DFacade.getInstance(); - } - - @Override - public String[] listNotificationInterests() { - return new String[]{ - MsgAPI.WINDOW_MAXIMIZED - }; + public void listNotificationInterests(Interests interests) { + interests.add(MsgAPI.WINDOW_MAXIMIZED); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/UIWindowTitleMediator.java b/src/main/java/games/rednblack/editor/view/ui/UIWindowTitleMediator.java index c4a91292..3292b4df 100644 --- a/src/main/java/games/rednblack/editor/view/ui/UIWindowTitleMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/UIWindowTitleMediator.java @@ -1,7 +1,7 @@ package games.rednblack.editor.view.ui; -import games.rednblack.editor.HyperLap2DFacade; -import org.puremvc.java.patterns.mediator.Mediator; + +import games.rednblack.puremvc.Mediator; public class UIWindowTitleMediator extends Mediator { @@ -12,10 +12,4 @@ public class UIWindowTitleMediator extends Mediator { public UIWindowTitleMediator() { super(NAME, new UIWindowTitle()); } - - @Override - public void onRegister() { - super.onRegister(); - facade = HyperLap2DFacade.getInstance(); - } } diff --git a/src/main/java/games/rednblack/editor/view/ui/box/PanelMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/PanelMediator.java index 4ac44ce9..77e6fd29 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/PanelMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/PanelMediator.java @@ -20,8 +20,9 @@ package games.rednblack.editor.view.ui.box; import com.badlogic.gdx.scenes.scene2d.Actor; import games.rednblack.editor.proxy.ProjectManager; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; /** * Created by azakhary on 6/17/2015. @@ -37,12 +38,9 @@ public class PanelMediator extends Mediator { super(mediatorName, viewComponent); } - @Override - public String[] listNotificationInterests() { - return new String[]{ - ProjectManager.PROJECT_OPENED - }; + public void listNotificationInterests(Interests interests) { + interests.add(ProjectManager.PROJECT_OPENED); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/box/UIAlignBox.java b/src/main/java/games/rednblack/editor/view/ui/box/UIAlignBox.java index ec1e3116..4846b0a3 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/UIAlignBox.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/UIAlignBox.java @@ -22,8 +22,8 @@ import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.kotcrab.vis.ui.widget.VisImageButton; import com.kotcrab.vis.ui.widget.VisTable; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; +import games.rednblack.puremvc.Facade; /** * Created by sargis on 4/10/15. @@ -59,12 +59,12 @@ public class UIAlignBox extends UICollapsibleBox { public static final String ALIGN_AT_EDGE_RIGHT_BTN_CLICKED = prefix + ALIGN_AT_EDGE_RIGHT; // - private final HyperLap2DFacade faced; + private final Facade faced; public UIAlignBox() { super("Align", 166); setMovable(false); - faced = HyperLap2DFacade.getInstance(); + faced = Facade.getInstance(); VisTable alignButtonsTable = new VisTable(); // alignButtonsTable.row().padTop(6); @@ -140,7 +140,7 @@ public class UIAlignBox extends UICollapsibleBox { notification = ALIGN_AT_EDGE_RIGHT_BTN_CLICKED; break; } - HyperLap2DFacade facade = HyperLap2DFacade.getInstance(); + Facade facade = Facade.getInstance(); facade.sendNotification(notification); } } diff --git a/src/main/java/games/rednblack/editor/view/ui/box/UIAlignBoxMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/UIAlignBoxMediator.java index 047d8506..e60a19cb 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/UIAlignBoxMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/UIAlignBoxMediator.java @@ -21,7 +21,8 @@ package games.rednblack.editor.view.ui.box; import com.badlogic.gdx.utils.Align; import games.rednblack.editor.view.stage.ItemSelector; import games.rednblack.editor.view.stage.Sandbox; -import org.puremvc.java.interfaces.INotification; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -39,20 +40,18 @@ public class UIAlignBoxMediator extends PanelMediator { } @Override - public String[] listNotificationInterests() { - String[] parentNotifications = super.listNotificationInterests(); - return Stream.of(parentNotifications, new String[]{ - UIAlignBox.ALIGN_TOP_BTN_CLICKED, + public void listNotificationInterests(Interests interests) { + super.listNotificationInterests(interests); + interests.add(UIAlignBox.ALIGN_TOP_BTN_CLICKED, UIAlignBox.ALIGN_LEFT_BTN_CLICKED, UIAlignBox.ALIGN_BOTTOM_BTN_CLICKED, - UIAlignBox.ALIGN_RIGHT_BTN_CLICKED, - UIAlignBox.ALIGN_CENTER_LEFT_BTN_CLICKED, + UIAlignBox.ALIGN_RIGHT_BTN_CLICKED); + interests.add(UIAlignBox.ALIGN_CENTER_LEFT_BTN_CLICKED, UIAlignBox.ALIGN_CENTER_BOTTOM_BTN_CLICKED, UIAlignBox.ALIGN_AT_EDGE_TOP_BTN_CLICKED, - UIAlignBox.ALIGN_AT_EDGE_LEFT_BTN_CLICKED, - UIAlignBox.ALIGN_AT_EDGE_BOTTOM_BTN_CLICKED, - UIAlignBox.ALIGN_AT_EDGE_RIGHT_BTN_CLICKED - }).flatMap(Stream::of).toArray(String[]::new); + UIAlignBox.ALIGN_AT_EDGE_LEFT_BTN_CLICKED); + interests.add(UIAlignBox.ALIGN_AT_EDGE_BOTTOM_BTN_CLICKED, + UIAlignBox.ALIGN_AT_EDGE_RIGHT_BTN_CLICKED); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/box/UIBaseBox.java b/src/main/java/games/rednblack/editor/view/ui/box/UIBaseBox.java index 8617372e..06f72399 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/UIBaseBox.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/UIBaseBox.java @@ -1,15 +1,15 @@ package games.rednblack.editor.view.ui.box; import com.kotcrab.vis.ui.widget.VisTable; -import games.rednblack.editor.HyperLap2DFacade; +import games.rednblack.puremvc.Facade; public abstract class UIBaseBox extends VisTable { - protected final HyperLap2DFacade facade; + protected final Facade facade; public UIBaseBox() { super(); - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); } public abstract void update(); diff --git a/src/main/java/games/rednblack/editor/view/ui/box/UICompositeHierarchyMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/UICompositeHierarchyMediator.java index d6a06972..8cb85679 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/UICompositeHierarchyMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/UICompositeHierarchyMediator.java @@ -1,15 +1,16 @@ package games.rednblack.editor.view.ui.box; import com.badlogic.gdx.utils.Array; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.CompositeCameraChangeCommand; import games.rednblack.editor.renderer.components.ParentNodeComponent; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; /** * Created by CyberJoe on 4/22/2015. @@ -25,12 +26,10 @@ public class UICompositeHierarchyMediator extends Mediator } @Override - public String[] listNotificationInterests() { - return new String[]{ - MsgAPI.SCENE_LOADED, + public void listNotificationInterests(Interests interests) { + interests.add(MsgAPI.SCENE_LOADED, CompositeCameraChangeCommand.DONE, - UICompositeHierarchy.SWITCH_VIEW_COMPOSITE_CLICKED - }; + UICompositeHierarchy.SWITCH_VIEW_COMPOSITE_CLICKED); } @Override @@ -49,7 +48,7 @@ public class UICompositeHierarchyMediator extends Mediator break; case UICompositeHierarchy.SWITCH_VIEW_COMPOSITE_CLICKED: entityId = notification.getBody(); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_CAMERA_CHANGE_COMPOSITE, EntityUtils.getByUniqueId(entityId)); + Facade.getInstance().sendNotification(MsgAPI.ACTION_CAMERA_CHANGE_COMPOSITE, EntityUtils.getByUniqueId(entityId)); break; default: break; diff --git a/src/main/java/games/rednblack/editor/view/ui/box/UIItemsTreeBox.java b/src/main/java/games/rednblack/editor/view/ui/box/UIItemsTreeBox.java index e58ed500..5208b223 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/UIItemsTreeBox.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/UIItemsTreeBox.java @@ -30,7 +30,6 @@ import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Pools; import com.kotcrab.vis.ui.VisUI; import com.kotcrab.vis.ui.widget.*; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.components.MainItemComponent; import games.rednblack.editor.renderer.components.NodeComponent; import games.rednblack.editor.renderer.components.ParentNodeComponent; @@ -40,6 +39,7 @@ import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; +import games.rednblack.puremvc.Facade; import java.util.Comparator; import java.util.Set; @@ -51,7 +51,7 @@ public class UIItemsTreeBox extends UICollapsibleBox { protected ComponentMapper zIndexComponentMapper; public static final String ITEMS_SELECTED = "games.rednblack.editor.view.ui.box.UIItemsTreeBox." + ".ITEMS_SELECTED"; - private final HyperLap2DFacade facade; + private final Facade facade; private final VisTable treeTable; private Tree tree; private VisScrollPane scroller; @@ -71,7 +71,7 @@ public class UIItemsTreeBox extends UICollapsibleBox { public UIItemsTreeBox() { super("Items Tree", 180); setMovable(false); - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); treeTable = new VisTable(); treeTable.left(); zUp = StandardWidgetsFactory.createImageButton("arrow-button"); @@ -271,7 +271,7 @@ public class UIItemsTreeBox extends UICollapsibleBox { UIItemsTreeValue selected = selection.first().getValue(); int item = EntityUtils.getByUniqueId(selected.entityId); if (EntityUtils.getType(item) == EntityFactory.COMPOSITE_TYPE) { - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_CAMERA_CHANGE_COMPOSITE, item); + Facade.getInstance().sendNotification(MsgAPI.ACTION_CAMERA_CHANGE_COMPOSITE, item); } } } diff --git a/src/main/java/games/rednblack/editor/view/ui/box/UIItemsTreeBoxMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/UIItemsTreeBoxMediator.java index ca722be6..42a9695f 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/UIItemsTreeBoxMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/UIItemsTreeBoxMediator.java @@ -2,7 +2,6 @@ package games.rednblack.editor.view.ui.box; import com.badlogic.gdx.scenes.scene2d.utils.Selection; import com.badlogic.gdx.utils.Array; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.AddSelectionCommand; import games.rednblack.editor.controller.commands.ItemsMoveCommand; import games.rednblack.editor.controller.commands.ReleaseSelectionCommand; @@ -12,7 +11,9 @@ import games.rednblack.editor.renderer.data.LayerItemVO; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import java.util.HashSet; import java.util.Set; @@ -30,21 +31,19 @@ public class UIItemsTreeBoxMediator extends PanelMediator { } @Override - public String[] listNotificationInterests() { - String[] parentNotifications = super.listNotificationInterests(); - return Stream.of(parentNotifications, new String[]{ - MsgAPI.SCENE_LOADED, + public void listNotificationInterests(Interests interests) { + super.listNotificationInterests(interests); + interests.add(MsgAPI.SCENE_LOADED, MsgAPI.NEW_ITEM_ADDED, UIItemsTreeBox.ITEMS_SELECTED, - SetSelectionCommand.DONE, - AddSelectionCommand.DONE, + SetSelectionCommand.DONE); + interests.add(AddSelectionCommand.DONE, ReleaseSelectionCommand.DONE, DeleteResourceCommand.DONE, - MsgAPI.DELETE_ITEMS_COMMAND_DONE, - MsgAPI.ACTION_Z_INDEX_CHANGED, + MsgAPI.DELETE_ITEMS_COMMAND_DONE); + interests.add(MsgAPI.ACTION_Z_INDEX_CHANGED, MsgAPI.ACTION_CAMERA_CHANGE_COMPOSITE, - MsgAPI.ITEM_DATA_UPDATED - }).flatMap(Stream::of).toArray(String[]::new); + MsgAPI.ITEM_DATA_UPDATED); } @Override @@ -100,6 +99,6 @@ public class UIItemsTreeBoxMediator extends PanelMediator { private void sendSelectionNotification(Set items) { Set ntfItems = (items.isEmpty())? null : items; - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_SET_SELECTION, ntfItems); + Facade.getInstance().sendNotification(MsgAPI.ACTION_SET_SELECTION, ntfItems); } } \ No newline at end of file diff --git a/src/main/java/games/rednblack/editor/view/ui/box/UILayerBox.java b/src/main/java/games/rednblack/editor/view/ui/box/UILayerBox.java index 2b5bb0aa..9840f25e 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/UILayerBox.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/UILayerBox.java @@ -32,11 +32,11 @@ 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.editor.event.KeyboardListener; import games.rednblack.editor.renderer.data.LayerItemVO; import games.rednblack.editor.utils.InputFilters; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; +import games.rednblack.puremvc.Facade; /** * Created by azakhary on 4/17/2015. @@ -57,7 +57,7 @@ public class UILayerBox extends UICollapsibleBox { private final DragAndDrop dragAndDrop; public int currentSelectedLayerIndex = 0; - private HyperLap2DFacade facade; + private Facade facade; private VisTable contentTable; private VisTable bottomPane; private VisScrollPane scrollPane; @@ -70,7 +70,7 @@ public class UILayerBox extends UICollapsibleBox { public UILayerBox() { super("Layers"); - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); setMovable(false); contentTable = new VisTable(); @@ -250,7 +250,7 @@ public class UILayerBox extends UICollapsibleBox { // Send notification with the two layers to swap. // TODO - change from swap to repositioning source above target. String[] notificationPayload = {sourceLayer, targetLayer}; - HyperLap2DFacade.getInstance().sendNotification(LAYER_DROPPED, notificationPayload); + Facade.getInstance().sendNotification(LAYER_DROPPED, notificationPayload); } } } diff --git a/src/main/java/games/rednblack/editor/view/ui/box/UILayerBoxMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/UILayerBoxMediator.java index 3f1244b9..85efb6e8 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/UILayerBoxMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/UILayerBoxMediator.java @@ -21,7 +21,6 @@ package games.rednblack.editor.view.ui.box; import com.badlogic.gdx.utils.Array; import com.kotcrab.vis.ui.util.dialog.Dialogs; import com.kotcrab.vis.ui.util.dialog.InputDialogListener; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.*; import games.rednblack.editor.renderer.components.LayerMapComponent; import games.rednblack.editor.renderer.components.NodeComponent; @@ -31,9 +30,10 @@ import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; -import java.util.ArrayList; import java.util.HashSet; import java.util.Set; import java.util.stream.Stream; @@ -51,34 +51,29 @@ public class UILayerBoxMediator extends PanelMediator { public UILayerBoxMediator() { super(NAME, new UILayerBox()); - facade = HyperLap2DFacade.getInstance(); } @Override - public String[] listNotificationInterests() { - String[] parentNotifications = super.listNotificationInterests(); - return Stream.of(parentNotifications, new String[]{ - MsgAPI.SCENE_LOADED, + public void listNotificationInterests(Interests interests) { + super.listNotificationInterests(interests); + interests.add(MsgAPI.SCENE_LOADED, UILayerBox.LAYER_ROW_CLICKED, UILayerBox.CREATE_NEW_LAYER, - UILayerBox.CHANGE_LAYER_NAME, - UILayerBox.DELETE_LAYER, + UILayerBox.CHANGE_LAYER_NAME); + interests.add(UILayerBox.DELETE_LAYER, UILayerBox.LOCK_LAYER, UILayerBox.UNLOCK_LAYER, - UILayerBox.HIDE_LAYER, - UILayerBox.UNHIDE_LAYER, + UILayerBox.HIDE_LAYER); + interests.add(UILayerBox.UNHIDE_LAYER, CompositeCameraChangeCommand.DONE, MsgAPI.ITEM_SELECTION_CHANGED, - MsgAPI.NEW_ITEM_ADDED, - UILayerBox.LAYER_DROPPED, + MsgAPI.NEW_ITEM_ADDED); + interests.add(UILayerBox.LAYER_DROPPED, DeleteLayerCommand.DONE, DeleteLayerCommand.UNDONE, - NewLayerCommand.DONE, - LayerJumpCommand.DONE, - RenameLayerCommand.DONE - - - }).flatMap(Stream::of).toArray(String[]::new); + NewLayerCommand.DONE); + interests.add(LayerJumpCommand.DONE, + RenameLayerCommand.DONE); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/box/UIMultiPropertyBoxMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/UIMultiPropertyBoxMediator.java index 2ffb6254..6ab2be8b 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/UIMultiPropertyBoxMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/UIMultiPropertyBoxMediator.java @@ -20,7 +20,6 @@ package games.rednblack.editor.view.ui.box; import com.badlogic.gdx.utils.reflect.ClassReflection; import com.badlogic.gdx.utils.reflect.ReflectionException; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.AddComponentToItemCommand; import games.rednblack.editor.controller.commands.RemoveComponentFromItemCommand; import games.rednblack.editor.renderer.components.shape.CircleShapeComponent; @@ -43,8 +42,10 @@ import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.extension.spine.SpineItemType; import games.rednblack.h2d.extension.talos.TalosItemType; import games.rednblack.h2d.extension.typinglabel.TypingLabelComponent; -import org.puremvc.java.interfaces.IMediator; -import org.puremvc.java.interfaces.INotification; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.interfaces.IMediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import java.util.ArrayList; import java.util.HashMap; @@ -65,7 +66,6 @@ public class UIMultiPropertyBoxMediator extends PanelMediator { @Override public void onRegister() { super.onRegister(); - facade = HyperLap2DFacade.getInstance(); registerTabMediators(); initTabs(); } @@ -79,14 +78,12 @@ public class UIResourcesBoxMediator extends PanelMediator { } @Override - public String[] listNotificationInterests() { - String[] parentNotifications = super.listNotificationInterests(); - return Stream.of(parentNotifications, new String[]{ - ProjectManager.PROJECT_OPENED, + public void listNotificationInterests(Interests interests) { + super.listNotificationInterests(interests); + interests.add(ProjectManager.PROJECT_OPENED, ProjectManager.PROJECT_DATA_UPDATED, MsgAPI.ADD_TARGET, - MsgAPI.REMOVE_TARGET - }).flatMap(Stream::of).toArray(String[]::new); + MsgAPI.REMOVE_TARGET); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/box/UIToolBox.java b/src/main/java/games/rednblack/editor/view/ui/box/UIToolBox.java index 9db36023..f9f6452b 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/UIToolBox.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/UIToolBox.java @@ -23,10 +23,10 @@ import com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.kotcrab.vis.ui.widget.VisImageButton; import com.kotcrab.vis.ui.widget.VisTable; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.view.tools.Tool; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; +import games.rednblack.puremvc.Facade; import java.util.HashMap; @@ -83,7 +83,7 @@ public class UIToolBox extends VisTable { @Override public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); - HyperLap2DFacade facade = HyperLap2DFacade.getInstance(); + Facade facade = Facade.getInstance(); facade.sendNotification(MsgAPI.TOOL_CLICKED, toolId); } } diff --git a/src/main/java/games/rednblack/editor/view/ui/box/UIToolBoxMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/UIToolBoxMediator.java index 801773ca..71bd8d43 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/UIToolBoxMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/UIToolBoxMediator.java @@ -20,13 +20,13 @@ package games.rednblack.editor.view.ui.box; import com.kotcrab.vis.ui.widget.Separator; import com.kotcrab.vis.ui.widget.VisImageButton; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.stage.SandboxMediator; import games.rednblack.editor.view.stage.tools.*; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.view.tools.Tool; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import java.util.HashMap; @@ -43,8 +43,6 @@ public class UIToolBoxMediator extends Mediator { @Override public void onRegister() { - facade = HyperLap2DFacade.getInstance(); - toolList = new HashMap<>(); initToolList(); currentTool = SelectionTool.NAME; @@ -80,11 +78,9 @@ public class UIToolBoxMediator extends Mediator { } @Override - public String[] listNotificationInterests() { - return new String[]{ - MsgAPI.TOOL_CLICKED, - SandboxMediator.SANDBOX_TOOL_CHANGED - }; + public void listNotificationInterests(Interests interests) { + interests.add(MsgAPI.TOOL_CLICKED, + SandboxMediator.SANDBOX_TOOL_CHANGED); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/box/bottom/UIGridBoxMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/bottom/UIGridBoxMediator.java index ef2aef5a..83054900 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/bottom/UIGridBoxMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/bottom/UIGridBoxMediator.java @@ -21,8 +21,9 @@ package games.rednblack.editor.view.ui.box.bottom; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; /** * Created by azakhary on 4/15/2015. @@ -36,14 +37,12 @@ public class UIGridBoxMediator extends Mediator { } @Override - public String[] listNotificationInterests() { - return new String[]{ - ProjectManager.PROJECT_OPENED, + public void listNotificationInterests(Interests interests) { + interests.add(ProjectManager.PROJECT_OPENED, MsgAPI.GRID_SIZE_CHANGED, MsgAPI.LOCK_LINES_CHANGED, - UIGridBox.GRID_SIZE_TEXT_FIELD_UPDATED, - UIGridBox.LOCK_LINES_CHECKBOX_FIELD_UPDATED - }; + UIGridBox.GRID_SIZE_TEXT_FIELD_UPDATED); + interests.add(UIGridBox.LOCK_LINES_CHECKBOX_FIELD_UPDATED); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/box/bottom/UILivePreviewBoxMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/bottom/UILivePreviewBoxMediator.java index a346d415..152aa25f 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/bottom/UILivePreviewBoxMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/bottom/UILivePreviewBoxMediator.java @@ -5,13 +5,13 @@ import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationGLESFix; import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration; import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window; import com.badlogic.gdx.backends.lwjgl3.Lwjgl3WindowListener; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.live.LiveScreenAdapter; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.proxy.ResolutionManager; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; public class UILivePreviewBoxMediator extends Mediator { private static final String TAG = UILivePreviewBoxMediator.class.getCanonicalName(); @@ -21,18 +21,15 @@ public class UILivePreviewBoxMediator extends Mediator { public UILivePreviewBoxMediator() { super(NAME, new UILivePreviewBox()); - facade = HyperLap2DFacade.getInstance(); resolutionManager = facade.retrieveProxy(ResolutionManager.NAME); } @Override - public String[] listNotificationInterests() { - return new String[]{ - ProjectManager.PROJECT_OPENED, + public void listNotificationInterests(Interests interests) { + interests.add(ProjectManager.PROJECT_OPENED, MsgAPI.SCENE_LOADED, - UILivePreviewBox.LIVE_PREVIEW_CLICKED - }; + UILivePreviewBox.LIVE_PREVIEW_CLICKED); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/box/bottom/UIResolutionBox.java b/src/main/java/games/rednblack/editor/view/ui/box/bottom/UIResolutionBox.java index fd814152..3ed9df53 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/bottom/UIResolutionBox.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/bottom/UIResolutionBox.java @@ -27,11 +27,11 @@ import com.badlogic.gdx.utils.Array; import com.kotcrab.vis.ui.VisUI; import com.kotcrab.vis.ui.widget.VisImageButton; import com.kotcrab.vis.ui.widget.VisSelectBox; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ResolutionManager; import games.rednblack.editor.renderer.data.ResolutionEntryVO; import games.rednblack.editor.view.ui.box.UIBaseBox; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; +import games.rednblack.puremvc.Facade; public class UIResolutionBox extends UIBaseBox { private static final String prefix = "games.rednblack.editor.view.ui.box.bottom.UIResolutionBox"; @@ -116,7 +116,7 @@ public class UIResolutionBox extends UIBaseBox { public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); - HyperLap2DFacade facade = HyperLap2DFacade.getInstance(); + Facade facade = Facade.getInstance(); switch (btnClicked) { case DELETE_RESOLUTION_BTN_CLICKED: if (!deleteBtn.isDisabled()) @@ -137,7 +137,7 @@ public class UIResolutionBox extends UIBaseBox { return; } - HyperLap2DFacade facade = HyperLap2DFacade.getInstance(); + Facade facade = Facade.getInstance(); if (selectedIndex == 0) { facade.sendNotification(CREATE_NEW_RESOLUTION_BTN_CLICKED); return; diff --git a/src/main/java/games/rednblack/editor/view/ui/box/bottom/UIResolutionBoxMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/bottom/UIResolutionBoxMediator.java index 7ef3ef67..2e9286a6 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/bottom/UIResolutionBoxMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/bottom/UIResolutionBoxMediator.java @@ -20,15 +20,15 @@ package games.rednblack.editor.view.ui.box.bottom; import com.badlogic.gdx.math.Vector3; import com.kotcrab.vis.ui.util.dialog.Dialogs; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.proxy.ResolutionManager; import games.rednblack.editor.renderer.data.ResolutionEntryVO; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.ui.dialog.CreateNewResolutionDialog; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; /** * Created by sargis on 4/8/15. @@ -45,20 +45,17 @@ public class UIResolutionBoxMediator extends Mediator { @Override public void onRegister() { super.onRegister(); - facade = HyperLap2DFacade.getInstance(); projectManager = facade.retrieveProxy(ProjectManager.NAME); } @Override - public String[] listNotificationInterests() { - return new String[]{ - ProjectManager.PROJECT_OPENED, + public void listNotificationInterests(Interests interests) { + interests.add(ProjectManager.PROJECT_OPENED, UIResolutionBox.CHANGE_RESOLUTION_BTN_CLICKED, UIResolutionBox.DELETE_RESOLUTION_BTN_CLICKED, - MsgAPI.ACTION_REPACK, - ResolutionManager.RESOLUTION_LIST_CHANGED, - CreateNewResolutionDialog.CLOSE_DIALOG - }; + MsgAPI.ACTION_REPACK); + interests.add(ResolutionManager.RESOLUTION_LIST_CHANGED, + CreateNewResolutionDialog.CLOSE_DIALOG); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/box/bottom/UISceneBox.java b/src/main/java/games/rednblack/editor/view/ui/box/bottom/UISceneBox.java index 43313bb0..18aa9454 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/bottom/UISceneBox.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/bottom/UISceneBox.java @@ -8,12 +8,12 @@ import com.badlogic.gdx.utils.Array; import com.kotcrab.vis.ui.VisUI; import com.kotcrab.vis.ui.widget.VisImageButton; import com.kotcrab.vis.ui.widget.VisSelectBox; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.renderer.data.SceneVO; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.ui.box.UIBaseBox; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; +import games.rednblack.puremvc.Facade; public class UISceneBox extends UIBaseBox { private static final String prefix = "games.rednblack.editor.view.ui.box.bottom.UISceneBox"; @@ -77,7 +77,7 @@ public class UISceneBox extends UIBaseBox { return; } - HyperLap2DFacade facade = HyperLap2DFacade.getInstance(); + Facade facade = Facade.getInstance(); if (selectedIndex == 0) { facade.sendNotification(CREATE_NEW_SCENE_BTN_CLICKED); return; diff --git a/src/main/java/games/rednblack/editor/view/ui/box/bottom/UISceneBoxMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/bottom/UISceneBoxMediator.java index a7d03894..a30b2f0f 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/bottom/UISceneBoxMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/bottom/UISceneBoxMediator.java @@ -2,14 +2,14 @@ package games.rednblack.editor.view.ui.box.bottom; import com.kotcrab.vis.ui.util.dialog.Dialogs; import com.kotcrab.vis.ui.util.dialog.InputDialogListener; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.proxy.SceneDataManager; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.ui.validator.StringNameValidator; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; public class UISceneBoxMediator extends Mediator { private static final String TAG = UISceneBoxMediator.class.getCanonicalName(); @@ -17,18 +17,15 @@ public class UISceneBoxMediator extends Mediator { public UISceneBoxMediator() { super(NAME, new UISceneBox()); - facade = HyperLap2DFacade.getInstance(); } @Override - public String[] listNotificationInterests() { - return new String[]{ - ProjectManager.PROJECT_OPENED, + public void listNotificationInterests(Interests interests) { + interests.add(ProjectManager.PROJECT_OPENED, MsgAPI.SCENE_LOADED, UISceneBox.CHANGE_SCENE_BTN_CLICKED, - UISceneBox.CREATE_NEW_SCENE_BTN_CLICKED, - UISceneBox.DELETE_CURRENT_SCENE_BTN_CLICKED - }; + UISceneBox.CREATE_NEW_SCENE_BTN_CLICKED); + interests.add(UISceneBox.DELETE_CURRENT_SCENE_BTN_CLICKED); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/box/bottom/UIZoomBox.java b/src/main/java/games/rednblack/editor/view/ui/box/bottom/UIZoomBox.java index 6c2c4e64..23c83c91 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/bottom/UIZoomBox.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/bottom/UIZoomBox.java @@ -25,10 +25,10 @@ import com.badlogic.gdx.utils.Align; import com.kotcrab.vis.ui.VisUI; import com.kotcrab.vis.ui.widget.VisImageButton; import com.kotcrab.vis.ui.widget.VisTextField; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.event.KeyboardListener; import games.rednblack.editor.view.ui.box.UIBaseBox; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; +import games.rednblack.puremvc.Facade; /** * Created by sargis on 4/27/15. @@ -110,7 +110,7 @@ public class UIZoomBox extends UIBaseBox { @Override public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); - HyperLap2DFacade facade = HyperLap2DFacade.getInstance(); + Facade facade = Facade.getInstance(); facade.sendNotification(ZOOM_SHIFT_REQUESTED, zoomDevider); } } diff --git a/src/main/java/games/rednblack/editor/view/ui/box/bottom/UIZoomBoxMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/bottom/UIZoomBoxMediator.java index 54510e3c..244974a1 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/bottom/UIZoomBoxMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/bottom/UIZoomBoxMediator.java @@ -18,13 +18,13 @@ package games.rednblack.editor.view.ui.box.bottom; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import org.apache.commons.lang3.math.NumberUtils; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; /** * Created by sargis on 4/9/15. @@ -40,19 +40,11 @@ public class UIZoomBoxMediator extends Mediator { } @Override - public void onRegister() { - facade = HyperLap2DFacade.getInstance(); - } - - - @Override - public String[] listNotificationInterests() { - return new String[]{ - ProjectManager.PROJECT_OPENED, + public void listNotificationInterests(Interests interests) { + interests.add(ProjectManager.PROJECT_OPENED, UIZoomBox.ZOOM_SHIFT_REQUESTED, UIZoomBox.ZOOM_VALUE_CHANGED, - MsgAPI.ZOOM_CHANGED - }; + MsgAPI.ZOOM_CHANGED); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIActionsTab.java b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIActionsTab.java index 6cab3dbc..33a0d6f2 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIActionsTab.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIActionsTab.java @@ -9,12 +9,12 @@ import com.kotcrab.vis.ui.util.dialog.InputDialogListener; import com.kotcrab.vis.ui.widget.VisImageButton; import com.kotcrab.vis.ui.widget.VisScrollPane; import com.kotcrab.vis.ui.widget.VisTable; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.ui.box.resourcespanel.draggable.DraggableResource; import games.rednblack.editor.view.ui.validator.StringNameValidator; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; +import games.rednblack.puremvc.Facade; public class UIActionsTab extends UIResourcesTab { @@ -41,7 +41,7 @@ public class UIActionsTab extends UIResourcesTab { if (input == null || input.equals("")) { return; } - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.OPEN_NODE_EDITOR, input); + Facade.getInstance().sendNotification(MsgAPI.OPEN_NODE_EDITOR, input); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIActionsTabMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIActionsTabMediator.java index a2817feb..b128a811 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIActionsTabMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIActionsTabMediator.java @@ -1,15 +1,16 @@ package games.rednblack.editor.view.ui.box.resourcespanel; import com.badlogic.gdx.utils.Array; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.resource.DeleteLibraryAction; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.renderer.data.GraphVO; import games.rednblack.editor.view.ui.box.resourcespanel.draggable.DraggableResource; import games.rednblack.editor.view.ui.box.resourcespanel.draggable.list.LibraryActionResource; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import org.apache.commons.lang3.ArrayUtils; -import org.puremvc.java.interfaces.INotification; import java.util.HashMap; @@ -25,13 +26,9 @@ public class UIActionsTabMediator extends UIResourcesTabMediator { } @Override - public String[] listNotificationInterests() { - String[] listNotification = super.listNotificationInterests(); - - listNotification = ArrayUtils.add(listNotification, MsgAPI.LIBRARY_ACTIONS_UPDATED); - listNotification = ArrayUtils.add(listNotification, DeleteLibraryAction.DONE); - - return listNotification; + public void listNotificationInterests(Interests interests) { + super.listNotificationInterests(interests); + interests.add(MsgAPI.LIBRARY_ACTIONS_UPDATED, DeleteLibraryAction.DONE); } @Override @@ -50,7 +47,7 @@ public class UIActionsTabMediator extends UIResourcesTabMediator { @Override protected void initList(String searchText) { searchText = searchText.toLowerCase(); - ProjectManager projectManager = HyperLap2DFacade.getInstance().retrieveProxy(ProjectManager.NAME); + ProjectManager projectManager = Facade.getInstance().retrieveProxy(ProjectManager.NAME); HashMap items = projectManager.currentProjectInfoVO.libraryActions; itemArray.clear(); diff --git a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIAnimationsTab.java b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIAnimationsTab.java index 6c2c8eda..26496bce 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIAnimationsTab.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIAnimationsTab.java @@ -22,10 +22,10 @@ import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.utils.Array; import com.kotcrab.vis.ui.widget.VisScrollPane; import com.kotcrab.vis.ui.widget.VisTable; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.ui.box.UIResourcesBoxMediator; import games.rednblack.editor.view.ui.box.resourcespanel.draggable.DraggableResource; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; +import games.rednblack.puremvc.Facade; /** * Created by azakhary on 4/17/2015. @@ -57,7 +57,7 @@ public class UIAnimationsTab extends UIResourcesTab { @Override protected VisScrollPane crateScrollPane() { animationsTable = new VisTable(); - HyperLap2DFacade.getInstance().sendNotification(UIResourcesBoxMediator.ADD_RESOURCES_BOX_TABLE_SELECTION_MANAGEMENT, animationsTable); + Facade.getInstance().sendNotification(UIResourcesBoxMediator.ADD_RESOURCES_BOX_TABLE_SELECTION_MANAGEMENT, animationsTable); VisScrollPane scrollPane = StandardWidgetsFactory.createScrollPane(animationsTable); scrollPane.setScrollingDisabled(true, false); return scrollPane; diff --git a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIAnimationsTabMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIAnimationsTabMediator.java index 96ef9660..76ac24bb 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIAnimationsTabMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIAnimationsTabMediator.java @@ -30,8 +30,9 @@ import games.rednblack.editor.view.ui.box.resourcespanel.draggable.box.BoxItemRe import games.rednblack.editor.view.ui.box.resourcespanel.draggable.box.SpineResource; import games.rednblack.editor.view.ui.box.resourcespanel.draggable.box.SpriteResource; import games.rednblack.h2d.extension.spine.SpineItemType; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import org.apache.commons.lang3.ArrayUtils; -import org.puremvc.java.interfaces.INotification; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; @@ -53,11 +54,9 @@ public class UIAnimationsTabMediator extends UIResourcesTabMediator { @@ -16,11 +17,9 @@ public class UIFilterMenuMediator extends Mediator { } @Override - public String[] listNotificationInterests() { - return new String[]{ - UIFilterMenu.SHOW_FILTER_MENU, - MsgAPI.ADD_RESOURCES_BOX_FILTER - }; + public void listNotificationInterests(Interests interests) { + interests.add(UIFilterMenu.SHOW_FILTER_MENU, + MsgAPI.ADD_RESOURCES_BOX_FILTER); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIImagesTab.java b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIImagesTab.java index 5aecc60f..922d8351 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIImagesTab.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIImagesTab.java @@ -22,10 +22,10 @@ import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.utils.Array; import com.kotcrab.vis.ui.widget.VisScrollPane; import com.kotcrab.vis.ui.widget.VisTable; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.ui.box.UIResourcesBoxMediator; import games.rednblack.editor.view.ui.box.resourcespanel.draggable.DraggableResource; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; +import games.rednblack.puremvc.Facade; /** * Created by azakhary on 4/17/2015. @@ -41,7 +41,7 @@ public class UIImagesTab extends UIResourcesTab { @Override protected VisScrollPane crateScrollPane() { imagesTable = new VisTable(); - HyperLap2DFacade.getInstance().sendNotification(UIResourcesBoxMediator.ADD_RESOURCES_BOX_TABLE_SELECTION_MANAGEMENT, imagesTable); + Facade.getInstance().sendNotification(UIResourcesBoxMediator.ADD_RESOURCES_BOX_TABLE_SELECTION_MANAGEMENT, imagesTable); return StandardWidgetsFactory.createScrollPane(imagesTable); } diff --git a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIImagesTabMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIImagesTabMediator.java index bf520815..295b40ae 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIImagesTabMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIImagesTabMediator.java @@ -34,8 +34,8 @@ import games.rednblack.editor.view.ui.box.resourcespanel.draggable.box.ImageReso import games.rednblack.editor.view.ui.box.resourcespanel.draggable.box.TinyVGResource; import games.rednblack.editor.view.ui.widget.actors.basic.WhitePixel; import games.rednblack.h2d.extension.tinyvg.CpuTinyVGShapeDrawer; -import org.apache.commons.lang3.ArrayUtils; -import org.puremvc.java.interfaces.INotification; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; /** * Created by azakhary on 4/17/2015. @@ -54,13 +54,9 @@ public class UIImagesTabMediator extends UIResourcesTabMediator { private TinyVGShapeDrawer drawer; @Override - public String[] listNotificationInterests() { - String[] listNotification = super.listNotificationInterests(); - - listNotification = ArrayUtils.add(listNotification, DeleteImageResource.DONE); - listNotification = ArrayUtils.add(listNotification, DeleteTinyVGResource.DONE); - - return listNotification; + public void listNotificationInterests(Interests interests) { + super.listNotificationInterests(interests); + interests.add( DeleteImageResource.DONE, DeleteTinyVGResource.DONE); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UILibraryItemsTabMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UILibraryItemsTabMediator.java index e006fa98..63d7109d 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UILibraryItemsTabMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UILibraryItemsTabMediator.java @@ -19,7 +19,6 @@ package games.rednblack.editor.view.ui.box.resourcespanel; import com.badlogic.gdx.utils.Array; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.resource.DeleteLibraryItem; import games.rednblack.editor.controller.commands.resource.ExportLibraryItemCommand; import games.rednblack.editor.factory.ItemFactory; @@ -29,8 +28,9 @@ import games.rednblack.editor.renderer.factory.EntityFactory; import games.rednblack.editor.view.ui.box.resourcespanel.draggable.DraggableResource; import games.rednblack.editor.view.ui.box.resourcespanel.draggable.list.LibraryItemResource; import games.rednblack.h2d.common.MsgAPI; -import org.apache.commons.lang3.ArrayUtils; -import org.puremvc.java.interfaces.INotification; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import java.util.HashMap; @@ -49,14 +49,9 @@ public class UILibraryItemsTabMediator extends UIResourcesTabMediator items = projectManager.currentProjectInfoVO.libraryItems; itemArray.clear(); diff --git a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIParticleEffectsTabMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIParticleEffectsTabMediator.java index b6e6103b..20554690 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIParticleEffectsTabMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIParticleEffectsTabMediator.java @@ -30,8 +30,9 @@ 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.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import org.apache.commons.lang3.ArrayUtils; -import org.puremvc.java.interfaces.INotification; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; @@ -54,11 +55,9 @@ public class UIParticleEffectsTabMediator extends UIResourcesTabMediator extends M @Override public void onRegister() { super.onRegister(); - facade = HyperLap2DFacade.getInstance(); settingsManager = facade.retrieveProxy(SettingsManager.NAME); } + @Override - public String[] listNotificationInterests() { - return new String[]{ - ProjectManager.PROJECT_OPENED, + public void listNotificationInterests(Interests interests) { + interests.add(ProjectManager.PROJECT_OPENED, ProjectManager.PROJECT_DATA_UPDATED, MsgAPI.ADD_RESOURCES_BOX_FILTER, - MsgAPI.UPDATE_RESOURCES_LIST, - CHANGE_ACTIVE_FILTER - }; + MsgAPI.UPDATE_RESOURCES_LIST); + interests.add(CHANGE_ACTIVE_FILTER); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/DraggableResource.java b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/DraggableResource.java index aa7554fb..9dce5aa0 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/DraggableResource.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/DraggableResource.java @@ -23,7 +23,6 @@ import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ResourceManager; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.stage.UIStage; @@ -31,6 +30,7 @@ import games.rednblack.editor.view.ui.box.UIResourcesBoxMediator; import games.rednblack.editor.view.ui.box.resourcespanel.draggable.box.BoxItemResource; import games.rednblack.h2d.common.ResourcePayloadObject; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; +import games.rednblack.puremvc.Facade; import java.util.function.BiFunction; @@ -70,7 +70,7 @@ public class DraggableResource extends DragAndDrop implements Comparable { private static final String TAG = AboutDialogMediator.class.getCanonicalName(); @@ -16,16 +16,8 @@ public class AboutDialogMediator extends Mediator { } @Override - public void onRegister() { - super.onRegister(); - facade = HyperLap2DFacade.getInstance(); - } - - @Override - public String[] listNotificationInterests() { - return new String[]{ - HelpMenu.ABOUT_DIALOG_OPEN - }; + public void listNotificationInterests(Interests interests) { + interests.add(HelpMenu.ABOUT_DIALOG_OPEN); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/AnimationsPackDialogMediator.java b/src/main/java/games/rednblack/editor/view/ui/dialog/AnimationsPackDialogMediator.java index 9bb36170..2feb113e 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/AnimationsPackDialogMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/AnimationsPackDialogMediator.java @@ -1,7 +1,6 @@ package games.rednblack.editor.view.ui.dialog; import com.badlogic.gdx.utils.Array; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.resource.DeleteImageResource; import games.rednblack.editor.controller.commands.resource.DeleteSpineAnimation; import games.rednblack.editor.controller.commands.resource.DeleteSpriteAnimation; @@ -11,8 +10,9 @@ import games.rednblack.editor.view.menu.ResourcesMenu; 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; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; public class AnimationsPackDialogMediator extends Mediator { private static final String TAG = AnimationsPackDialogMediator.class.getCanonicalName(); @@ -28,26 +28,18 @@ public class AnimationsPackDialogMediator extends Mediator { } @Override - public void onRegister() { - super.onRegister(); - facade = HyperLap2DFacade.getInstance(); - } - - @Override - public String[] listNotificationInterests() { - return new String[]{ - ResourcesMenu.OPEN_ANIMATIONS_PACK, + public void listNotificationInterests(Interests interests) { + interests.add(ResourcesMenu.OPEN_ANIMATIONS_PACK, ProjectManager.PROJECT_OPENED, NEW_IMAGES_PACK, - MOVE_REGION_TO_PACK, - UPDATE_CURRENT_LIST, + MOVE_REGION_TO_PACK); + interests.add(UPDATE_CURRENT_LIST, REMOVE_PACK, MsgAPI.UPDATE_ATLAS_PACK_LIST, - ProjectManager.PROJECT_DATA_UPDATED, - DeleteImageResource.DONE, + ProjectManager.PROJECT_DATA_UPDATED); + interests.add(DeleteImageResource.DONE, DeleteSpineAnimation.DONE, - DeleteSpriteAnimation.DONE - }; + DeleteSpriteAnimation.DONE); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/AtlasesPackDialog.java b/src/main/java/games/rednblack/editor/view/ui/dialog/AtlasesPackDialog.java index 66ef57d9..8b4e3323 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/AtlasesPackDialog.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/AtlasesPackDialog.java @@ -18,7 +18,6 @@ import com.kotcrab.vis.ui.util.adapter.SimpleListAdapter; import com.kotcrab.vis.ui.util.dialog.Dialogs; import com.kotcrab.vis.ui.util.dialog.OptionDialogAdapter; import com.kotcrab.vis.ui.widget.*; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.utils.ResourceListAdapter; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.H2DDialog; @@ -27,6 +26,7 @@ import games.rednblack.h2d.common.view.ui.listener.ScrollFocusListener; 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 games.rednblack.puremvc.Facade; import java.util.Set; @@ -41,7 +41,7 @@ public class AtlasesPackDialog extends H2DDialog { private final VisTextButton insertButton, removeButton; private final VisLabel currentSelectedPackLabel; - private final HyperLap2DFacade facade = HyperLap2DFacade.getInstance(); + private final Facade facade = Facade.getInstance(); private final Array mainList = new Array<>(); private final Array currentList = new Array<>(); diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/AutoTraceDialogMediator.java b/src/main/java/games/rednblack/editor/view/ui/dialog/AutoTraceDialogMediator.java index c5f42a9c..5f0d49bc 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/AutoTraceDialogMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/AutoTraceDialogMediator.java @@ -3,7 +3,6 @@ package games.rednblack.editor.view.ui.dialog; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; import com.kotcrab.vis.ui.util.dialog.Dialogs; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.components.shape.PolygonShapeComponent; import games.rednblack.editor.renderer.components.TextureRegionComponent; import games.rednblack.editor.utils.poly.PolygonUtils; @@ -15,8 +14,10 @@ import games.rednblack.editor.view.ui.FollowersUIMediator; import games.rednblack.editor.view.ui.followers.BasicFollower; import games.rednblack.editor.view.ui.followers.PolygonFollower; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import java.util.stream.Stream; @@ -32,17 +33,9 @@ public class AutoTraceDialogMediator extends Mediator { } @Override - public void onRegister() { - super.onRegister(); - facade = HyperLap2DFacade.getInstance(); - } - - @Override - public String[] listNotificationInterests() { - return new String[]{ - AutoTraceDialog.OPEN_DIALOG, - AutoTraceDialog.AUTO_TRACE_BUTTON_CLICKED - }; + public void listNotificationInterests(Interests interests) { + interests.add(AutoTraceDialog.OPEN_DIALOG, + AutoTraceDialog.AUTO_TRACE_BUTTON_CLICKED); } @Override @@ -80,13 +73,13 @@ public class AutoTraceDialogMediator extends Mediator { polygonShapeComponent.vertices = new Array<>(points); polygonShapeComponent.polygonizedVertices = PolygonUtils.polygonize(points); - FollowersUIMediator followersUIMediator = HyperLap2DFacade.getInstance().retrieveMediator(FollowersUIMediator.NAME); + FollowersUIMediator followersUIMediator = Facade.getInstance().retrieveMediator(FollowersUIMediator.NAME); BasicFollower follower = followersUIMediator.getFollower(entity); PolygonFollower polygonFollower = (PolygonFollower) follower.getSubFollower(PolygonFollower.class); if (polygonFollower != null) polygonFollower.update(); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); + Facade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } } else { Dialogs.showErrorDialog(Sandbox.getInstance().getUIStage(), "Auto Trace can be performed only for Image type.").padBottom(20).pack(); diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/CodeEditorDialog.java b/src/main/java/games/rednblack/editor/view/ui/dialog/CodeEditorDialog.java index 04bce841..c97fa100 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/CodeEditorDialog.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/CodeEditorDialog.java @@ -7,12 +7,12 @@ import com.kotcrab.vis.ui.util.highlight.Highlighter; import com.kotcrab.vis.ui.widget.H2DHighlightTextArea; import com.kotcrab.vis.ui.widget.HighlightTextArea; import com.kotcrab.vis.ui.widget.VisTextButton; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.code.syntax.ProgrammingSyntax; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.H2DDialog; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; import games.rednblack.h2d.common.view.ui.listener.ScrollFocusListener; +import games.rednblack.puremvc.Facade; public class CodeEditorDialog extends H2DDialog { @@ -75,7 +75,7 @@ public class CodeEditorDialog extends H2DDialog { @Override public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); - HyperLap2DFacade.getInstance().sendNotification(notificationCallback, textArea.getText(), notificationCallbackType); + Facade.getInstance().sendNotification(notificationCallback, textArea.getText(), notificationCallbackType); close(); } }); diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/CodeEditorDialogMediator.java b/src/main/java/games/rednblack/editor/view/ui/dialog/CodeEditorDialogMediator.java index 1f5f9d4c..9e247087 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/CodeEditorDialogMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/CodeEditorDialogMediator.java @@ -1,12 +1,12 @@ package games.rednblack.editor.view.ui.dialog; import com.kotcrab.vis.ui.util.highlight.Highlighter; -import games.rednblack.editor.HyperLap2DFacade; 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; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import java.io.File; import java.io.IOException; @@ -24,17 +24,9 @@ public class CodeEditorDialogMediator extends Mediator { } @Override - public void onRegister() { - super.onRegister(); - facade = HyperLap2DFacade.getInstance(); - } - - @Override - public String[] listNotificationInterests() { - return new String[]{ - MsgAPI.OPEN_CODE_EDITOR, - MsgAPI.PROJECT_FILE_MODIFIED - }; + public void listNotificationInterests(Interests interests) { + interests.add(MsgAPI.OPEN_CODE_EDITOR, + MsgAPI.PROJECT_FILE_MODIFIED); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/ConsoleDialog.java b/src/main/java/games/rednblack/editor/view/ui/dialog/ConsoleDialog.java index 72e7e00f..ce5c752b 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/ConsoleDialog.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/ConsoleDialog.java @@ -15,13 +15,13 @@ import com.kotcrab.vis.ui.util.highlight.Highlighter; import com.kotcrab.vis.ui.widget.H2DHighlightTextArea; import com.kotcrab.vis.ui.widget.HighlightTextArea; import com.kotcrab.vis.ui.widget.VisImageButton; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.H2DDialog; import games.rednblack.h2d.common.util.H2DHighlight; import games.rednblack.h2d.common.view.ui.Cursors; import games.rednblack.h2d.common.view.ui.listener.CursorListener; import games.rednblack.h2d.common.view.ui.listener.ScrollFocusListener; +import games.rednblack.puremvc.Facade; import org.apache.commons.lang3.RegExUtils; import java.util.HashMap; @@ -95,7 +95,7 @@ public class ConsoleDialog extends H2DDialog { ScrollPane scrollPane = textArea.createCompatibleScrollPane(); scrollPane.addListener(new ScrollFocusListener()); - textArea.addListener(new CursorListener(Cursors.TEXT, HyperLap2DFacade.getInstance())); + textArea.addListener(new CursorListener(Cursors.TEXT, Facade.getInstance())); getContentTable().add(scrollPane).padTop(5).grow().row(); } diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/ConsoleDialogMediator.java b/src/main/java/games/rednblack/editor/view/ui/dialog/ConsoleDialogMediator.java index fbb5a3da..9aa34f7e 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/ConsoleDialogMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/ConsoleDialogMediator.java @@ -1,11 +1,11 @@ package games.rednblack.editor.view.ui.dialog; -import games.rednblack.editor.HyperLap2DFacade; 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; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; public class ConsoleDialogMediator extends Mediator { @@ -17,17 +17,9 @@ public class ConsoleDialogMediator extends Mediator { } @Override - public void onRegister() { - super.onRegister(); - facade = HyperLap2DFacade.getInstance(); - } - - @Override - public String[] listNotificationInterests() { - return new String[]{ - MsgAPI.OPEN_CONSOLE, - MsgAPI.WRITE_TO_CONSOLE - }; + public void listNotificationInterests(Interests interests) { + interests.add(MsgAPI.OPEN_CONSOLE, + MsgAPI.WRITE_TO_CONSOLE); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/CreateNewResolutionDialog.java b/src/main/java/games/rednblack/editor/view/ui/dialog/CreateNewResolutionDialog.java index e775e5cf..7917d4ec 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/CreateNewResolutionDialog.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/CreateNewResolutionDialog.java @@ -23,11 +23,11 @@ import com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup; import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.kotcrab.vis.ui.widget.*; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.data.ResolutionEntryVO; import games.rednblack.editor.view.ui.validator.StringNameValidator; import games.rednblack.h2d.common.H2DDialog; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; +import games.rednblack.puremvc.Facade; public class CreateNewResolutionDialog extends H2DDialog { private static final String prefix = "games.rednblack.editor.view.ui.dialog.CreateNewResolutionDialog"; @@ -85,7 +85,7 @@ public class CreateNewResolutionDialog extends H2DDialog { @Override public void close() { super.close(); - HyperLap2DFacade facade = HyperLap2DFacade.getInstance(); + Facade facade = Facade.getInstance(); facade.sendNotification(CLOSE_DIALOG); } @@ -96,7 +96,7 @@ public class CreateNewResolutionDialog extends H2DDialog { if (nameVisTextField.getText().equals("") || widthVisTextField.getText().equals("") || heightVisTextField.getText().equals("")) { return; } - HyperLap2DFacade facade = HyperLap2DFacade.getInstance(); + Facade facade = Facade.getInstance(); ResolutionEntryVO resolutionEntryVO = new ResolutionEntryVO(); resolutionEntryVO.name = nameVisTextField.getText(); resolutionEntryVO.width = Integer.parseInt(widthVisTextField.getText()); diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/CreateNewResolutionDialogMediator.java b/src/main/java/games/rednblack/editor/view/ui/dialog/CreateNewResolutionDialogMediator.java index 17adc315..6506f458 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/CreateNewResolutionDialogMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/CreateNewResolutionDialogMediator.java @@ -18,14 +18,14 @@ package games.rednblack.editor.view.ui.dialog; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ResolutionManager; import games.rednblack.editor.renderer.data.ResolutionEntryVO; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.stage.UIStage; import games.rednblack.editor.view.ui.box.bottom.UIResolutionBox; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; /** * Created by sargis on 4/9/15. @@ -39,17 +39,9 @@ public class CreateNewResolutionDialogMediator extends Mediator { +public class CreateNoiseDialogMediator extends Mediator { private static final String TAG = CreateNoiseDialogMediator.class.getCanonicalName(); private static final String NAME = TAG; @@ -25,17 +25,9 @@ public class CreateNoiseDialogMediator extends Mediator { } @Override - public void onRegister() { - super.onRegister(); - facade = HyperLap2DFacade.getInstance(); - } - - @Override - public String[] listNotificationInterests() { - return new String[]{ - ResourcesMenu.CREATE_NOISE, - CreateNoiseDialog.ADD_NEW_PLACEHOLDER - }; + public void listNotificationInterests(Interests interests) { + interests.add(ResourcesMenu.CREATE_NOISE, + CreateNoiseDialog.ADD_NEW_PLACEHOLDER); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/CreatePlaceholderDialog.java b/src/main/java/games/rednblack/editor/view/ui/dialog/CreatePlaceholderDialog.java index 6b4318a6..3371f8f2 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/CreatePlaceholderDialog.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/CreatePlaceholderDialog.java @@ -5,10 +5,10 @@ import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.kotcrab.vis.ui.util.Validators; import com.kotcrab.vis.ui.widget.VisTextButton; import com.kotcrab.vis.ui.widget.VisValidatableTextField; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.ui.validator.StringNameValidator; import games.rednblack.h2d.common.H2DDialog; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; +import games.rednblack.puremvc.Facade; public class CreatePlaceholderDialog extends H2DDialog { @@ -18,13 +18,13 @@ public class CreatePlaceholderDialog extends H2DDialog { private final VisValidatableTextField width, height, name; private final VisTextButton generateButton; - private final HyperLap2DFacade facade; + private final Facade facade; public CreatePlaceholderDialog() { super("Create Placeholder"); addCloseButton(); - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); name = StandardWidgetsFactory.createValidableTextField(new StringNameValidator()); getContentTable().add("Name:"); diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/CreatePlaceholderDialogMediator.java b/src/main/java/games/rednblack/editor/view/ui/dialog/CreatePlaceholderDialogMediator.java index d4303c94..7e5769f8 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/CreatePlaceholderDialogMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/CreatePlaceholderDialogMediator.java @@ -4,14 +4,14 @@ import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.graphics.PixmapIO; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.view.menu.ResourcesMenu; 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; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import java.io.File; @@ -24,17 +24,9 @@ public class CreatePlaceholderDialogMediator extends Mediator { private static final String TAG = ImagesPackDialogMediator.class.getCanonicalName(); @@ -28,26 +28,18 @@ public class ImagesPackDialogMediator extends Mediator { } @Override - public void onRegister() { - super.onRegister(); - facade = HyperLap2DFacade.getInstance(); - } - - @Override - public String[] listNotificationInterests() { - return new String[]{ - ResourcesMenu.OPEN_IMAGES_PACK, + public void listNotificationInterests(Interests interests) { + interests.add(ResourcesMenu.OPEN_IMAGES_PACK, ProjectManager.PROJECT_OPENED, NEW_IMAGES_PACK, - MOVE_REGION_TO_PACK, - UPDATE_CURRENT_LIST, + MOVE_REGION_TO_PACK); + interests.add(UPDATE_CURRENT_LIST, REMOVE_PACK, MsgAPI.UPDATE_ATLAS_PACK_LIST, - ProjectManager.PROJECT_DATA_UPDATED, - DeleteImageResource.DONE, + ProjectManager.PROJECT_DATA_UPDATED); + interests.add(DeleteImageResource.DONE, DeleteSpineAnimation.DONE, - DeleteSpriteAnimation.DONE - }; + DeleteSpriteAnimation.DONE); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/ImportSpriteSheetDialog.java b/src/main/java/games/rednblack/editor/view/ui/dialog/ImportSpriteSheetDialog.java index ff8863cd..13f311f7 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/ImportSpriteSheetDialog.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/ImportSpriteSheetDialog.java @@ -8,11 +8,10 @@ import com.kotcrab.vis.ui.widget.VisTable; import com.kotcrab.vis.ui.widget.VisTextButton; import com.kotcrab.vis.ui.widget.VisValidatableTextField; import com.kotcrab.vis.ui.widget.file.FileChooser; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.h2d.common.H2DDialog; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; import games.rednblack.h2d.common.view.ui.widget.InputFileWidget; -import org.puremvc.java.interfaces.IFacade; +import games.rednblack.puremvc.Facade; public class ImportSpriteSheetDialog extends H2DDialog { private static final String prefix = "games.rednblack.editor.view.ui.dialog.ImportSpriteSheetDialog"; @@ -21,13 +20,13 @@ public class ImportSpriteSheetDialog extends H2DDialog { private final VisValidatableTextField width, height; private final InputFileWidget imagePathField; private final VisTextButton importButton; - private final IFacade facade; + private final Facade facade; public ImportSpriteSheetDialog() { super("Import Sprite Sheet Animation"); addCloseButton(); - this.facade = HyperLap2DFacade.getInstance(); + this.facade = Facade.getInstance(); setModal(true); VisTable fileTable = new VisTable(); diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/ImportSpriteSheetDialogMediator.java b/src/main/java/games/rednblack/editor/view/ui/dialog/ImportSpriteSheetDialogMediator.java index 89fe8504..109ebc55 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/ImportSpriteSheetDialogMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/ImportSpriteSheetDialogMediator.java @@ -5,15 +5,15 @@ import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.graphics.PixmapIO; import com.badlogic.gdx.tools.texturepacker.TexturePacker; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.view.menu.ResourcesMenu; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.stage.UIStage; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import org.apache.commons.io.FileUtils; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; import java.io.File; import java.io.IOException; @@ -29,17 +29,9 @@ public class ImportSpriteSheetDialogMediator extends Mediator { private static final String TAG = LoadingBarDialogMediator.class.getCanonicalName(); @@ -16,17 +16,9 @@ public class LoadingBarDialogMediator extends Mediator { } @Override - public void onRegister() { - super.onRegister(); - facade = HyperLap2DFacade.getInstance(); - } - - @Override - public String[] listNotificationInterests() { - return new String[]{ - MsgAPI.SHOW_LOADING_DIALOG, - MsgAPI.HIDE_LOADING_DIALOG - }; + public void listNotificationInterests(Interests interests) { + interests.add(MsgAPI.SHOW_LOADING_DIALOG, + MsgAPI.HIDE_LOADING_DIALOG); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/NewProjectDialog.java b/src/main/java/games/rednblack/editor/view/ui/dialog/NewProjectDialog.java index e697f9ea..b67e8e01 100755 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/NewProjectDialog.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/NewProjectDialog.java @@ -30,11 +30,11 @@ import com.badlogic.gdx.utils.Align; import com.kotcrab.vis.ui.util.Validators; import com.kotcrab.vis.ui.widget.*; import com.kotcrab.vis.ui.widget.file.FileChooser; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.ui.validator.StringNameValidator; import games.rednblack.h2d.common.H2DDialog; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; import games.rednblack.h2d.common.view.ui.widget.InputFileWidget; +import games.rednblack.puremvc.Facade; import org.apache.commons.lang3.math.NumberUtils; import java.io.File; @@ -180,7 +180,7 @@ public class NewProjectDialog extends H2DDialog { @Override public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); - HyperLap2DFacade facade = HyperLap2DFacade.getInstance(); + Facade facade = Facade.getInstance(); if (projectName.isInputValid() && pixelsPerWorldUnitField.isInputValid() && originHeightTextField.isInputValid() && originWidthTextField.isInputValid()) { facade.sendNotification(command, workspacePathField.getValue().path() + File.separator + projectName.getText()); } diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/NewProjectDialogMediator.java b/src/main/java/games/rednblack/editor/view/ui/dialog/NewProjectDialogMediator.java index ea3530da..1a64eee6 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/NewProjectDialogMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/NewProjectDialogMediator.java @@ -18,14 +18,14 @@ package games.rednblack.editor.view.ui.dialog; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.proxy.SettingsManager; import games.rednblack.editor.view.menu.FileMenu; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.stage.UIStage; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; /** * Created by sargis on 4/1/15. @@ -39,17 +39,14 @@ public class NewProjectDialogMediator extends Mediator { } @Override - public String[] listNotificationInterests() { - return new String[]{ - FileMenu.NEW_PROJECT, - NewProjectDialog.CREATE_BTN_CLICKED - }; + public void listNotificationInterests(Interests interests) { + interests.add(FileMenu.NEW_PROJECT, + NewProjectDialog.CREATE_BTN_CLICKED); } @Override public void onRegister() { super.onRegister(); - facade = HyperLap2DFacade.getInstance(); SettingsManager settingsManager = facade.retrieveProxy(SettingsManager.NAME); viewComponent.setDefaultWorkspacePath(settingsManager.getWorkspacePath().path()); diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/NodeEditorDialog.java b/src/main/java/games/rednblack/editor/view/ui/dialog/NodeEditorDialog.java index 6df12521..5a6c88ba 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/NodeEditorDialog.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/NodeEditorDialog.java @@ -8,7 +8,6 @@ import com.kotcrab.vis.ui.VisUI; import com.kotcrab.vis.ui.widget.MenuItem; import com.kotcrab.vis.ui.widget.PopupMenu; import com.kotcrab.vis.ui.widget.VisTextButton; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.AddToLibraryAction; import games.rednblack.editor.graph.*; import games.rednblack.editor.graph.actions.ActionFieldType; @@ -35,6 +34,7 @@ import games.rednblack.h2d.common.H2DDialog; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; import games.rednblack.h2d.common.view.ui.widget.H2DPopupMenu; +import games.rednblack.puremvc.Facade; import java.lang.reflect.InvocationTargetException; import java.util.*; @@ -144,7 +144,7 @@ public class NodeEditorDialog extends H2DDialog implements Graph items = projectManager.currentProjectInfoVO.libraryActions; if (items.get(actionName) != null) { diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/NodeEditorDialogMediator.java b/src/main/java/games/rednblack/editor/view/ui/dialog/NodeEditorDialogMediator.java index 2212abf1..2df14139 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/NodeEditorDialogMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/NodeEditorDialogMediator.java @@ -1,11 +1,11 @@ package games.rednblack.editor.view.ui.dialog; -import games.rednblack.editor.HyperLap2DFacade; 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; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; public class NodeEditorDialogMediator extends Mediator { private static final String TAG = NodeEditorDialogMediator.class.getCanonicalName(); @@ -16,16 +16,8 @@ public class NodeEditorDialogMediator extends Mediator { } @Override - public void onRegister() { - super.onRegister(); - facade = HyperLap2DFacade.getInstance(); - } - - @Override - public String[] listNotificationInterests() { - return new String[]{ - MsgAPI.OPEN_NODE_EDITOR - }; + public void listNotificationInterests(Interests interests) { + interests.add(MsgAPI.OPEN_NODE_EDITOR); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/SaveProjectDialog.java b/src/main/java/games/rednblack/editor/view/ui/dialog/SaveProjectDialog.java index 372c2613..82dff205 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/SaveProjectDialog.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/SaveProjectDialog.java @@ -4,11 +4,11 @@ import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.kotcrab.vis.ui.widget.VisLabel; import com.kotcrab.vis.ui.widget.VisTextButton; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.renderer.data.SceneVO; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.H2DDialog; +import games.rednblack.puremvc.Facade; public class SaveProjectDialog extends H2DDialog { @@ -33,7 +33,7 @@ public class SaveProjectDialog extends H2DDialog { @Override public void clicked(InputEvent event, float x, float y) { Sandbox sandbox = Sandbox.getInstance(); - HyperLap2DFacade facade = HyperLap2DFacade.getInstance(); + Facade facade = Facade.getInstance(); ProjectManager projectManager = facade.retrieveProxy(ProjectManager.NAME); SceneVO vo = sandbox.sceneVoFromItems(); projectManager.saveCurrentProject(vo); diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/SaveProjectDialogMediator.java b/src/main/java/games/rednblack/editor/view/ui/dialog/SaveProjectDialogMediator.java index 027b59a0..8f89c185 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/SaveProjectDialogMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/SaveProjectDialogMediator.java @@ -1,13 +1,14 @@ package games.rednblack.editor.view.ui.dialog; import games.rednblack.editor.HyperLap2DApp; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ProjectManager; 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; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; public class SaveProjectDialogMediator extends Mediator { private static final String TAG = SaveProjectDialogMediator.class.getCanonicalName(); @@ -18,16 +19,8 @@ public class SaveProjectDialogMediator extends Mediator { } @Override - public void onRegister() { - super.onRegister(); - facade = HyperLap2DFacade.getInstance(); - } - - @Override - public String[] listNotificationInterests() { - return new String[]{ - MsgAPI.CHECK_EDITS_ACTION - }; + public void listNotificationInterests(Interests interests) { + interests.add(MsgAPI.CHECK_EDITS_ACTION); } @Override @@ -36,7 +29,7 @@ public class SaveProjectDialogMediator extends Mediator { Sandbox sandbox = Sandbox.getInstance(); UIStage uiStage = sandbox.getUIStage(); - HyperLap2DFacade facade = HyperLap2DFacade.getInstance(); + Facade facade = Facade.getInstance(); ProjectManager projectManager = facade.retrieveProxy(ProjectManager.NAME); switch (notification.getName()) { diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/SettingsDialogMediator.java b/src/main/java/games/rednblack/editor/view/ui/dialog/SettingsDialogMediator.java index 9d0e575a..a48c9fea 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/SettingsDialogMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/SettingsDialogMediator.java @@ -1,6 +1,5 @@ package games.rednblack.editor.view.ui.dialog; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.SettingsManager; import games.rednblack.editor.view.menu.FileMenu; import games.rednblack.editor.view.stage.Sandbox; @@ -10,8 +9,9 @@ import games.rednblack.editor.view.ui.settings.PluginsSettings; import games.rednblack.editor.view.ui.settings.SandboxSettings; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.view.SettingsNodeValue; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; public class SettingsDialogMediator extends Mediator { @@ -25,18 +25,15 @@ public class SettingsDialogMediator extends Mediator { } @Override - public String[] listNotificationInterests() { - return new String[]{ - FileMenu.SETTINGS, + public void listNotificationInterests(Interests interests) { + interests.add(FileMenu.SETTINGS, SettingsDialog.ADD_SETTINGS, - MsgAPI.ADD_PLUGIN_SETTINGS - }; + MsgAPI.ADD_PLUGIN_SETTINGS); } @Override public void onRegister() { super.onRegister(); - facade = HyperLap2DFacade.getInstance(); SettingsManager settingsManager = facade.retrieveProxy(SettingsManager.NAME); diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/ShaderManagerDialog.java b/src/main/java/games/rednblack/editor/view/ui/dialog/ShaderManagerDialog.java index a11f2a5e..64f68354 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/ShaderManagerDialog.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/ShaderManagerDialog.java @@ -6,12 +6,12 @@ import com.badlogic.gdx.utils.Array; import com.kotcrab.vis.ui.util.adapter.AbstractListAdapter; import com.kotcrab.vis.ui.util.adapter.SimpleListAdapter; import com.kotcrab.vis.ui.widget.*; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.H2DDialog; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; import games.rednblack.h2d.common.view.ui.listener.ScrollFocusListener; +import games.rednblack.puremvc.Facade; import java.util.Set; @@ -60,7 +60,7 @@ public class ShaderManagerDialog extends H2DDialog { payload[0] = newShaderName.getText(); payload[1] = newShaderTypeSelectBox.getSelectedIndex(); - HyperLap2DFacade.getInstance().sendNotification(CREATE_NEW_SHADER, payload); + Facade.getInstance().sendNotification(CREATE_NEW_SHADER, payload); } }); @@ -108,7 +108,7 @@ public class ShaderManagerDialog extends H2DDialog { editFragment.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { - HyperLap2DFacade.getInstance().sendNotification(EDIT_FRAGMENT_SHADER, item); + Facade.getInstance().sendNotification(EDIT_FRAGMENT_SHADER, item); } }); tableButton.add(editFragment).pad(8); @@ -116,7 +116,7 @@ public class ShaderManagerDialog extends H2DDialog { editVertex.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { - HyperLap2DFacade.getInstance().sendNotification(EDIT_VERTEX_SHADER, item); + Facade.getInstance().sendNotification(EDIT_VERTEX_SHADER, item); } }); tableButton.add(editVertex).pad(8); @@ -124,7 +124,7 @@ public class ShaderManagerDialog extends H2DDialog { deleteButton.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_DELETE_SHADER, item); + Facade.getInstance().sendNotification(MsgAPI.ACTION_DELETE_SHADER, item); } }); tableButton.add(deleteButton).pad(8); diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/ShaderManagerDialogMediator.java b/src/main/java/games/rednblack/editor/view/ui/dialog/ShaderManagerDialogMediator.java index 79ec5e36..99a2c044 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/ShaderManagerDialogMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/ShaderManagerDialogMediator.java @@ -1,7 +1,6 @@ package games.rednblack.editor.view.ui.dialog; import com.badlogic.gdx.files.FileHandle; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.code.syntax.GLSLSyntax; import games.rednblack.editor.controller.commands.resource.DeleteShaderCommand; import games.rednblack.editor.proxy.ProjectManager; @@ -15,9 +14,11 @@ import games.rednblack.editor.view.menu.ResourcesMenu; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.stage.UIStage; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.Facade; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import org.apache.commons.io.FileUtils; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; import java.io.File; import java.io.IOException; @@ -41,25 +42,22 @@ public class ShaderManagerDialogMediator extends Mediator { @Override public void onRegister() { super.onRegister(); - facade = HyperLap2DFacade.getInstance(); resourceManager = facade.retrieveProxy(ResourceManager.NAME); - projectManager = HyperLap2DFacade.getInstance().retrieveProxy(ProjectManager.NAME); + projectManager = Facade.getInstance().retrieveProxy(ProjectManager.NAME); } @Override - public String[] listNotificationInterests() { - return new String[]{ - ResourcesMenu.OPEN_SHADER_MANAGER, + public void listNotificationInterests(Interests interests) { + interests.add(ResourcesMenu.OPEN_SHADER_MANAGER, ProjectManager.PROJECT_OPENED, ProjectManager.PROJECT_DATA_UPDATED, - ShaderManagerDialog.EDIT_FRAGMENT_SHADER_DONE, - ShaderManagerDialog.EDIT_VERTEX_SHADER_DONE, + ShaderManagerDialog.EDIT_FRAGMENT_SHADER_DONE); + interests.add(ShaderManagerDialog.EDIT_VERTEX_SHADER_DONE, ShaderManagerDialog.EDIT_FRAGMENT_SHADER, ShaderManagerDialog.EDIT_VERTEX_SHADER, - ShaderManagerDialog.CREATE_NEW_SHADER, - DeleteShaderCommand.DONE - }; + ShaderManagerDialog.CREATE_NEW_SHADER); + interests.add(DeleteShaderCommand.DONE); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/followers/BasicFollower.java b/src/main/java/games/rednblack/editor/view/ui/followers/BasicFollower.java index fee2b948..fb7d0f77 100644 --- a/src/main/java/games/rednblack/editor/view/ui/followers/BasicFollower.java +++ b/src/main/java/games/rednblack/editor/view/ui/followers/BasicFollower.java @@ -33,7 +33,7 @@ import games.rednblack.editor.renderer.components.TransformComponent; import games.rednblack.editor.renderer.utils.TransformMathUtils; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.editor.view.stage.Sandbox; -import org.puremvc.java.interfaces.INotification; +import games.rednblack.puremvc.interfaces.INotification; /** * Created by azakhary on 5/20/2015. diff --git a/src/main/java/games/rednblack/editor/view/ui/followers/NormalSelectionFollower.java b/src/main/java/games/rednblack/editor/view/ui/followers/NormalSelectionFollower.java index 3b6a763e..2ec1fec0 100644 --- a/src/main/java/games/rednblack/editor/view/ui/followers/NormalSelectionFollower.java +++ b/src/main/java/games/rednblack/editor/view/ui/followers/NormalSelectionFollower.java @@ -28,7 +28,7 @@ import games.rednblack.editor.view.stage.tools.TransformTool; import games.rednblack.editor.view.ui.widget.EmptyTarget; import games.rednblack.editor.view.ui.widget.actors.basic.PixelDashedRectangle; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; +import games.rednblack.puremvc.interfaces.INotification; /** * Created by azakhary on 5/20/2015. diff --git a/src/main/java/games/rednblack/editor/view/ui/followers/SubFollower.java b/src/main/java/games/rednblack/editor/view/ui/followers/SubFollower.java index 4e4ecdf6..7e63d7ae 100644 --- a/src/main/java/games/rednblack/editor/view/ui/followers/SubFollower.java +++ b/src/main/java/games/rednblack/editor/view/ui/followers/SubFollower.java @@ -1,7 +1,7 @@ package games.rednblack.editor.view.ui.followers; import com.badlogic.gdx.scenes.scene2d.Group; -import org.puremvc.java.interfaces.INotification; +import games.rednblack.puremvc.interfaces.INotification; /** * Created by CyberJoe on 7/2/2015. diff --git a/src/main/java/games/rednblack/editor/view/ui/panel/CustomVariablesPanel.java b/src/main/java/games/rednblack/editor/view/ui/panel/CustomVariablesPanel.java index d3943962..e750d028 100644 --- a/src/main/java/games/rednblack/editor/view/ui/panel/CustomVariablesPanel.java +++ b/src/main/java/games/rednblack/editor/view/ui/panel/CustomVariablesPanel.java @@ -24,11 +24,9 @@ import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.ObjectMap; import com.kotcrab.vis.ui.VisUI; import com.kotcrab.vis.ui.widget.*; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.h2d.common.UIDraggablePanel; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; - -import java.util.Map; +import games.rednblack.puremvc.Facade; /** * Created by azakhary on 5/12/2015. @@ -38,7 +36,7 @@ public class CustomVariablesPanel extends UIDraggablePanel { public static final String ADD_BUTTON_PRESSED = PREFIX + ".ADD_BUTTON_PRESSED"; public static final String DELETE_BUTTON_PRESSED = PREFIX + ".DELETE_BUTTON_PRESSED"; - private HyperLap2DFacade facade; + private Facade facade; private VisTextField keyField; private VisTextField valueField; @@ -51,7 +49,7 @@ public class CustomVariablesPanel extends UIDraggablePanel { super("Custom variables"); addCloseButton(); - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); addVariableTable = new VisTable(); addVariableTable.padTop(4); diff --git a/src/main/java/games/rednblack/editor/view/ui/panel/CustomVariablesPanelMediator.java b/src/main/java/games/rednblack/editor/view/ui/panel/CustomVariablesPanelMediator.java index 2f3738fc..1cdb9ca4 100644 --- a/src/main/java/games/rednblack/editor/view/ui/panel/CustomVariablesPanelMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/panel/CustomVariablesPanelMediator.java @@ -18,7 +18,6 @@ package games.rednblack.editor.view.ui.panel; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.CustomVariableModifyCommand; import games.rednblack.editor.renderer.components.MainItemComponent; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; @@ -27,8 +26,9 @@ import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.stage.UIStage; import games.rednblack.editor.view.ui.properties.panels.UIBasicItemProperties; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import java.util.Set; @@ -48,21 +48,18 @@ public class CustomVariablesPanelMediator extends Mediator @Override public void onRegister() { super.onRegister(); - facade = HyperLap2DFacade.getInstance(); viewComponent.setEmptyMsg("No item selected."); } @Override - public String[] listNotificationInterests() { - return new String[]{ - MsgAPI.ITEM_SELECTION_CHANGED, + public void listNotificationInterests(Interests interests) { + interests.add(MsgAPI.ITEM_SELECTION_CHANGED, MsgAPI.EMPTY_SPACE_CLICKED, UIBasicItemProperties.CUSTOM_VARS_BUTTON_CLICKED, - CustomVariablesPanel.ADD_BUTTON_PRESSED, - CustomVariablesPanel.DELETE_BUTTON_PRESSED, + CustomVariablesPanel.ADD_BUTTON_PRESSED); + interests.add(CustomVariablesPanel.DELETE_BUTTON_PRESSED, WindowMenu.CUSTOM_VARIABLES_EDITOR_OPEN, - CustomVariableModifyCommand.DONE - }; + CustomVariableModifyCommand.DONE); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/panel/EditSpriteAnimationPanel.java b/src/main/java/games/rednblack/editor/view/ui/panel/EditSpriteAnimationPanel.java index 222bbad0..c03c5b02 100644 --- a/src/main/java/games/rednblack/editor/view/ui/panel/EditSpriteAnimationPanel.java +++ b/src/main/java/games/rednblack/editor/view/ui/panel/EditSpriteAnimationPanel.java @@ -26,11 +26,11 @@ import com.kotcrab.vis.ui.widget.VisTextButton; import com.kotcrab.vis.ui.widget.VisTextField; import com.kotcrab.vis.ui.widget.spinner.IntSpinnerModel; import com.kotcrab.vis.ui.widget.spinner.Spinner; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.data.FrameRange; import games.rednblack.editor.view.ui.validator.EmptyOrDefaultValidator; import games.rednblack.h2d.common.UIDraggablePanel; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; +import games.rednblack.puremvc.Facade; import java.util.Map; @@ -42,7 +42,7 @@ public class EditSpriteAnimationPanel extends UIDraggablePanel { public static final String ADD_BUTTON_PRESSED = PREFIX + ".ADD_BUTTON_PRESSED"; public static final String DELETE_BUTTON_PRESSED = PREFIX + ".DELETE_BUTTON_PRESSED"; - private final HyperLap2DFacade facade; + private final Facade facade; private VisTextField nameField; private Spinner fromFrameField; @@ -56,7 +56,7 @@ public class EditSpriteAnimationPanel extends UIDraggablePanel { super("Edit Sprite Animation Ranges"); addCloseButton(); - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); VisTable mainTable = new VisTable(); diff --git a/src/main/java/games/rednblack/editor/view/ui/panel/EditSpriteAnimationPanelMediator.java b/src/main/java/games/rednblack/editor/view/ui/panel/EditSpriteAnimationPanelMediator.java index 34fd8af4..9ac0b15a 100644 --- a/src/main/java/games/rednblack/editor/view/ui/panel/EditSpriteAnimationPanelMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/panel/EditSpriteAnimationPanelMediator.java @@ -18,7 +18,6 @@ package games.rednblack.editor.view.ui.panel; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.components.sprite.SpriteAnimationComponent; import games.rednblack.editor.renderer.data.FrameRange; import games.rednblack.editor.renderer.factory.EntityFactory; @@ -29,8 +28,9 @@ import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.stage.UIStage; import games.rednblack.editor.view.ui.properties.panels.UISpriteAnimationItemProperties; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import java.util.Set; @@ -50,20 +50,17 @@ public class EditSpriteAnimationPanelMediator extends Mediator { @Override public void onRegister() { super.onRegister(); - facade = HyperLap2DFacade.getInstance(); AssetIOManager.getInstance().setProgressHandler(new AssetsImportProgressHandler()); AssetIOManager.getInstance().setViewComponent(viewComponent); } @Override - public String[] listNotificationInterests() { - return new String[]{ - ResourcesMenu.IMPORT_TO_LIBRARY, + public void listNotificationInterests(Interests interests) { + interests.add(ResourcesMenu.IMPORT_TO_LIBRARY, ImportPanel.BROWSE_BTN_CLICKED, ImportPanel.IMPORT_FAILED, - MsgAPI.ACTION_FILES_DROPPED, - }; + MsgAPI.ACTION_FILES_DROPPED); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/panel/ShaderUniformsPanel.java b/src/main/java/games/rednblack/editor/view/ui/panel/ShaderUniformsPanel.java index 8890e136..8d70d6d9 100644 --- a/src/main/java/games/rednblack/editor/view/ui/panel/ShaderUniformsPanel.java +++ b/src/main/java/games/rednblack/editor/view/ui/panel/ShaderUniformsPanel.java @@ -11,19 +11,19 @@ import com.badlogic.gdx.utils.ObjectMap; import com.kotcrab.vis.ui.util.InputValidator; import com.kotcrab.vis.ui.util.Validators; import com.kotcrab.vis.ui.widget.*; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.data.ShaderUniformVO; import games.rednblack.editor.view.ui.widget.actors.table.CellBody; import games.rednblack.editor.view.ui.widget.actors.table.CellHeader; import games.rednblack.h2d.common.UIDraggablePanel; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; +import games.rednblack.puremvc.Facade; public class ShaderUniformsPanel extends UIDraggablePanel { private static final String prefix = "games.rednblack.editor.view.ui.panel.ShaderUniformsPanel"; public static final String ADD_BUTTON_CLICKED = prefix + ".ADD_BUTTON_CLICKED"; public static final String REMOVE_BUTTON_CLICKED = prefix + ".REMOVE_BUTTON_CLICKED"; - private final HyperLap2DFacade facade; + private final Facade facade; private final VisTable addUniformTable, inputTable, headerUniformsTable, uniformsTable; private final VisValidatableTextField input1, input2, input3, input4; private final VisSelectBox uniformName; @@ -49,7 +49,7 @@ public class ShaderUniformsPanel extends UIDraggablePanel { addButton = StandardWidgetsFactory.createTextButton("Add"); - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); getContentTable().pad(5).padTop(10); addUniformTable = new VisTable(); diff --git a/src/main/java/games/rednblack/editor/view/ui/panel/ShaderUniformsPanelMediator.java b/src/main/java/games/rednblack/editor/view/ui/panel/ShaderUniformsPanelMediator.java index 4482b93d..0d2f8a08 100644 --- a/src/main/java/games/rednblack/editor/view/ui/panel/ShaderUniformsPanelMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/panel/ShaderUniformsPanelMediator.java @@ -1,6 +1,5 @@ package games.rednblack.editor.view.ui.panel; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.components.ShaderComponent; import games.rednblack.editor.renderer.data.ShaderUniformVO; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; @@ -9,8 +8,9 @@ import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.stage.UIStage; import games.rednblack.editor.view.ui.properties.panels.UIShaderProperties; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import java.util.Set; @@ -27,20 +27,17 @@ public class ShaderUniformsPanelMediator extends Mediator { @Override public void onRegister() { super.onRegister(); - facade = HyperLap2DFacade.getInstance(); viewComponent.setEmpty(); } @Override - public String[] listNotificationInterests() { - return new String[]{ - MsgAPI.ITEM_SELECTION_CHANGED, + public void listNotificationInterests(Interests interests) { + interests.add(MsgAPI.ITEM_SELECTION_CHANGED, MsgAPI.EMPTY_SPACE_CLICKED, UIShaderProperties.UNIFORMS_BUTTON_CLICKED, - WindowMenu.SHADER_UNIFORMS_EDITOR_OPEN, - ShaderUniformsPanel.ADD_BUTTON_CLICKED, - ShaderUniformsPanel.REMOVE_BUTTON_CLICKED - }; + WindowMenu.SHADER_UNIFORMS_EDITOR_OPEN); + interests.add(ShaderUniformsPanel.ADD_BUTTON_CLICKED, + ShaderUniformsPanel.REMOVE_BUTTON_CLICKED); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/panel/TagsPanel.java b/src/main/java/games/rednblack/editor/view/ui/panel/TagsPanel.java index 73c9453f..a286d61b 100644 --- a/src/main/java/games/rednblack/editor/view/ui/panel/TagsPanel.java +++ b/src/main/java/games/rednblack/editor/view/ui/panel/TagsPanel.java @@ -7,9 +7,9 @@ import com.kotcrab.vis.ui.widget.VisLabel; import com.kotcrab.vis.ui.widget.VisTable; import com.kotcrab.vis.ui.widget.VisTextButton; import com.kotcrab.vis.ui.widget.VisTextField; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.h2d.common.UIDraggablePanel; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; +import games.rednblack.puremvc.Facade; import java.util.*; @@ -22,7 +22,7 @@ public class TagsPanel extends UIDraggablePanel { public static final String ITEM_ADD = prefix + ".ITEM_ADD"; public static final String ITEM_REMOVED = prefix + ".ITEM_REMOVED"; - private HyperLap2DFacade facade; + private Facade facade; private VisTable mainTable; private VisTable tagTable; @@ -34,7 +34,7 @@ public class TagsPanel extends UIDraggablePanel { super("Tags"); addCloseButton(); - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); mainTable = new VisTable(); diff --git a/src/main/java/games/rednblack/editor/view/ui/panel/TagsPanelMediator.java b/src/main/java/games/rednblack/editor/view/ui/panel/TagsPanelMediator.java index eb09ed3a..475cf9b5 100644 --- a/src/main/java/games/rednblack/editor/view/ui/panel/TagsPanelMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/panel/TagsPanelMediator.java @@ -1,6 +1,5 @@ package games.rednblack.editor.view.ui.panel; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.components.MainItemComponent; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.editor.view.menu.WindowMenu; @@ -8,8 +7,9 @@ import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.stage.UIStage; import games.rednblack.editor.view.ui.properties.panels.UIBasicItemProperties; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; -import org.puremvc.java.patterns.mediator.Mediator; +import games.rednblack.puremvc.Mediator; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import java.util.HashSet; import java.util.Iterator; @@ -32,20 +32,17 @@ public class TagsPanelMediator extends Mediator { @Override public void onRegister() { super.onRegister(); - facade = HyperLap2DFacade.getInstance(); viewComponent.setEmpty(); } @Override - public String[] listNotificationInterests() { - return new String[]{ - MsgAPI.ITEM_SELECTION_CHANGED, + public void listNotificationInterests(Interests interests) { + interests.add(MsgAPI.ITEM_SELECTION_CHANGED, MsgAPI.EMPTY_SPACE_CLICKED, UIBasicItemProperties.TAGS_BUTTON_CLICKED, - WindowMenu.TAGS_EDITOR_OPEN, - TagsPanel.ITEM_ADD, - TagsPanel.ITEM_REMOVED - }; + WindowMenu.TAGS_EDITOR_OPEN); + interests.add(TagsPanel.ITEM_ADD, + TagsPanel.ITEM_REMOVED); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/properties/UIAbstractEntityPropertiesMediator.java b/src/main/java/games/rednblack/editor/view/ui/properties/UIAbstractEntityPropertiesMediator.java index a47b3fe3..c8f3acae 100644 --- a/src/main/java/games/rednblack/editor/view/ui/properties/UIAbstractEntityPropertiesMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/properties/UIAbstractEntityPropertiesMediator.java @@ -18,10 +18,10 @@ package games.rednblack.editor.view.ui.properties; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.MsgAPI; -import org.puremvc.java.interfaces.INotification; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; /** * Created by azakhary on 4/15/2015. @@ -37,21 +37,12 @@ public abstract class UIAbstractEntityPropertiesMediator extends Mediator { private Sandbox sandbox; @@ -17,21 +17,12 @@ public abstract class UIAbstractPropertiesMediator { private static final String TAG = UICircleShapePropertiesMediator.class.getCanonicalName(); @@ -19,13 +20,9 @@ public class UICircleShapePropertiesMediator extends UIItemPropertiesMediator entityHashSet = new HashSet<>(); entityHashSet.add(observableReference); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_SELECTION_CHANGED, entityHashSet); + Facade.getInstance().sendNotification(MsgAPI.ITEM_SELECTION_CHANGED, entityHashSet); } } \ No newline at end of file diff --git a/src/main/java/games/rednblack/editor/view/ui/properties/panels/UILabelItemProperties.java b/src/main/java/games/rednblack/editor/view/ui/properties/panels/UILabelItemProperties.java index a0ae49ba..25145438 100644 --- a/src/main/java/games/rednblack/editor/view/ui/properties/panels/UILabelItemProperties.java +++ b/src/main/java/games/rednblack/editor/view/ui/properties/panels/UILabelItemProperties.java @@ -11,7 +11,6 @@ import com.kotcrab.vis.ui.widget.VisTable; import com.kotcrab.vis.ui.widget.VisTextArea; import com.kotcrab.vis.ui.widget.spinner.IntSpinnerModel; import com.kotcrab.vis.ui.widget.spinner.Spinner; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.code.syntax.TypingLabelSyntax; import games.rednblack.editor.event.CheckBoxChangeListener; import games.rednblack.editor.event.KeyboardListener; @@ -20,6 +19,7 @@ import games.rednblack.editor.event.SelectBoxChangeListener; import games.rednblack.editor.view.ui.properties.UIItemCollapsibleProperties; import games.rednblack.editor.view.ui.widget.actors.ExpandableTextArea; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; +import games.rednblack.puremvc.Facade; import java.util.HashMap; import java.util.Map; @@ -38,7 +38,7 @@ public class UILabelItemProperties extends UIItemCollapsibleProperties { private HashMap alignMap = new HashMap<>(); private Array alignNames = new Array<>(); - private HyperLap2DFacade facade; + private Facade facade; private VisSelectBox fontFamilySelectBox, bitmapFontSelectBox; private VisSelectBox alignSelectBox; @@ -51,7 +51,7 @@ public class UILabelItemProperties extends UIItemCollapsibleProperties { public UILabelItemProperties() { super("Label"); - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); bitmapFontSelectBox = StandardWidgetsFactory.createSelectBox(String.class); fontFamilySelectBox = StandardWidgetsFactory.createSelectBox(String.class); diff --git a/src/main/java/games/rednblack/editor/view/ui/properties/panels/UILabelItemPropertiesMediator.java b/src/main/java/games/rednblack/editor/view/ui/properties/panels/UILabelItemPropertiesMediator.java index 0fff050f..68ac5d93 100644 --- a/src/main/java/games/rednblack/editor/view/ui/properties/panels/UILabelItemPropertiesMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/properties/panels/UILabelItemPropertiesMediator.java @@ -1,14 +1,14 @@ package games.rednblack.editor.view.ui.properties.panels; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.FontManager; import games.rednblack.editor.proxy.ResourceManager; import games.rednblack.editor.renderer.components.label.LabelComponent; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.editor.view.ui.properties.UIItemPropertiesMediator; import games.rednblack.h2d.common.MsgAPI; +import games.rednblack.puremvc.interfaces.INotification; +import games.rednblack.puremvc.util.Interests; import org.apache.commons.lang3.ArrayUtils; -import org.puremvc.java.interfaces.INotification; public class UILabelItemPropertiesMediator extends UIItemPropertiesMediator { @@ -26,7 +26,6 @@ public class UILabelItemPropertiesMediator extends UIItemPropertiesMediator { @@ -29,14 +30,10 @@ public class UILightBodyPropertiesMediator extends UIItemPropertiesMediator { @@ -24,13 +25,9 @@ public class UIPhysicsPropertiesMediator extends UIItemPropertiesMediator { private static final String TAG = UITypingLabelPropertiesMediator.class.getCanonicalName(); @@ -18,14 +19,10 @@ public class UITypingLabelPropertiesMediator extends UIItemPropertiesMediator { @@ -20,7 +20,7 @@ public class GeneralSettings extends SettingsNodeValue { private VisSlider uiScaleDensity, msaaSamples, fpsLimit; public GeneralSettings() { - super("General", HyperLap2DFacade.getInstance()); + super("General", Facade.getInstance()); getContentTable().add("Editor").left().row(); getContentTable().addSeparator(); diff --git a/src/main/java/games/rednblack/editor/view/ui/settings/LivePreviewSettings.java b/src/main/java/games/rednblack/editor/view/ui/settings/LivePreviewSettings.java index 62cd5489..34a32787 100644 --- a/src/main/java/games/rednblack/editor/view/ui/settings/LivePreviewSettings.java +++ b/src/main/java/games/rednblack/editor/view/ui/settings/LivePreviewSettings.java @@ -7,7 +7,6 @@ import com.kotcrab.vis.ui.widget.VisCheckBox; import com.kotcrab.vis.ui.widget.VisTable; import com.kotcrab.vis.ui.widget.VisTextButton; import com.kotcrab.vis.ui.widget.color.ColorPickerAdapter; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.view.SettingsNodeValue; @@ -15,6 +14,7 @@ import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; import games.rednblack.h2d.common.view.ui.widget.HyperLapColorPicker; import games.rednblack.h2d.common.view.ui.widget.TintButton; import games.rednblack.h2d.common.vo.ProjectVO; +import games.rednblack.puremvc.Facade; public class LivePreviewSettings extends SettingsNodeValue { @@ -22,7 +22,7 @@ public class LivePreviewSettings extends SettingsNodeValue { private final VisCheckBox box2dDebug; public LivePreviewSettings() { - super("Live Preview", HyperLap2DFacade.getInstance()); + super("Live Preview", Facade.getInstance()); getContentTable().add("Window").left().row(); getContentTable().addSeparator(); diff --git a/src/main/java/games/rednblack/editor/view/ui/settings/PluginsSettings.java b/src/main/java/games/rednblack/editor/view/ui/settings/PluginsSettings.java index 7d5130c0..f8b9f952 100644 --- a/src/main/java/games/rednblack/editor/view/ui/settings/PluginsSettings.java +++ b/src/main/java/games/rednblack/editor/view/ui/settings/PluginsSettings.java @@ -2,17 +2,17 @@ package games.rednblack.editor.view.ui.settings; import com.badlogic.gdx.utils.Align; import com.kotcrab.vis.ui.widget.VisLabel; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.SettingsManager; import games.rednblack.h2d.common.view.SettingsNodeValue; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; +import games.rednblack.puremvc.Facade; import java.io.File; public class PluginsSettings extends SettingsNodeValue { public PluginsSettings() { - super("Plugins", HyperLap2DFacade.getInstance()); + super("Plugins", Facade.getInstance()); VisLabel visLabel = StandardWidgetsFactory.createLabel("Choose a PlugIn to change settings", "default", Align.center); getContentTable().add(visLabel).center().expand().fill().grow().row(); diff --git a/src/main/java/games/rednblack/editor/view/ui/settings/ProjectExportSettings.java b/src/main/java/games/rednblack/editor/view/ui/settings/ProjectExportSettings.java index 5a85496c..ae475a44 100644 --- a/src/main/java/games/rednblack/editor/view/ui/settings/ProjectExportSettings.java +++ b/src/main/java/games/rednblack/editor/view/ui/settings/ProjectExportSettings.java @@ -7,7 +7,6 @@ import com.kotcrab.vis.ui.widget.VisLabel; import com.kotcrab.vis.ui.widget.VisSelectBox; import com.kotcrab.vis.ui.widget.VisTable; import com.kotcrab.vis.ui.widget.file.FileChooser; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.proxy.ResolutionManager; import games.rednblack.h2d.common.MsgAPI; @@ -16,6 +15,7 @@ import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; import games.rednblack.h2d.common.view.ui.widget.InputFileWidget; import games.rednblack.h2d.common.vo.ProjectVO; import games.rednblack.h2d.common.vo.TexturePackerVO; +import games.rednblack.puremvc.Facade; public class ProjectExportSettings extends SettingsNodeValue { @@ -29,7 +29,7 @@ public class ProjectExportSettings extends SettingsNodeValue { private final VisSelectBox filterMinSelectBox; public ProjectExportSettings() { - super("Project Export", HyperLap2DFacade.getInstance()); + super("Project Export", Facade.getInstance()); duplicateCheckBox = StandardWidgetsFactory.createCheckBox("Duplicate edge pixels in atlas"); forceSquareCheckBox = StandardWidgetsFactory.createCheckBox("Force Square"); legacyCheckBox = StandardWidgetsFactory.createCheckBox("Legacy libGDX format"); diff --git a/src/main/java/games/rednblack/editor/view/ui/settings/SandboxSettings.java b/src/main/java/games/rednblack/editor/view/ui/settings/SandboxSettings.java index e2d7aba8..a685eba2 100644 --- a/src/main/java/games/rednblack/editor/view/ui/settings/SandboxSettings.java +++ b/src/main/java/games/rednblack/editor/view/ui/settings/SandboxSettings.java @@ -7,7 +7,6 @@ import com.kotcrab.vis.ui.widget.VisCheckBox; import com.kotcrab.vis.ui.widget.VisTable; import com.kotcrab.vis.ui.widget.VisTextButton; import com.kotcrab.vis.ui.widget.color.ColorPickerAdapter; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.view.SettingsNodeValue; @@ -15,6 +14,7 @@ import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; import games.rednblack.h2d.common.view.ui.widget.HyperLapColorPicker; import games.rednblack.h2d.common.view.ui.widget.TintButton; import games.rednblack.h2d.common.vo.EditorConfigVO; +import games.rednblack.puremvc.Facade; public class SandboxSettings extends SettingsNodeValue { @@ -22,7 +22,7 @@ public class SandboxSettings extends SettingsNodeValue { private final TintButton tintButton; public SandboxSettings() { - super("Sandbox", HyperLap2DFacade.getInstance()); + super("Sandbox", Facade.getInstance()); getContentTable().add("Composites").left().row(); getContentTable().addSeparator(); diff --git a/src/main/java/games/rednblack/editor/view/ui/widget/H2DLogo.java b/src/main/java/games/rednblack/editor/view/ui/widget/H2DLogo.java index ffeb5fa0..b80f9500 100644 --- a/src/main/java/games/rednblack/editor/view/ui/widget/H2DLogo.java +++ b/src/main/java/games/rednblack/editor/view/ui/widget/H2DLogo.java @@ -7,13 +7,13 @@ import com.kotcrab.vis.ui.VisUI; import com.kotcrab.vis.ui.widget.VisImage; import com.kotcrab.vis.ui.widget.VisTable; import games.rednblack.editor.HyperLap2DApp; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.SettingsManager; +import games.rednblack.puremvc.Facade; import org.apache.commons.lang3.SystemUtils; public class H2DLogo extends VisTable { public H2DLogo() { - SettingsManager settingsManager = HyperLap2DFacade.getInstance().retrieveProxy(SettingsManager.NAME); + SettingsManager settingsManager = Facade.getInstance().retrieveProxy(SettingsManager.NAME); Skin skin = VisUI.getSkin(); setBackground(skin.getDrawable("menu-bg")); VisImage logo = new VisImage(VisUI.getSkin().getDrawable("logo")); diff --git a/src/main/java/games/rednblack/editor/view/ui/widget/actors/ExpandableTextArea.java b/src/main/java/games/rednblack/editor/view/ui/widget/actors/ExpandableTextArea.java index 93e10cf4..92e69845 100644 --- a/src/main/java/games/rednblack/editor/view/ui/widget/actors/ExpandableTextArea.java +++ b/src/main/java/games/rednblack/editor/view/ui/widget/actors/ExpandableTextArea.java @@ -9,14 +9,14 @@ import com.kotcrab.vis.ui.widget.VisTextArea; import games.rednblack.editor.view.ui.dialog.CodeEditorDialogMediator; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; -import org.puremvc.java.interfaces.IFacade; +import games.rednblack.puremvc.Facade; public class ExpandableTextArea extends VisTable { public interface OnExpandListener { void onExpand(VisTextArea textArea); } - private IFacade facade; + private Facade facade; private OnExpandListener listener; private VisTextArea textArea; @@ -24,7 +24,7 @@ public class ExpandableTextArea extends VisTable { private Highlighter syntax; - public ExpandableTextArea(IFacade facade, String notificationCallback) { + public ExpandableTextArea(Facade facade, String notificationCallback) { this.facade = facade; textArea = StandardWidgetsFactory.createTextArea(); diff --git a/src/main/java/games/rednblack/editor/view/ui/widget/actors/StickyNoteActor.java b/src/main/java/games/rednblack/editor/view/ui/widget/actors/StickyNoteActor.java index 1f54bead..de2e9fe0 100644 --- a/src/main/java/games/rednblack/editor/view/ui/widget/actors/StickyNoteActor.java +++ b/src/main/java/games/rednblack/editor/view/ui/widget/actors/StickyNoteActor.java @@ -18,7 +18,6 @@ import com.kotcrab.vis.ui.widget.VisTextArea; import com.kotcrab.vis.ui.widget.VisWindow; import com.kotcrab.vis.ui.widget.color.ColorPicker; import com.kotcrab.vis.ui.widget.color.ColorPickerAdapter; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.ModifyStickyNoteCommand; import games.rednblack.editor.renderer.data.StickyNoteVO; import games.rednblack.editor.view.stage.Sandbox; @@ -27,6 +26,7 @@ import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; import games.rednblack.h2d.common.view.ui.widget.H2DPopupMenu; import games.rednblack.h2d.common.view.ui.widget.HyperLapColorPicker; +import games.rednblack.puremvc.Facade; public class StickyNoteActor extends VisWindow { public String id; @@ -36,7 +36,7 @@ public class StickyNoteActor extends VisWindow { private float worldX, worldY; private final Vector2 tmp = new Vector2(); private final VisTextArea contentArea; - private final HyperLap2DFacade facade = HyperLap2DFacade.getInstance(); + private final Facade facade = Facade.getInstance(); private final VisImage pinButton; private int resizeBorder = 8; diff --git a/src/main/java/games/rednblack/editor/view/ui/widget/actors/basic/PixelRect.java b/src/main/java/games/rednblack/editor/view/ui/widget/actors/basic/PixelRect.java index ac65f037..dac7e695 100644 --- a/src/main/java/games/rednblack/editor/view/ui/widget/actors/basic/PixelRect.java +++ b/src/main/java/games/rednblack/editor/view/ui/widget/actors/basic/PixelRect.java @@ -24,11 +24,11 @@ import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.scenes.scene2d.Group; import com.badlogic.gdx.scenes.scene2d.actions.Actions; import com.badlogic.gdx.scenes.scene2d.ui.Image; -import games.rednblack.editor.HyperLap2DFacade; +import games.rednblack.puremvc.Facade; public class PixelRect extends Group { - private final HyperLap2DFacade facade; + private final Facade facade; private final PixelLine[] lines = new PixelLine[4]; private final Image fill; private final Rectangle rectangle = new Rectangle(); @@ -38,7 +38,7 @@ public class PixelRect extends Group { } public PixelRect(float width, float height) { - facade = HyperLap2DFacade.getInstance(); + facade = Facade.getInstance(); lines[0] = new PixelLine(0, 0, width, 0); lines[1] = new PixelLine(0, 0, 0, height); lines[1].setPosition(lines[1].getThickness(), 0, lines[1].getThickness(), height - lines[1].getThickness()); diff --git a/src/main/java/games/rednblack/editor/view/ui/widget/actors/basic/SandboxBackUI.java b/src/main/java/games/rednblack/editor/view/ui/widget/actors/basic/SandboxBackUI.java index f8b13f90..0ed4a5a4 100644 --- a/src/main/java/games/rednblack/editor/view/ui/widget/actors/basic/SandboxBackUI.java +++ b/src/main/java/games/rednblack/editor/view/ui/widget/actors/basic/SandboxBackUI.java @@ -22,9 +22,9 @@ import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.utils.Array; -import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ResourceManager; import games.rednblack.editor.view.ui.widget.actors.GridView; +import games.rednblack.puremvc.Facade; import space.earlygrey.shapedrawer.ShapeDrawer; /** @@ -48,7 +48,7 @@ public class SandboxBackUI { } public void render(float delta) { - ResourceManager resourceManager = HyperLap2DFacade.getInstance().retrieveProxy(ResourceManager.NAME); + ResourceManager resourceManager = Facade.getInstance().retrieveProxy(ResourceManager.NAME); batch.begin(); for (Actor actor : actors) { actor.setScale(1f / resourceManager.getProjectVO().pixelToWorld);