Esempio n. 1
0
        /// <summary>
        /// Removes the script node from the state. Also removes all its connections.
        /// </summary>
        public override void Remove()
        {
            // remove all connections
            foreach (BaseNode baseNode in State.Nodes)
            {
                Node node = baseNode as Node;
                if (node != null)
                {
                    foreach (NodeSocket nodeSocket in node.Sockets)
                    {
                        SignalNodeSocket signalNodeSocket = nodeSocket as SignalNodeSocket;
                        if (signalNodeSocket != null)
                        {
                            for (int i = 0; i < signalNodeSocket.Connections.Count; ++i)
                            {
                                if (signalNodeSocket.Connections[i].Node == this)
                                {
                                    signalNodeSocket.Connections.RemoveAt(i);
                                    --i;
                                }
                            }
                        }
                    }
                }
            }

            base.Remove();
        }
Esempio n. 2
0
        /// <summary>
        /// Adds the specified signal out node socket.
        /// </summary>
        /// <param name="signalNodeSocket">The signal out node socket.</param>
        /// <exception cref="ArgumentException">Argument is not signal out node socket.</exception>
        public void AddOutSocket(SignalNodeSocket signalNodeSocket)
        {
            if (signalNodeSocket.Type != NodeSocketType.SignalOut)
            {
                throw new ArgumentException("Argument is not signal out node socket.");
            }

            outSockets.Add(new SignalOutNodeSocketView(this, signalNodeSocket));

            UpdateGui();
        }
Esempio n. 3
0
        /// <summary>
        /// Adds the specified signal in node socket.
        /// </summary>
        /// <param name="signalNodeSocket">The signal in node socket.</param>
        /// <exception cref="ArgumentException">Argument is not signal in node socket.</exception>
        public void AddInSocket(SignalNodeSocket signalNodeSocket)
        {
            if (signalNodeSocket.Type != NodeSocketType.SignalIn)
            {
                throw new ArgumentException("Argument is not signal in node socket.");
            }

            inSockets.Add(new SignalInNodeSocketView(this, signalNodeSocket));

            UpdateGui();
        }
Esempio n. 4
0
        /// <summary>
        /// Creates the sockets defined at the <see cref="NodeData"/>.
        /// </summary>
        protected void CreateSockets()
        {
            _sockets = new NodeSocket[NodeData.Sockets.Count];

            for (int i = 0; i < NodeData.Sockets.Count; ++i)
            {
                if (NodeData.Sockets[i].Type == NodeSocketType.SignalIn || NodeData.Sockets[i].Type == NodeSocketType.SignalOut)
                {
                    _sockets[i] = new SignalNodeSocket(this, NodeData.Sockets[i]);
                }
                else
                {
                    _sockets[i] = new VariableNodeSocket(this, NodeData.Sockets[i]);
                }
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SignalOutNodeSocketView"/> class.
 /// </summary>
 /// <param name="scriptNode">The view of the script node where the view of the node socket will be used.</param>
 /// <param name="signalNodeSocket">The signal node socket.</param>
 public SignalOutNodeSocketView(NodeView scriptNode, SignalNodeSocket signalNodeSocket)
     : base(scriptNode, signalNodeSocket)
 {
     _signalNodeSocket = signalNodeSocket;
 }