Beispiel #1
0
        public static JSONObject Serialize(this IOConnection conn)
        {
            var connJs = new JSONObject(JSONObject.Type.OBJECT);

            connJs.AddField("From", conn.From.GUID);
            connJs.AddField("Output", conn.Output.Name);
            connJs.AddField("To", conn.To.GUID);
            connJs.AddField("Input", conn.Input.Name);
            return(connJs);
        }
Beispiel #2
0
        private int CompareConnectionPriority(IOConnection a, IOConnection b)
        {
            int priorityA = _connectionPriorities[a];
            int priorityB = _connectionPriorities[b];

            if (priorityA < priorityB)
            {
                return(-1);
            }
            else if (priorityA > priorityB)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
Beispiel #3
0
 private int GetPriority(IOConnection conn)
 {
     if (_connectionPriorities.ContainsKey(conn))
     {
         return(_connectionPriorities[conn]);
     }
     else
     {
         var priority = 0;
         foreach (var input in conn.From.Inputs)
         {
             IOConnection[] conns = ConnectionsTo(conn.From, input);
             foreach (var prior in conns)
             {
                 priority++;
                 priority += GetPriority(prior);
             }
         }
         _connectionPriorities.Add(conn, priority);
         return(priority);
     }
 }
Beispiel #4
0
 public void MoveConnection(IOConnection conn, int newIndex)
 {
     Connections.Remove(conn);
     Connections.Insert(newIndex, conn);
     CommitChanges();
 }
Beispiel #5
0
 public void Disconnect(IOConnection conn)
 {
     Connections.Remove(conn);
     CommitChanges();
 }