public OnNodeEvent(EventType type, Node node, Vector2 localMousePos, ConnectionPoint conPoint) { this.eventType = type; this.eventSourceNode = node; this.eventSourceConnectionPoint = conPoint; this.globalMousePosition = new Vector2(localMousePos.x + node.GetX(), localMousePos.y + node.GetY()); }
public void DuplicateNode (Node node) { var newNode = node.DuplicatedNode( nodes.Count, node.GetX() + 10f, node.GetY() + 10f ); switch (newNode.kind) { case AssetGraphSettings.NodeKind.LOADER_GUI: { newNode.AddConnectionPoint(new OutputPoint(AssetGraphSettings.DEFAULT_OUTPUTPOINT_LABEL)); break; } case AssetGraphSettings.NodeKind.FILTER_GUI: { newNode.AddConnectionPoint(new InputPoint(AssetGraphSettings.DEFAULT_INPUTPOINT_LABEL)); foreach (var outputPointLabel in newNode.filterContainsKeywords) { newNode.AddConnectionPoint(new OutputPoint(outputPointLabel)); } break; } case AssetGraphSettings.NodeKind.IMPORTER_GUI: { newNode.AddConnectionPoint(new InputPoint(AssetGraphSettings.DEFAULT_INPUTPOINT_LABEL)); newNode.AddConnectionPoint(new OutputPoint(AssetGraphSettings.DEFAULT_OUTPUTPOINT_LABEL)); break; } case AssetGraphSettings.NodeKind.GROUPING_GUI: { newNode.AddConnectionPoint(new InputPoint(AssetGraphSettings.DEFAULT_INPUTPOINT_LABEL)); newNode.AddConnectionPoint(new OutputPoint(AssetGraphSettings.DEFAULT_OUTPUTPOINT_LABEL)); break; } case AssetGraphSettings.NodeKind.PREFABRICATOR_GUI:{ newNode.AddConnectionPoint(new InputPoint(AssetGraphSettings.DEFAULT_INPUTPOINT_LABEL)); newNode.AddConnectionPoint(new OutputPoint(AssetGraphSettings.DEFAULT_OUTPUTPOINT_LABEL)); break; } case AssetGraphSettings.NodeKind.BUNDLIZER_GUI: { newNode.AddConnectionPoint(new InputPoint(AssetGraphSettings.DEFAULT_INPUTPOINT_LABEL)); newNode.AddConnectionPoint(new OutputPoint(AssetGraphSettings.DEFAULT_OUTPUTPOINT_LABEL)); break; } case AssetGraphSettings.NodeKind.BUNDLEBUILDER_GUI: { newNode.AddConnectionPoint(new InputPoint(AssetGraphSettings.DEFAULT_INPUTPOINT_LABEL)); newNode.AddConnectionPoint(new OutputPoint(AssetGraphSettings.DEFAULT_OUTPUTPOINT_LABEL)); break; } case AssetGraphSettings.NodeKind.EXPORTER_GUI: { newNode.AddConnectionPoint(new InputPoint(AssetGraphSettings.DEFAULT_INPUTPOINT_LABEL)); break; } default: { Debug.LogError("no kind match:" + newNode.kind); break; } } nodes.Add(newNode); }
private static Dictionary<string, object> JsonRepresentationDict (Node node) { var nodeDict = new Dictionary<string, object>(); nodeDict[AssetGraphSettings.NODE_NAME] = node.name; nodeDict[AssetGraphSettings.NODE_ID] = node.nodeId; nodeDict[AssetGraphSettings.NODE_KIND] = node.kind.ToString(); var outputLabels = node.OutputPointLabels(); nodeDict[AssetGraphSettings.NODE_OUTPUT_LABELS] = outputLabels; var posDict = new Dictionary<string, object>(); posDict[AssetGraphSettings.NODE_POS_X] = node.GetX(); posDict[AssetGraphSettings.NODE_POS_Y] = node.GetY(); nodeDict[AssetGraphSettings.NODE_POS] = posDict; switch (node.kind) { case AssetGraphSettings.NodeKind.LOADER_GUI: { nodeDict[AssetGraphSettings.NODE_LOADER_LOAD_PATH] = node.loadPath.ReadonlyDict(); break; } case AssetGraphSettings.NodeKind.EXPORTER_GUI: { nodeDict[AssetGraphSettings.NODE_EXPORTER_EXPORT_PATH] = node.exportPath.ReadonlyDict(); break; } case AssetGraphSettings.NodeKind.FILTER_SCRIPT: case AssetGraphSettings.NodeKind.IMPORTER_SCRIPT: case AssetGraphSettings.NodeKind.PREFABRICATOR_SCRIPT: case AssetGraphSettings.NodeKind.BUNDLIZER_SCRIPT: { nodeDict[AssetGraphSettings.NODE_SCRIPT_TYPE] = node.scriptType; nodeDict[AssetGraphSettings.NODE_SCRIPT_PATH] = node.scriptPath; break; } case AssetGraphSettings.NodeKind.FILTER_GUI: { nodeDict[AssetGraphSettings.NODE_FILTER_CONTAINS_KEYWORDS] = node.filterContainsKeywords; break; } case AssetGraphSettings.NodeKind.IMPORTER_GUI:{ nodeDict[AssetGraphSettings.NODE_IMPORTER_PACKAGES] = node.importerPackages.ReadonlyDict(); break; } case AssetGraphSettings.NodeKind.GROUPING_GUI: { nodeDict[AssetGraphSettings.NODE_GROUPING_KEYWORD] = node.groupingKeyword.ReadonlyDict(); break; } case AssetGraphSettings.NodeKind.PREFABRICATOR_GUI: { nodeDict[AssetGraphSettings.NODE_SCRIPT_TYPE] = node.scriptType; nodeDict[AssetGraphSettings.NODE_SCRIPT_PATH] = node.scriptPath; break; } case AssetGraphSettings.NodeKind.BUNDLIZER_GUI: { nodeDict[AssetGraphSettings.NODE_BUNDLIZER_BUNDLENAME_TEMPLATE] = node.bundleNameTemplate.ReadonlyDict(); break; } case AssetGraphSettings.NodeKind.BUNDLEBUILDER_GUI: { nodeDict[AssetGraphSettings.NODE_BUNDLEBUILDER_ENABLEDBUNDLEOPTIONS] = node.enabledBundleOptions.ReadonlyDict(); break; } default: { Debug.LogError("failed to match:" + node.kind); break; } } return nodeDict; }