From b7be961b5f17d94c9bde1c7eadb8aa5850457543 Mon Sep 17 00:00:00 2001 From: nakano yosuke Date: Mon, 9 Dec 2019 00:09:19 +0900 Subject: [PATCH] connect ports --- Assets/AsmdefGraph/Editor/AsmdefGraphView.cs | 10 +++++++++- Assets/AsmdefGraph/Editor/AsmdefNode.cs | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Assets/AsmdefGraph/Editor/AsmdefGraphView.cs b/Assets/AsmdefGraph/Editor/AsmdefGraphView.cs index 4522780..b26891d 100644 --- a/Assets/AsmdefGraph/Editor/AsmdefGraphView.cs +++ b/Assets/AsmdefGraph/Editor/AsmdefGraphView.cs @@ -1,9 +1,17 @@ -using UnityEditor.Experimental.GraphView; +using System.Collections.Generic; +using UnityEditor.Experimental.GraphView; +using UnityEngine.UIElements; namespace AsmdefGraph.Editor { public class AsmdefGraphView : GraphView { public AsmdefGraphView() : base() { AddElement(new AsmdefNode()); + AddElement(new AsmdefNode()); + this.AddManipulator(new SelectionDragger()); + } + + public override List GetCompatiblePorts(Port startAnchor, NodeAdapter nodeAdapter) { + return ports.ToList(); } } } diff --git a/Assets/AsmdefGraph/Editor/AsmdefNode.cs b/Assets/AsmdefGraph/Editor/AsmdefNode.cs index d679ce9..de87533 100644 --- a/Assets/AsmdefGraph/Editor/AsmdefNode.cs +++ b/Assets/AsmdefGraph/Editor/AsmdefNode.cs @@ -2,6 +2,14 @@ namespace AsmdefGraph.Editor { public class AsmdefNode : Node { + public AsmdefNode() { + title = "AsmdefNode"; + var inputPort = Port.Create(Orientation.Horizontal, Direction.Input, Port.Capacity.Single, typeof(Port)); + inputContainer.Add(inputPort); + + var outputPort = Port.Create(Orientation.Horizontal, Direction.Output, Port.Capacity.Single, typeof(Port)); + outputContainer.Add(outputPort); + } } }