Esempio n. 1
0
    public override void OnGUI(Rect rect, SerializedProperty prop, GUIContent label)
    {
        RXDivider att = attribute as RXDivider;

        float headerHeight = 10.0f;

        if (att.header != "")
        {
            headerHeight += 40.0f;
        }

        if (att.subtitle != "")
        {
            headerHeight += 16.0f;
        }

        rect.y += headerHeight;
        DrawDefaultProperty(rect, prop, label, true);
        rect.y -= headerHeight;

        if (att.header != "")
        {
            rect.y += 20.0f;

            //TITLE

            GUIStyle headerStyle = new GUIStyle(GUI.skin.label);
            headerStyle.fontSize  = 15;
            headerStyle.fontStyle = FontStyle.Bold;

            EditorGUI.LabelField(rect, att.header, headerStyle);

            rect.y += 17.0f;
        }

        //SUBTITLE
        if (att.subtitle != "")
        {
            GUIStyle subtitleStyle = new GUIStyle(GUI.skin.label);
            subtitleStyle.fontSize = 10;
            //subtitleStyle.fontStyle = FontStyle.Italic;

            EditorGUI.LabelField(rect, att.subtitle, subtitleStyle);

            rect.y += 12.0f;
        }

        if (Event.current.type == EventType.Repaint)        //draw the divider
        {
            rect.x      = 14.0f;
            rect.y     += 5.0f;
            rect.height = 1.0f;
            rect.width -= 14.0f;

            GUI.skin.box.Draw(rect, GUIContent.none, 0);
        }
    }
Esempio n. 2
0
    public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
    {
        RXDivider att = attribute as RXDivider;

        float headerHeight = 10.0f;

        if (att.header != "")
        {
            headerHeight += 40.0f;
        }

        if (att.subtitle != "")
        {
            headerHeight += 16.0f;
        }

        return(base.GetPropertyHeight(prop, label) + headerHeight);
    }