コード例 #1
0
ファイル: StateNodeView.cs プロジェクト: hagusen/AI-Testing
 public override void InitializeEdge()
 {
     foreach (var port in outputPorts)
     {
         if (port.orientation == Orientation.Vertical && !port.enabledSelf)
         {
             TransitionView transition = port.GetValue() as TransitionView;
             if (transition != null)
             {
                 EdgeView edge = new EdgeView(transition.input, port);
                 owner.Connect(edge, false);
                 edge.SetEnabled(false);
             }
         }
     }
 }
コード例 #2
0
        SnapToPortResult GetSnapToPortResult(EdgeView edge, UNodeView selectedNode)
        {
            PortView sourcePort    = null;
            PortView snappablePort = null;

            if (edge.Output.owner == selectedNode)
            {
                sourcePort    = edge.Output;
                snappablePort = edge.Input;
            }
            else if (edge.Input.owner == selectedNode)
            {
                sourcePort    = edge.Input;
                snappablePort = edge.Output;
            }

            // We don't want to snap non existing ports and ports with different orientations (to be determined)
            if (sourcePort == null || snappablePort == null || sourcePort.orientation != snappablePort.orientation)
            {
                return(null);
            }

            float offset;

            if (snappablePort.orientation == Orientation.Horizontal)
            {
                offset = m_ConnectedPortsPos[sourcePort].y - m_ConnectedPortsPos[snappablePort].y;
            }
            else
            {
                offset = m_ConnectedPortsPos[sourcePort].x - m_ConnectedPortsPos[snappablePort].x;
            }

            SnapToPortResult minResult = new SnapToPortResult {
                PortOrientation = snappablePort.orientation,
                Offset          = offset
            };

            return(minResult);
        }
コード例 #3
0
ファイル: BlockView.cs プロジェクト: hagusen/AI-Testing
 public void InitializeEdge()
 {
     base.expanded = true;
     for (int i = 0; i < portViews.Count; i++)
     {
         var view = portViews[i];
         var val  = view.GetValue();
         if (val is MemberData)
         {
             MemberData member = val as MemberData;
             if (member.isAssigned && member.IsTargetingPinOrNode)
             {
                 EdgeView edge = new EdgeView(view, PortUtility.GetOutputPort(member, owner.nodeView.owner));
                 owner.nodeView.owner.Connect(edge, false);
             }
         }
         else if (val is MultipurposeMember)
         {
         }
     }
     expanded = data.expanded;
     RefreshPorts();
 }