use of games.rednblack.editor.proxy.ProjectManager in project HyperLap2D by rednblackgames.
the class CreateNoiseDialogMediator method createNoise.
private void createNoise(String name, int width, int height, int min, int max) {
Pixmap pixmap = PerlinNoiseGenerator.generatePixmap(width, height, min, max, 8);
ProjectManager projectManager = facade.retrieveProxy(ProjectManager.NAME);
String imagesPath = projectManager.getCurrentRawImagesPath() + File.separator + name + ".png";
FileHandle path = new FileHandle(imagesPath);
PixmapIO.writePNG(path, pixmap);
pixmap.dispose();
projectManager.getCurrentProjectInfoVO().imagesPacks.get("main").regions.add(name);
facade.sendNotification(MsgAPI.ACTION_REPACK);
}
use of games.rednblack.editor.proxy.ProjectManager in project HyperLap2D by rednblackgames.
the class ImagesPackDialogMediator method handleNotification.
@Override
public void handleNotification(INotification notification) {
Sandbox sandbox = Sandbox.getInstance();
UIStage uiStage = sandbox.getUIStage();
ProjectManager projectManager = facade.retrieveProxy(ProjectManager.NAME);
String currentTab;
switch(notification.getName()) {
case ResourcesMenu.OPEN_IMAGES_PACK:
viewComponent.show(uiStage);
break;
case ProjectManager.PROJECT_DATA_UPDATED:
case DeleteImageResource.DONE:
case DeleteSpineAnimation.DONE:
case DeleteSpriteAnimation.DONE:
viewComponent.updateMainPack(projectManager.currentProjectInfoVO.imagesPacks.get("main").regions);
currentTab = viewComponent.getSelectedTab();
if (currentTab != null)
viewComponent.updateCurrentPack(projectManager.currentProjectInfoVO.imagesPacks.get(currentTab).regions);
else
viewComponent.clearCurrentPack();
break;
case MsgAPI.UPDATE_ATLAS_PACK_LIST:
case ProjectManager.PROJECT_OPENED:
viewComponent.initPacks(projectManager.currentProjectInfoVO.imagesPacks.keySet());
viewComponent.updateMainPack(projectManager.currentProjectInfoVO.imagesPacks.get("main").regions);
if (viewComponent.getSelectedTab() == null)
viewComponent.clearCurrentPack();
break;
case NEW_IMAGES_PACK:
TexturePackVO newVo = new TexturePackVO();
newVo.name = notification.getBody();
projectManager.currentProjectInfoVO.imagesPacks.put(newVo.name, newVo);
viewComponent.addNewPack(newVo.name);
projectManager.saveCurrentProject();
break;
case UPDATE_CURRENT_LIST:
currentTab = viewComponent.getSelectedTab();
if (currentTab != null)
viewComponent.updateCurrentPack(projectManager.currentProjectInfoVO.imagesPacks.get(currentTab).regions);
break;
case MOVE_REGION_TO_PACK:
String toPack = viewComponent.getMainSelected().size > 0 ? viewComponent.getSelectedTab() : "main";
String fromPack = viewComponent.getMainSelected().size == 0 ? viewComponent.getSelectedTab() : "main";
Array<String> regions = viewComponent.getMainSelected().size > 0 ? viewComponent.getMainSelected() : viewComponent.getCurrentSelected();
for (String region : regions) {
projectManager.currentProjectInfoVO.imagesPacks.get(fromPack).regions.remove(region);
projectManager.currentProjectInfoVO.imagesPacks.get(toPack).regions.add(region);
}
viewComponent.updateCurrentPack(projectManager.currentProjectInfoVO.imagesPacks.get(viewComponent.getSelectedTab()).regions);
viewComponent.updateMainPack(projectManager.currentProjectInfoVO.imagesPacks.get("main").regions);
projectManager.saveCurrentProject();
break;
case REMOVE_PACK:
String packToRemove = notification.getBody();
projectManager.currentProjectInfoVO.imagesPacks.get("main").regions.addAll(projectManager.currentProjectInfoVO.imagesPacks.get(packToRemove).regions);
projectManager.currentProjectInfoVO.imagesPacks.remove(packToRemove);
viewComponent.updateMainPack(projectManager.currentProjectInfoVO.imagesPacks.get("main").regions);
viewComponent.clearCurrentPack();
projectManager.saveCurrentProject();
break;
}
}
use of games.rednblack.editor.proxy.ProjectManager in project HyperLap2D by rednblackgames.
the class UIActionsTabMediator method initList.
@Override
protected void initList(String searchText) {
searchText = searchText.toLowerCase();
ProjectManager projectManager = HyperLap2DFacade.getInstance().retrieveProxy(ProjectManager.NAME);
HashMap<String, GraphVO> items = projectManager.currentProjectInfoVO.libraryActions;
itemArray.clear();
for (String key : items.keySet()) {
if (!key.toLowerCase().contains(searchText))
continue;
DraggableResource draggableResource = new DraggableResource(new LibraryActionResource(key));
itemArray.add(draggableResource);
}
itemArray.sort();
viewComponent.setItems(itemArray);
}
use of games.rednblack.editor.proxy.ProjectManager in project HyperLap2D by rednblackgames.
the class HyperLap2DScreen method updateCameraPosition.
private void updateCameraPosition() {
ProjectManager projectManager = HyperLap2DFacade.getInstance().retrieveProxy(ProjectManager.NAME);
SceneConfigVO sceneConfigVO = projectManager.getCurrentSceneConfigVO();
if (sceneConfigVO != null)
sandbox.getCamera().position.set(sceneConfigVO.cameraPosition[0], sceneConfigVO.cameraPosition[1], 0);
}
use of games.rednblack.editor.proxy.ProjectManager in project HyperLap2D by rednblackgames.
the class HyperLap2DScreenMediator method handleNotification.
@Override
public void handleNotification(INotification notification) {
super.handleNotification(notification);
switch(notification.getName()) {
case MsgAPI.CREATE:
setViewComponent(new HyperLap2DScreen());
// TODO this must be changed to Command
facade = HyperLap2DFacade.getInstance();
SandboxMediator sandboxMediator = facade.retrieveMediator(SandboxMediator.NAME);
com.artemis.World engine = sandboxMediator.getViewComponent().getEngine();
getViewComponent().setEngine(engine);
viewComponent.show();
break;
case MsgAPI.SCENE_LOADED:
facade = HyperLap2DFacade.getInstance();
SandboxBackUI sandboxBackUI = new SandboxBackUI(Sandbox.getInstance().getUIStage().getBatch());
getViewComponent().setBackUI(sandboxBackUI);
getViewComponent().disableDrawingBgLogo();
break;
case MsgAPI.PAUSE:
viewComponent.pause();
break;
case MsgAPI.RESUME:
viewComponent.resume();
break;
case MsgAPI.RENDER:
viewComponent.render(notification.getBody());
break;
case MsgAPI.RESIZE:
int[] data = notification.getBody();
viewComponent.resize(data[0], data[1]);
break;
case MsgAPI.DISPOSE:
ProjectManager projectManager = facade.retrieveProxy(ProjectManager.NAME);
projectManager.stopFileWatcher();
break;
case MsgAPI.SAVE_EDITOR_CONFIG:
SettingsManager settingsManager = facade.retrieveProxy(SettingsManager.NAME);
settingsManager.saveEditorConfig();
getViewComponent().updateActorSize();
break;
case MsgAPI.SHOW_BLACK_OVERLAY:
viewComponent.showBlackOverlay();
break;
case MsgAPI.HIDE_BLACK_OVERLAY:
viewComponent.hideBlackOverlay();
break;
}
}
Aggregations