Exemplo n.º 1
0
        public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
        {
            var height = (float)kFoldoutHeight;

            if (property.isExpanded)
            {
                if (m_BindingListView == null)
                {
                    m_BindingListView = new InputBindingListView(property);
                }
                height += m_BindingListView.GetHeight();
            }

            return(height);
        }
Exemplo n.º 2
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EditorGUI.BeginProperty(position, label, property);

            // If the action has no name, infer it from the name of the action property.
            SetActionNameIfNotSet(property);

            var foldoutRect = position;

            foldoutRect.height = kFoldoutHeight;

            var nowFoldedOut = EditorGUI.Foldout(foldoutRect, property.isExpanded, label);

            if (nowFoldedOut != property.isExpanded)
            {
                property.isExpanded = nowFoldedOut;

                // Awkwardly force a repaint.
                property.serializedObject.Update();
            }
            else if (property.isExpanded)
            {
                position.y     += kFoldoutHeight + 2;
                position.x     += kBindingIndent;
                position.width -= kBindingIndent;

                if (m_BindingListView == null)
                {
                    m_BindingListView = new InputBindingListView(property);
                }

                m_BindingListView.DoList(position);
            }

            EditorGUI.EndProperty();
        }