Search in sources :

Example 1 with ProjectManager

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);
}
Also used : FileHandle(com.badlogic.gdx.files.FileHandle) Pixmap(com.badlogic.gdx.graphics.Pixmap) ProjectManager(games.rednblack.editor.proxy.ProjectManager)

Example 2 with ProjectManager

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;
    }
}
Also used : UIStage(games.rednblack.editor.view.stage.UIStage) TexturePackVO(games.rednblack.editor.renderer.data.TexturePackVO) Sandbox(games.rednblack.editor.view.stage.Sandbox) ProjectManager(games.rednblack.editor.proxy.ProjectManager)

Example 3 with ProjectManager

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);
}
Also used : LibraryActionResource(games.rednblack.editor.view.ui.box.resourcespanel.draggable.list.LibraryActionResource) DraggableResource(games.rednblack.editor.view.ui.box.resourcespanel.draggable.DraggableResource) GraphVO(games.rednblack.editor.renderer.data.GraphVO) ProjectManager(games.rednblack.editor.proxy.ProjectManager)

Example 4 with ProjectManager

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);
}
Also used : SceneConfigVO(games.rednblack.h2d.common.vo.SceneConfigVO) ProjectManager(games.rednblack.editor.proxy.ProjectManager)

Example 5 with ProjectManager

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;
    }
}
Also used : SettingsManager(games.rednblack.editor.proxy.SettingsManager) SandboxBackUI(games.rednblack.editor.view.ui.widget.actors.basic.SandboxBackUI) SandboxMediator(games.rednblack.editor.view.stage.SandboxMediator) ProjectManager(games.rednblack.editor.proxy.ProjectManager)

Aggregations

ProjectManager (games.rednblack.editor.proxy.ProjectManager)20 MainItemComponent (games.rednblack.editor.renderer.components.MainItemComponent)4 CompositeItemVO (games.rednblack.editor.renderer.data.CompositeItemVO)4 Sandbox (games.rednblack.editor.view.stage.Sandbox)4 UIStage (games.rednblack.editor.view.stage.UIStage)4 GraphVO (games.rednblack.editor.renderer.data.GraphVO)3 DraggableResource (games.rednblack.editor.view.ui.box.resourcespanel.draggable.DraggableResource)3 FileHandle (com.badlogic.gdx.files.FileHandle)2 Pixmap (com.badlogic.gdx.graphics.Pixmap)2 TexturePackVO (games.rednblack.editor.renderer.data.TexturePackVO)2 Color (com.badlogic.gdx.graphics.Color)1 TextureAtlas (com.badlogic.gdx.graphics.g2d.TextureAtlas)1 Json (com.badlogic.gdx.utils.Json)1 InputDialogListener (com.kotcrab.vis.ui.util.dialog.InputDialogListener)1 HyperLap2DFacade (games.rednblack.editor.HyperLap2DFacade)1 DeleteImageResource (games.rednblack.editor.controller.commands.resource.DeleteImageResource)1 ActionFieldType (games.rednblack.editor.graph.actions.ActionFieldType)1 ResolutionManager (games.rednblack.editor.proxy.ResolutionManager)1 ResourceManager (games.rednblack.editor.proxy.ResourceManager)1 SettingsManager (games.rednblack.editor.proxy.SettingsManager)1