Esempio n. 1
0
        protected sealed override void OnControlGUI(Rect position)
        {
            if (layout == EditorLayout.Asset)
            {
                position = LudiqGUI.ExpandPosition(position);
            }

            float innerWidth, innerHeight;

            if (showMeta)
            {
                OnMetaGUI(position);

                if (layout == EditorLayout.Foldout && !foldoutExpanded)
                {
                    return;
                }

                innerWidth  = GetInnerWidth(position.width);
                innerHeight = GetInnerHeight(innerWidth);

                if (innerHeight > 0)
                {
                    y += padding.top;
                }
            }
            else
            {
                innerWidth  = position.width;
                innerHeight = GetInnerHeight(innerWidth);
            }

            var innerPosition = new Rect
                                (
                position.x + ((position.width - innerWidth) / 2),
                y,
                innerWidth,
                innerHeight
                                );

            OnInnerGUI(innerPosition);

            y = innerPosition.yMax;

            var footerWidth  = GetFooterWidth(position.width);
            var footerHeight = GetFooterHeight(footerWidth);

            if (innerHeight > 0 && footerHeight > 0)
            {
                y += padding.bottom;
            }

            var footerPosition = new Rect
                                 (
                position.x + ((position.width - footerWidth) / 2),
                y,
                footerWidth,
                footerHeight
                                 );

            OnFooterGUI(footerPosition);
        }