Ejemplo n.º 1
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        //ENode oc = property.serializedObject.targetObject as ENode;
        EEdge connection = EEditorUtility.GetParent(property) as EEdge;

        label = EditorGUI.BeginProperty(position, GUIContent.none, property);

        float original = position.width;

        position.width  *= 0.3f;
        position.height /= 2;

        EditorGUIUtility.labelWidth = 80.0f;
        EditorGUI.BeginChangeCheck();
        EditorGUI.PropertyField(position, property.FindPropertyRelative("Source"), new GUIContent("Source"));
        if (EditorGUI.EndChangeCheck())
        {
            property.serializedObject.ApplyModifiedProperties();
            connection.SetSource(connection.Source);
            GameMessage.Send <EEdgesRedrawAll>(message);
        }

        position.y += position.height;
        EditorGUI.BeginChangeCheck();
        EditorGUI.PropertyField(position, property.FindPropertyRelative("Target"), new GUIContent("Target"));
        if (EditorGUI.EndChangeCheck())
        {
            property.serializedObject.ApplyModifiedProperties();
            connection.SetTarget(connection.Target);
            GameMessage.Send <EEdgesRedrawAll>(message);
        }
        position.y -= position.height;

        position.x     = position.width;
        position.width = original - position.width;
        EditorGUI.PropertyField(position, property.FindPropertyRelative("SourceFormula"), new GUIContent("Formula"));

        position.y += position.height;
        EditorGUI.PropertyField(position, property.FindPropertyRelative("TargetFormula"), new GUIContent("Formula"));

        Handles.BeginGUI();
        Handles.color = Color.red;
        Handles.DrawLine(new Vector3(0, position.y + 19f), new Vector3(original, position.y + 19f));
        Handles.EndGUI();

        EditorGUI.EndProperty();
    }
Ejemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        ENode oc = (ENode)target;

        serializedObject.Update();
        GUIContent addButtonContent = new GUIContent("PROCESS");

        if (GUILayout.Button(addButtonContent, EditorStyles.miniButton))
        {
            oc.Process();
        }

        EditorGUILayout.PropertyField(serializedObject.FindProperty("_AutoTrigger"));
        EditorGUILayout.PropertyField(serializedObject.FindProperty("_Name"));
        EditorGUILayout.PropertyField(serializedObject.FindProperty("_Value"));
        EditorGUILayout.PropertyField(serializedObject.FindProperty("_Delta"));
        EditorGUILayout.PropertyField(serializedObject.FindProperty("_MinValue"));
        EditorGUILayout.PropertyField(serializedObject.FindProperty("_MaxValue"));
        EEditorUtility.Show(serializedObject.FindProperty("_SourceConnections"), EEditorUtilityOptions.Buttons | EEditorUtilityOptions.ListLabel);
        EEditorUtility.Show(serializedObject.FindProperty("_TargetConnections"), EEditorUtilityOptions.Buttons | EEditorUtilityOptions.ListLabel);
        //DrawDefaultInspector();

        serializedObject.ApplyModifiedProperties();
    }