use of games.rednblack.editor.renderer.data.GraphVO 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.renderer.data.GraphVO in project HyperLap2D by rednblackgames.
the class HyperLap2DActionAsset method importAsset.
@Override
public void importAsset(Array<FileHandle> files, ProgressHandler progressHandler, boolean skipRepack) {
for (FileHandle fileHandle : new Array.ArrayIterator<>(files)) {
GraphVO action = json.fromJson(GraphVO.class, fileHandle);
projectManager.getCurrentProjectInfoVO().libraryActions.put(fileHandle.nameWithoutExtension(), action);
projectManager.saveCurrentProject();
}
}
use of games.rednblack.editor.renderer.data.GraphVO in project HyperLap2D by rednblackgames.
the class AddToLibraryAction method doAction.
@Override
public void doAction() {
Object[] payload = notification.getBody();
String key = (String) payload[0];
GraphVO data = (GraphVO) payload[1];
libraryActions.put(key, data);
HyperLap2DFacade.getInstance().sendNotification(MsgAPI.LIBRARY_ACTIONS_UPDATED);
}
use of games.rednblack.editor.renderer.data.GraphVO in project HyperLap2D by rednblackgames.
the class GraphContainer method serializeGraph.
public GraphVO serializeGraph() {
GraphVO graph = new GraphVO();
graph.version = 1;
Vector2 tmp = new Vector2();
getCanvasPosition(tmp);
for (GraphBox<T> graphBox : getGraphBoxes()) {
Window window = getBoxWindow(graphBox.getId());
GraphNodeVO object = new GraphNodeVO();
object.id = graphBox.getId();
object.type = graphBox.getType();
object.x = tmp.x + window.getX();
object.y = tmp.y + window.getY();
HashMap<String, String> data = graphBox.getData();
if (data != null)
object.data = data;
graph.nodes.add(object);
}
for (GraphConnection connection : getConnections()) {
GraphConnectionVO conn = new GraphConnectionVO();
conn.fromNode = connection.getNodeFrom();
conn.fromField = connection.getFieldFrom();
conn.toNode = connection.getNodeTo();
conn.toField = connection.getFieldTo();
graph.connections.add(conn);
}
for (NodeGroup nodeGroup : getNodeGroups()) {
GraphGroupVO group = new GraphGroupVO();
group.name = nodeGroup.getName();
group.nodes.addAll(nodeGroup.getNodeIds());
graph.groups.add(group);
}
return graph;
}
use of games.rednblack.editor.renderer.data.GraphVO in project HyperLap2D by rednblackgames.
the class DuplicateLibraryAction method doAction.
@Override
public void doAction() {
String libraryActionName = notification.getBody();
ProjectManager projectManager = HyperLap2DFacade.getInstance().retrieveProxy(ProjectManager.NAME);
HashMap<String, GraphVO> libraryActions = projectManager.currentProjectInfoVO.libraryActions;
GraphVO actionToDuplicate = libraryActions.get(libraryActionName);
Dialogs.showInputDialog(Sandbox.getInstance().getUIStage(), "Duplicate " + libraryActionName, "New name : ", false, new StringNameValidator(), new InputDialogListener() {
@Override
public void finished(String input) {
if (input == null || input.equals("")) {
return;
}
Json json = HyperJson.getJson();
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);
}
@Override
public void canceled() {
cancel();
}
});
}
Aggregations