コード例 #1
0
        /// <summary>
        /// Draw all properties from begin to end, and return the rect taken up.
        /// </summary>
        private Rect DrawPropertyNestedRange(Rect position, int indentOffset, SerializedProperty begin, SerializedProperty end)
        {
            // Track the top so we know how tall the whole drawn area was
            float top = position.yMin;

            SerializedProperty cur = begin.Copy();

            while (!SerializedProperty.EqualContents(cur, end))
            {
                EditorGUI.indentLevel = cur.depth + indentOffset;
                position.y           += PROPERTY_MARGIN;

                StratusSerializedPropertyHandler curHandler = StratusScriptAttributeUtility.GetHandler(cur);
                position.height = curHandler.GetHeight(cur, StratusEditorUtility.TempContent(cur.displayName), cur.isExpanded);

                EditorGUI.BeginChangeCheck();
                curHandler.OnGUI(position, cur, null, true);
                position.y += position.height;

                if (EditorGUI.EndChangeCheck())
                {
                    break;
                }

                cur.NextVisible(false);
            }

            position.yMin = top;
            return(position);
        }
コード例 #2
0
        /// <summary>
        /// Calculate the height taken up by all properties from begin to end.
        /// </summary>
        private float GetHeightNestedRange(SerializedProperty begin, SerializedProperty end)
        {
            float height = 0f;

            SerializedProperty cur = begin.Copy();

            while (!SerializedProperty.EqualContents(cur, end))
            {
                StratusSerializedPropertyHandler curHandler = StratusScriptAttributeUtility.GetHandler(cur);
                float curHeight = curHandler.GetHeight(cur, StratusEditorUtility.TempContent(cur.displayName), cur.isExpanded);
                height += curHeight + PROPERTY_MARGIN;
                cur.NextVisible(false);
            }

            return(height);
        }