예제 #1
0
    protected override bool OnCustomInspector()
    {
        dfEditorUtil.DrawSeparator();

        var control = target as dfPanel;

        using (dfEditorUtil.BeginGroup("Appearance"))
        {
            SelectTextureAtlas("Atlas", control, "Atlas", false, true);
            if (control.GUIManager != null && !dfAtlas.Equals(control.Atlas, control.GUIManager.DefaultAtlas))
            {
                EditorGUILayout.HelpBox("This control does not use the same Texture Atlas as the View, which will result in an additional draw call.", MessageType.Info);
            }

            SelectSprite("Background", control.Atlas, control, "BackgroundSprite", false);

            var backgroundColor = EditorGUILayout.ColorField("Back Color", control.BackgroundColor);
            if (backgroundColor != control.BackgroundColor)
            {
                dfEditorUtil.MarkUndo(control, "Change background color");
                control.BackgroundColor = backgroundColor;
            }

            var clientPadding = dfEditorUtil.EditPadding("Padding", control.Padding);
            if (!RectOffset.Equals(clientPadding, control.Padding))
            {
                dfEditorUtil.MarkUndo(control, "Change Client Padding");
                control.Padding = clientPadding;
            }
        }

        return(true);
    }
    public override void OnInspectorGUI()
    {
        var control = target as dfPanelFlowLayout;

        dfEditorUtil.LabelWidth = 110f;

        using (dfEditorUtil.BeginGroup("General"))
        {
            var hideClipped = EditorGUILayout.Toggle("Hide Clipped", control.HideClippedControls);
            if (hideClipped != control.HideClippedControls)
            {
                dfEditorUtil.MarkUndo(control, "Toggle 'Hide Clipped'");
                control.HideClippedControls = hideClipped;
            }

            var padding = dfEditorUtil.EditPadding("Border Padding", control.BorderPadding);
            if (!RectOffset.Equals(padding, control.BorderPadding))
            {
                dfEditorUtil.MarkUndo(control, "Change Border Padding");
                control.BorderPadding = padding;
            }
        }

        using (dfEditorUtil.BeginGroup("Layout"))
        {
            var flowDirection = (dfControlOrientation)EditorGUILayout.EnumPopup("Flow Direction", control.Direction);
            if (flowDirection != control.Direction)
            {
                dfEditorUtil.MarkUndo(control, "Change Flow Direction Property");
                control.Direction = flowDirection;
            }

            var itemPadding = dfEditorUtil.EditInt2("Item Spacing", "Horz", "Vert", control.ItemSpacing);
            if (!Vector2.Equals(itemPadding, control.ItemSpacing))
            {
                dfEditorUtil.MarkUndo(control, "Change Layout Spacing");
                control.ItemSpacing = itemPadding;
            }

            var sizeLabel     = control.Direction == dfControlOrientation.Horizontal ? "Max Width" : "Max Height";
            var maxLayoutSize = EditorGUILayout.IntField(sizeLabel, control.MaxLayoutSize);
            if (maxLayoutSize != control.MaxLayoutSize)
            {
                dfEditorUtil.MarkUndo(control, "Change " + sizeLabel);
                control.MaxLayoutSize = maxLayoutSize;
            }

            if (GUILayout.Button("Force Update"))
            {
                control.PerformLayout();
            }
        }

        using (dfEditorUtil.BeginGroup("Excluded controls"))
        {
            editExcludedControls(control);
        }
    }
예제 #3
0
    protected override bool OnCustomInspector()
    {
        dfEditorUtil.DrawSeparator();

        if (!isFoldoutExpanded(foldouts, "Tab Page Properties", true))
        {
            return(false);
        }

        var control = target as dfTabContainer;

        dfEditorUtil.LabelWidth = 110f;

        using (dfEditorUtil.BeginGroup("Appearance"))
        {
            SelectTextureAtlas("Atlas", control, "Atlas", false, false);
            if (control.GUIManager != null && !dfAtlas.Equals(control.Atlas, control.GUIManager.DefaultAtlas))
            {
                EditorGUILayout.HelpBox("This control does not use the same Texture Atlas as the View, which will result in an additional draw call.", MessageType.Info);
            }

            SelectSprite("Background", control.Atlas, control, "BackgroundSprite", false);
        }

        using (dfEditorUtil.BeginGroup("Tab Pages"))
        {
            var tabCount      = control.Controls.Count;
            var selectedIndex = EditorGUILayout.IntSlider("Selected Tab", control.SelectedIndex, 0, tabCount - 1);
            if (selectedIndex != control.SelectedIndex)
            {
                dfEditorUtil.MarkUndo(control, "Change Selected Tab");
                control.SelectedIndex = selectedIndex;
            }

            if (GUILayout.Button("Add Tab Page"))
            {
                dfEditorUtil.MarkUndo(control, "Add Tab Page");
                Selection.activeGameObject = control.AddTabPage().gameObject;
            }
        }

        using (dfEditorUtil.BeginGroup("Layout"))
        {
            var flowPadding = dfEditorUtil.EditPadding("Padding", control.Padding);
            if (!RectOffset.Equals(flowPadding, control.Padding))
            {
                dfEditorUtil.MarkUndo(control, "Change Padding");
                control.Padding = flowPadding;
            }
        }

        return(true);
    }
예제 #4
0
    protected override bool OnCustomInspector()
    {
        var control = target as dfSlider;

        if (control == null)
        {
            return(false);
        }

        dfEditorUtil.DrawSeparator();

        if (!isFoldoutExpanded(foldouts, "Slider Properties", true))
        {
            return(false);
        }

        dfEditorUtil.LabelWidth = 100f;

        using (dfEditorUtil.BeginGroup("Appearance"))
        {
            SelectTextureAtlas("Atlas", control, "Atlas", false, true);
            SelectSprite("Track", control.Atlas, control, "BackgroundSprite", false);

            var backgroundColor = EditorGUILayout.ColorField("Back color", control.Color);
            if (backgroundColor != control.Color)
            {
                dfEditorUtil.MarkUndo(control, "Change Background Color");
                control.Color = backgroundColor;
            }

            var orientation = (dfControlOrientation)EditorGUILayout.EnumPopup("Orientation", control.Orientation);
            if (orientation != control.Orientation)
            {
                dfEditorUtil.MarkUndo(control, "Change Orientation");
                control.Orientation = orientation;
            }
        }

        using (dfEditorUtil.BeginGroup("Behavior"))
        {
            var rtl = EditorGUILayout.Toggle("Right to Left", control.RightToLeft);
            if (rtl != control.RightToLeft)
            {
                dfEditorUtil.MarkUndo(control, "Switch Right To Left");
                control.RightToLeft = rtl;
            }

            var min = EditorGUILayout.FloatField("Min Value", control.MinValue);
            if (min != control.MinValue)
            {
                dfEditorUtil.MarkUndo(control, "Change Minimum Value");
                control.MinValue = min;
            }

            var max = EditorGUILayout.FloatField("Max Value", control.MaxValue);
            if (max != control.MaxValue)
            {
                dfEditorUtil.MarkUndo(control, "Change Maximum Value");
                control.MaxValue = max;
            }

            var step = EditorGUILayout.FloatField("Step", control.StepSize);
            if (step != control.StepSize)
            {
                dfEditorUtil.MarkUndo(control, "Change Step");
                control.StepSize = step;
            }

            var scroll = EditorGUILayout.FloatField("Scroll Size", control.ScrollSize);
            if (scroll != control.ScrollSize)
            {
                dfEditorUtil.MarkUndo(control, "Change Scroll Increment");
                control.ScrollSize = scroll;
            }

            var value = EditorGUILayout.Slider("Value", control.Value, control.MinValue, control.MaxValue);
            if (value != control.Value)
            {
                dfEditorUtil.MarkUndo(control, "Change Slider Value");
                control.Value = value;
            }
        }

        using (dfEditorUtil.BeginGroup("Controls"))
        {
            var thumb = EditorGUILayout.ObjectField("Thumb", control.Thumb, typeof(dfControl), true) as dfControl;
            if (thumb != control.Thumb)
            {
                if (thumb == null || thumb.transform.IsChildOf(control.transform))
                {
                    dfEditorUtil.MarkUndo(control, "Assign Thumb Object");
                    control.Thumb = thumb;
                }
                else
                {
                    EditorUtility.DisplayDialog("Invalid Control", "You can only assign controls to this property that are a child of the " + control.name + " control", "OK");
                }
            }

            if (thumb != null)
            {
                var thumbPadding = dfEditorUtil.EditInt2("Offset", "X", "Y", control.ThumbOffset);
                if (!RectOffset.Equals(thumbPadding, control.ThumbOffset))
                {
                    dfEditorUtil.MarkUndo(control, "Change thumb Offset");
                    control.ThumbOffset = thumbPadding;
                }
            }

            var fill = EditorGUILayout.ObjectField("Progress", control.Progress, typeof(dfControl), true) as dfControl;
            if (fill != control.Progress)
            {
                if (fill == null || fill.transform.IsChildOf(control.transform))
                {
                    dfEditorUtil.MarkUndo(control, "Assign Thumb Object");
                    control.Progress = fill;
                }
                else
                {
                    EditorUtility.DisplayDialog("Invalid Control", "You can only assign controls to this property that are a child of the " + control.name + " control", "OK");
                }
            }

            if (fill != null)
            {
                if (fill is dfSprite)
                {
                    var mode = (dfProgressFillMode)EditorGUILayout.EnumPopup("Fill Mode", control.FillMode);
                    if (mode != control.FillMode)
                    {
                        dfEditorUtil.MarkUndo(control, "Change Fill Mode");
                        control.FillMode = mode;
                    }
                }

                var padding = dfEditorUtil.EditPadding("Padding", control.FillPadding);
                if (padding != control.FillPadding)
                {
                    dfEditorUtil.MarkUndo(control, "Change Slider Padding");
                    control.FillPadding = padding;
                }
            }
        }

        return(true);
    }
    protected override bool OnCustomInspector()
    {
        dfEditorUtil.DrawSeparator();

        if (!isFoldoutExpanded(foldouts, "Tab Strip Properties", true))
        {
            return(false);
        }

        var control = target as dfTabstrip;

        if (control == null)
        {
            return(false);
        }

        dfEditorUtil.LabelWidth = 110f;

        using (dfEditorUtil.BeginGroup("Appearance"))
        {
            SelectTextureAtlas("Atlas", control, "Atlas", false, false);
            if (control.GUIManager != null && !dfAtlas.Equals(control.Atlas, control.GUIManager.DefaultAtlas))
            {
                EditorGUILayout.HelpBox("This control does not use the same Texture Atlas as the View, which will result in an additional draw call.", MessageType.Info);
            }

            SelectSprite("Background", control.Atlas, control, "BackgroundSprite", false);

            var flowPadding = dfEditorUtil.EditPadding("Tab Padding", control.LayoutPadding);
            if (!RectOffset.Equals(flowPadding, control.LayoutPadding))
            {
                dfEditorUtil.MarkUndo(control, "Change Layout Padding");
                control.LayoutPadding = flowPadding;
            }
        }

        using (dfEditorUtil.BeginGroup("Behavior"))
        {
            var allowKeyNav = EditorGUILayout.Toggle("Keyboard Nav.", control.AllowKeyboardNavigation);
            if (allowKeyNav != control.AllowKeyboardNavigation)
            {
                dfEditorUtil.MarkUndo(control, "Toggle 'Allow Keyboard Navigation'");
                control.AllowKeyboardNavigation = allowKeyNav;
            }

            var tabCount      = control.Controls.Count;
            var selectedIndex = EditorGUILayout.IntSlider("Selected Tab", control.SelectedIndex, 0, tabCount - 1);
            if (selectedIndex != control.SelectedIndex)
            {
                dfEditorUtil.MarkUndo(control, "Change Selected Tab");
                control.SelectedIndex = selectedIndex;
            }

            var pageContainer = EditorGUILayout.ObjectField("Tab Pages", control.TabPages, typeof(dfTabContainer), true) as dfTabContainer;
            if (pageContainer != control.TabPages)
            {
                dfEditorUtil.MarkUndo(control, "Set Page Container");
                control.TabPages = pageContainer;
            }

            if (GUILayout.Button("Add Tab"))
            {
                dfEditorUtil.MarkUndo(control, "Add Tab");
                Selection.activeGameObject = control.AddTab("").gameObject;
                control.SelectedIndex      = int.MaxValue;
            }
        }

        return(true);
    }
예제 #6
0
    protected override bool OnCustomInspector()
    {
        dfEditorUtil.DrawSeparator();

        if (!isFoldoutExpanded(foldouts, "Scroll Container Properties", true))
        {
            return(false);
        }

        var control = target as dfScrollPanel;

        dfEditorUtil.LabelWidth = 110f;

        using (dfEditorUtil.BeginGroup("Appearance"))
        {
            SelectTextureAtlas("Atlas", control, "Atlas", false, true);
            if (control.GUIManager != null && !dfAtlas.Equals(control.Atlas, control.GUIManager.DefaultAtlas))
            {
                EditorGUILayout.HelpBox("This control does not use the same Texture Atlas as the View, which will result in an additional draw call.", MessageType.Info);
            }

            SelectSprite("Background", control.Atlas, control, "BackgroundSprite", false);

            var backgroundColor = EditorGUILayout.ColorField("Back Color", control.BackgroundColor);
            if (backgroundColor != control.BackgroundColor)
            {
                dfEditorUtil.MarkUndo(control, "Change background color");
                control.BackgroundColor = backgroundColor;
            }

            var scrollPadding = dfEditorUtil.EditPadding("Padding", control.ScrollPadding);
            if (!RectOffset.Equals(scrollPadding, control.ScrollPadding))
            {
                dfEditorUtil.MarkUndo(control, "Change Layout Padding");
                control.ScrollPadding = scrollPadding;
            }
        }

        using (dfEditorUtil.BeginGroup("Layout"))
        {
            var scrollOffset = dfEditorUtil.EditInt2("Scroll Pos.", "X", "Y", control.ScrollPosition);
            if (scrollOffset != control.ScrollPosition)
            {
                dfEditorUtil.MarkUndo(control, "Change Scroll Position");
                control.ScrollPosition = scrollOffset;
            }

            // TODO: Review dfScrollPanel.Reset() - Why doesn't it reset scroll position when AutoLayout enabled? Seems intentional, but why?
            if (!control.AutoLayout)
            {
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Space(dfEditorUtil.LabelWidth + 10);
                    if (GUILayout.Button("Reset", "minibutton", GUILayout.Width(100)))
                    {
                        control.Reset();
                    }
                    GUILayout.FlexibleSpace();
                }
                GUILayout.EndHorizontal();
            }

            var autoReset = EditorGUILayout.Toggle("Auto Reset", control.AutoReset);
            if (autoReset != control.AutoReset)
            {
                dfEditorUtil.MarkUndo(control, "Change Auto Reset Property");
                control.AutoReset = autoReset;
            }

            var autoLayout = EditorGUILayout.Toggle("Auto Layout", control.AutoLayout);
            if (autoLayout != control.AutoLayout)
            {
                dfEditorUtil.MarkUndo(control, "Change Auto Layout Property");
                control.AutoLayout = autoLayout;
            }

            if (autoLayout)
            {
                var wrap = EditorGUILayout.Toggle("Wrap Layout", control.WrapLayout);
                if (wrap != control.WrapLayout)
                {
                    dfEditorUtil.MarkUndo(control, "Change Wrap Layout Property");
                    control.WrapLayout = wrap;
                }

                var flowDirection = (dfScrollPanel.LayoutDirection)EditorGUILayout.EnumPopup("Flow Direction", control.FlowDirection);
                if (flowDirection != control.FlowDirection)
                {
                    dfEditorUtil.MarkUndo(control, "Change Flow Direction Property");
                    control.FlowDirection = flowDirection;
                }

                var flowPadding = dfEditorUtil.EditPadding("Flow Padding", control.FlowPadding);
                if (!RectOffset.Equals(flowPadding, control.FlowPadding))
                {
                    dfEditorUtil.MarkUndo(control, "Change Layout Padding");
                    control.FlowPadding = flowPadding;
                }
            }
        }

        using (dfEditorUtil.BeginGroup("Scrolling"))
        {
            var useVirtualScrolling = EditorGUILayout.Toggle("Virtual Scrolling", control.UseVirtualScrolling);
            if (useVirtualScrolling != control.UseVirtualScrolling)
            {
                dfEditorUtil.MarkUndo(control, "Toggle Virtual Scrolling");
                control.UseVirtualScrolling = useVirtualScrolling;
            }

            if (useVirtualScrolling)
            {
                var virtualScrollingTile = (dfPanel)EditorGUILayout.ObjectField("Virtual Tile", control.VirtualScrollingTile, typeof(dfPanel), true);
                if (virtualScrollingTile != control.VirtualScrollingTile)
                {
                    dfEditorUtil.MarkUndo(control, "Set Virtual Tile");
                    control.VirtualScrollingTile = virtualScrollingTile;
                }

                if (virtualScrollingTile != null)
                {
                    var inter = virtualScrollingTile.GetComponents <MonoBehaviour>()
                                .FirstOrDefault(p => p is IDFVirtualScrollingTile);
                    if (!inter)
                    {
                        EditorGUILayout.HelpBox("The tile you've chosen does not implement IDFVirtualScrollingTile!", MessageType.Error);
                    }
                }

                var autoFitVirtualTiles = EditorGUILayout.Toggle("Auto Fit Tile", control.AutoFitVirtualTiles);
                if (autoFitVirtualTiles != control.AutoFitVirtualTiles)
                {
                    dfEditorUtil.MarkUndo(control, "Set Auto-fit Tile");
                    control.AutoFitVirtualTiles = autoFitVirtualTiles;
                }
            }

            var scrollWithKeys = EditorGUILayout.Toggle("Use Arrow Keys", control.ScrollWithArrowKeys);
            if (scrollWithKeys != control.ScrollWithArrowKeys)
            {
                dfEditorUtil.MarkUndo(control, "Toggle Arrow Keys");
                control.ScrollWithArrowKeys = scrollWithKeys;
            }

            var useMomentum = EditorGUILayout.Toggle("Add Momentum", control.UseScrollMomentum);
            if (useMomentum != control.UseScrollMomentum)
            {
                dfEditorUtil.MarkUndo(control, "Toggle Momentum");
                control.UseScrollMomentum = useMomentum;
            }

            var wheelDir = (dfControlOrientation)EditorGUILayout.EnumPopup("Wheel Dir", control.WheelScrollDirection);
            if (wheelDir != control.WheelScrollDirection)
            {
                dfEditorUtil.MarkUndo(control, "Set Wheel Scroll Direction");
                control.WheelScrollDirection = wheelDir;
            }

            var wheelAmount = EditorGUILayout.IntField("Wheel Amount", control.ScrollWheelAmount);
            if (wheelAmount != control.ScrollWheelAmount)
            {
                dfEditorUtil.MarkUndo(control, "Set Wheel Scroll Amount");
                control.ScrollWheelAmount = wheelAmount;
            }

            var horzScroll = (dfScrollbar)EditorGUILayout.ObjectField("Horz. Scrollbar", control.HorzScrollbar, typeof(dfScrollbar), true);
            if (horzScroll != control.HorzScrollbar)
            {
                dfEditorUtil.MarkUndo(control, "Set Horizontal Scrollbar");
                control.HorzScrollbar = horzScroll;
            }

            var vertScroll = (dfScrollbar)EditorGUILayout.ObjectField("Vert. Scrollbar", control.VertScrollbar, typeof(dfScrollbar), true);
            if (vertScroll != control.VertScrollbar)
            {
                dfEditorUtil.MarkUndo(control, "Set Vertical Scrollbar");
                control.VertScrollbar = vertScroll;
            }

            if (wheelDir == dfControlOrientation.Horizontal && horzScroll == null)
            {
                EditorGUILayout.HelpBox("Wheel Scroll Direction is set to Horizontal but there is no Horizontal Scrollbar assigned", MessageType.Info);
            }
            else if (wheelDir == dfControlOrientation.Vertical && vertScroll == null)
            {
                EditorGUILayout.HelpBox("Wheel Scroll Direction is set to Vertical but there is no Vertical Scrollbar assigned", MessageType.Info);
            }
        }

        return(true);
    }
    protected override bool OnCustomInspector()
    {
        var control = target as dfProgressBar;

        if (control == null)
        {
            return(false);
        }

        dfEditorUtil.DrawSeparator();

        if (!isFoldoutExpanded(foldouts, "Progressbar Properties", true))
        {
            return(false);
        }

        dfEditorUtil.LabelWidth = 120f;

        using (dfEditorUtil.BeginGroup("Appearance"))
        {
            SelectTextureAtlas("Atlas", control, "Atlas", false, true);
            if (control.GUIManager != null && !dfAtlas.Equals(control.Atlas, control.GUIManager.DefaultAtlas))
            {
                EditorGUILayout.HelpBox("This control does not use the same Texture Atlas as the View, which will result in an additional draw call.", MessageType.Info);
            }

            SelectSprite("Background", control.Atlas, control, "BackgroundSprite");
            var backColor = EditorGUILayout.ColorField("Back Color", control.Color);
            if (backColor != control.Color)
            {
                dfEditorUtil.MarkUndo(control, "Change background color");
                control.Color = backColor;
            }

            SelectSprite("Progress", control.Atlas, control, "ProgressSprite");
            var progressColor = EditorGUILayout.ColorField("Progress Color", control.ProgressColor);
            if (progressColor != control.ProgressColor)
            {
                dfEditorUtil.MarkUndo(control, "Change background color");
                control.ProgressColor = progressColor;
            }

            var mode = (dfProgressFillMode)EditorGUILayout.EnumPopup("Fill Mode", control.FillMode);
            if (mode != control.FillMode)
            {
                dfEditorUtil.MarkUndo(control, "Change Fill Mode");
                control.FillMode = mode;
            }

            var padding = dfEditorUtil.EditPadding("Padding", control.Padding);
            if (!RectOffset.Equals(padding, control.Padding))
            {
                dfEditorUtil.MarkUndo(control, "Modify Padding");
                control.Padding = padding;
            }
        }

        using (dfEditorUtil.BeginGroup("Behavior"))
        {
            var actAsSlider = EditorGUILayout.Toggle("Act as Slider", control.ActAsSlider);
            if (actAsSlider != control.ActAsSlider)
            {
                dfEditorUtil.MarkUndo(control, "Change ActAsSlider property");
                control.ActAsSlider = actAsSlider;
            }
        }

        using (dfEditorUtil.BeginGroup("Data"))
        {
            var min = EditorGUILayout.FloatField("Min Value", control.MinValue);
            if (min != control.MinValue)
            {
                dfEditorUtil.MarkUndo(control, "Change Minimum Value");
                control.MinValue = min;
            }

            var max = EditorGUILayout.FloatField("Max Value", control.MaxValue);
            if (max != control.MaxValue)
            {
                dfEditorUtil.MarkUndo(control, "Change Maximum Value");
                control.MaxValue = max;
            }

            var value = EditorGUILayout.Slider("Value", control.Value, control.MinValue, control.MaxValue);
            if (value != control.Value)
            {
                dfEditorUtil.MarkUndo(control, "Change Slider Value");
                control.Value = value;
            }
        }

        return(true);
    }
예제 #8
0
    protected override bool OnCustomInspector()
    {
        var control = target as dfScrollbar;

        if (control == null)
        {
            return(false);
        }

        dfEditorUtil.DrawSeparator();

        if (!isFoldoutExpanded(foldouts, "Scrollbar Properties", true))
        {
            return(false);
        }

        dfEditorUtil.LabelWidth = 100f;

        using (dfEditorUtil.BeginGroup("Appearance"))
        {
            SelectTextureAtlas("Atlas", control, "Atlas", false, true);

            var orientation = (dfControlOrientation)EditorGUILayout.EnumPopup("Orientation", control.Orientation);
            if (orientation != control.Orientation)
            {
                dfEditorUtil.MarkUndo(control, "Change Orientation");
                control.Orientation = orientation;
            }
        }

        using (dfEditorUtil.BeginGroup("Behavior"))
        {
            var min = EditorGUILayout.FloatField("Min Value", control.MinValue);
            if (min != control.MinValue)
            {
                dfEditorUtil.MarkUndo(control, "Change Minimum Value");
                control.MinValue = min;
            }

            var max = EditorGUILayout.FloatField("Max Value", control.MaxValue);
            if (max != control.MaxValue)
            {
                dfEditorUtil.MarkUndo(control, "Change Maximum Value");
                control.MaxValue = max;
            }

            var step = EditorGUILayout.FloatField("Snap", control.StepSize);
            if (step != control.StepSize)
            {
                dfEditorUtil.MarkUndo(control, "Change Snap");
                control.StepSize = step;
            }

            var increment = EditorGUILayout.FloatField("Increment", control.IncrementAmount);
            if (increment != control.IncrementAmount)
            {
                dfEditorUtil.MarkUndo(control, "Change Increment Amount");
                control.IncrementAmount = increment;
            }

            var scroll = EditorGUILayout.FloatField("Scroll Size", control.ScrollSize);
            if (scroll != control.ScrollSize)
            {
                dfEditorUtil.MarkUndo(control, "Change Scroll Increment");
                control.ScrollSize = scroll;
            }

            var value = EditorGUILayout.Slider("Value", control.Value, control.MinValue, control.MaxValue - control.ScrollSize);
            if (value != control.Value)
            {
                dfEditorUtil.MarkUndo(control, "Change Value");
                control.Value = value;
            }

            var autoHide = EditorGUILayout.Toggle("Auto Hide", control.AutoHide);
            if (autoHide != control.AutoHide)
            {
                dfEditorUtil.MarkUndo(control, "Change AutoHide property");
                control.AutoHide = autoHide;
            }
        }

        using (dfEditorUtil.BeginGroup("Controls"))
        {
            var track = EditorGUILayout.ObjectField("Track", control.Track, typeof(dfControl), true) as dfControl;
            if (track != control.Track)
            {
                if (track == null || track.transform.IsChildOf(control.transform))
                {
                    dfEditorUtil.MarkUndo(control, "Assign Track");
                    control.Track = track;
                }
                else
                {
                    EditorUtility.DisplayDialog("Invalid Control", "You can only assign controls to this property that are a child of the " + control.name + " control", "OK");
                }
            }

            var incButton = EditorGUILayout.ObjectField("Inc. Button", control.IncButton, typeof(dfControl), true) as dfControl;
            if (incButton != control.IncButton)
            {
                if (incButton == null || incButton.transform.IsChildOf(control.transform))
                {
                    dfEditorUtil.MarkUndo(control, "Assign Increment Button");
                    control.IncButton = incButton;
                }
                else
                {
                    EditorUtility.DisplayDialog("Invalid Control", "You can only assign controls to this property that are a child of the " + control.name + " control", "OK");
                }
            }

            var decButton = EditorGUILayout.ObjectField("Dec. Button", control.DecButton, typeof(dfControl), true) as dfControl;
            if (decButton != control.DecButton)
            {
                if (decButton == null || decButton.transform.IsChildOf(control.transform))
                {
                    dfEditorUtil.MarkUndo(control, "Assign Decrement Button");
                    control.DecButton = decButton;
                }
                else
                {
                    EditorUtility.DisplayDialog("Invalid Control", "You can only assign controls to this property that are a child of the " + control.name + " control", "OK");
                }
            }

            var thumb = EditorGUILayout.ObjectField("Thumb", control.Thumb, typeof(dfControl), true) as dfControl;
            if (thumb != control.Thumb)
            {
                if (thumb == null || thumb.transform.IsChildOf(control.transform))
                {
                    dfEditorUtil.MarkUndo(control, "Assign Thumb");
                    control.Thumb = thumb;
                }
                else
                {
                    EditorUtility.DisplayDialog("Invalid Control", "You can only assign controls to this property that are a child of the " + control.name + " control", "OK");
                }
            }

            if (thumb != null)
            {
                var minThumb = dfEditorUtil.EditInt2("Min. Size", "Width", "Height", thumb.MinimumSize);
                if (minThumb != thumb.MinimumSize)
                {
                    dfEditorUtil.MarkUndo(thumb, "Change Minimum Size");
                    thumb.MinimumSize = minThumb;
                }

                var thumbPadding = dfEditorUtil.EditPadding("Padding", control.ThumbPadding);
                if (!RectOffset.Equals(thumbPadding, control.ThumbPadding))
                {
                    dfEditorUtil.MarkUndo(control, "Change thumb Padding");
                    control.ThumbPadding = thumbPadding;
                }
            }
        }

        return(true);
    }