Ejemplo n.º 1
0
 public DiagramWindowNode(int index, DiagramNode node, SerializedProperty nodeSP, DiagramWindow window)
 {
     this.index             = index;
     this.node              = node;
     this.nodeSP            = nodeSP;
     this.window            = window;
     propertyNameLabelWidth = 0f;
     nodeNameLabelWidth     = GUI.skin.label.CalcSize(new GUIContent(node.Name)).x;
     nodeRect.width         = nodeNameLabelWidth;
     for (int i = 0, l = node.PropertyCount; i < l; i++)
     {
         float labelWidth = GUI.skin.label.CalcSize(new GUIContent(node.GetPropertyName(i))).x;
         if (labelWidth > nodeRect.width)
         {
             nodeRect.width = labelWidth;
         }
         if (labelWidth > propertyNameLabelWidth)
         {
             propertyNameLabelWidth = labelWidth;
         }
     }
     nodeRect.width += DOUBLE_PADDING;
     if (node.Function == null || node.Function.type != FunctionType.Input)
     {
         nodeRect.height = Mathf.Max(1, node.PropertyCount) * CONNECTOR_OFFSET_Y + 22f;
     }
     else
     {
         nodeRect.height = CONNECTOR_OFFSET_Y + 22f;
     }
     nodeRect.x = node.position.x;
     nodeRect.y = node.position.y;
 }
Ejemplo n.º 2
0
        public DiagramWindowOutputNode(int index, DiagramNode node, SerializedProperty nodeSP, DiagramWindow window) :
            base(index, node, nodeSP, window)
        {
            DiagramOutput[] outputs = (nodeSP.serializedObject.targetObject as Diagram).outputs;
            if (outputs != null)
            {
                for (int i = 0; i < outputs.Length; i++)
                {
                    if (outputs[i].nodeIndex == index)
                    {
                        outputSP = nodeSP.serializedObject.FindProperty("outputs").GetArrayElementAtIndex(i);
                        output   = outputs[i];
                        FindSerializedProperties();
                        break;
                    }
                }
            }

            nodeRect.width = 100f;
        }