Пример #1
0
 public void GUIDrawEdges()
 {
     foreach (AbstractSocket socket in this.Sockets)
     {
         if (socket.IsInput()) // draw only input sockets to avoid double drawing of edges
         {
             InputSocket inputSocket = (InputSocket)socket;
             if (inputSocket.IsConnected())
             {
                 inputSocket.Connection.Draw();
             }
         }
     }
 }
Пример #2
0
        /// <summary>Unlinkes the assigned sockets. Triggeres 'Unlink' events.</summary>
        public void UnLink(InputSocket inputSocket, OutputSocket outputSocket)
        {
            if ((inputSocket == null) || (outputSocket == null) || !inputSocket.IsConnected() ||
                !outputSocket.IsConnected())
            {
                return;
            }
            if (!this.AreConected(inputSocket, outputSocket))
            {
                return;
            }

            if (this.TriggerEvents)
            {
                EventManager.TriggerOnUnLinkSockets(this, inputSocket, outputSocket);
            }

            var outEnc = outputSocket.Parent as EncounterNodeBase;
            var inEnc  = inputSocket.Parent as EncounterNodeBase;

            outEnc.Encounter.Outputs.Remove(inEnc.Encounter.Id);

            int index = outputSocket.Connections.IndexOf(inputSocket.Connection);

            if (index > -1)
            {
                outputSocket.Connections[index].Input  = null;
                outputSocket.Connections[index].Output = null;
                outputSocket.Connections.RemoveAt(index);
            }

            inputSocket.Connection.Input  = null;
            inputSocket.Connection.Output = null;
            inputSocket.Connection        = null;

            if (this.TriggerEvents)
            {
                EventManager.TriggerOnUnLinkedSockets(this, inputSocket, outputSocket);
            }
        }