Ejemplo n.º 1
0
        static void DrawFoldoutProperty()
        {
            var showChildren = thisArg.showChildren;
            var lastState    = showChildren;

#if UNITY_5_5_OR_NEWER
            showChildren = EditorGUILayout.Foldout(showChildren, ObjectNames.NicifyVariableName(propertyArg.name), true);
#else
            showChildren = EditorGUILayout.Foldout(showChildren, ObjectNames.NicifyVariableName(propertyArg.name));
#endif

            if (lastState != showChildren)
            {
                thisArg.InvalidateDrawCount();
            }

            thisArg.showChildren = showChildren;
        }
Ejemplo n.º 2
0
        public void Draw(float indent, GUILayoutOption colWidth, GUILayoutOption indentOption)
        {
            if (hidden || window.drawAbort)
            {
                return;
            }

            if (!window || window.ScrollCheck())
            {
                window.StartRow(Same, this == window.selected);

                var foldoutState = showChildren;

                thisArg = this;
                DrawProperty(true, indent, colWidth, indentOption);

                //Swap buttons
                var mine           = this.mine;
                var theirs         = this.theirs;
                var hasBothParents = gameObjectParent != null && gameObjectParent.mine && gameObjectParent.theirs ||
                                     componentParent != null && componentParent.mine && componentParent.theirs ||
                                     propertyParent != null && propertyParent.mine != null && propertyParent.theirs != null ||
                                     mine != null && theirs != null && mine.depth == 0;
                if (hasBothParents)
                {
                    DrawMidButtons(mine != null, theirs != null, LeftButton, RightButton, LeftDeleteButton, RightDeleteButton);
                }
                else
                {
                    GUILayout.Space(UniMergeConfig.DoubleMidWidth);
                }

                DrawProperty(false, indent, colWidth, indentOption);

                if (foldoutState != showChildren)
                {
                    thisArg.InvalidateDrawCount();
                    if (Event.current.alt)
                    {
                        thisArg.SetExpandedRecursively(showChildren);
                    }
                }

                window.EndRow(Same);
            }

            var children = this.children;

            if (children != null)
            {
                if (showChildren)
                {
                    tmpList.Clear();
                    var count = children.Count;
                    for (var i = 0; i < count; i++)
                    {
                        tmpList.Add(children[i]);
                    }
                    var newWidth  = indent + Util.TabSize;
                    var newIndent = GUILayout.Width(newWidth);
                    for (var i = 0; i < count; i++)
                    {
                        tmpList[i].Draw(newWidth, colWidth, newIndent);
                    }
                }
            }
        }