Ejemplo n.º 1
0
    public override void OnBodyGUI()
    {
        EditorGUIUtility.labelWidth = 350;
        base.OnBodyGUI();

        //End the current GUI Area that is restricted to node's dimensions
        GUILayout.EndArea();

        //Show Label Above node
        Vector2 nodeLabelPos = NodeEditorWindow.current.GridToWindowPositionNoClipped(target.position +
                                                                                      new Vector2(0f, -60f));
        StateNode nodeAsState = target as StateNode;

        NodeEditorPreferences.Settings prefs = NodeEditorPreferences.GetSettings();
        GUIStyle labelStyle = XNodeUtils.ZoomBasedStyle(35f, 85f, NodeEditorWindow.current.zoom,
                                                        prefs.minZoom, prefs.maxZoom, new Color(.85f, .85f, 1f), FontStyle.Bold, TextAnchor.LowerCenter, false);

        GUI.Label(new Rect(nodeLabelPos, new Vector2(GetWidth(), 50f)), nodeAsState.GetName(),
                  labelStyle);

        //Put back the GUI area that is restricted to node's dimensions
        Vector2 nodePos = NodeEditorWindow.current.GridToWindowPositionNoClipped(target.position);

        GUILayout.BeginArea(new Rect(nodePos, new Vector2(GetWidth(), 4000)));
    }