UnityEditor.MemoryElementSelection.isSelected C# (CSharp) Method

isSelected() public method

public isSelected ( MemoryElement node ) : bool
node MemoryElement
return bool
        public bool isSelected(MemoryElement node)
        {
            return (this.m_Selected == node);
        }

Usage Example

示例#1
0
        protected virtual void DrawItem(MemoryElement memoryElement, ref int row, int indent)
        {
            bool isSelected = m_MemorySelection.isSelected(memoryElement);

            DrawBackground(row, isSelected);

            Rect rect = GenerateRect(row);

            rect.x = kBaseIndent + indent * kIndentPx - kFoldoutSize;
            Rect toggleRect = rect;

            toggleRect.width = kFoldoutSize;
            if (memoryElement.ChildCount() > 0)
            {
                memoryElement.expanded = GUI.Toggle(toggleRect, memoryElement.expanded, GUIContent.none, styles.foldout);
            }

            rect.x += kFoldoutSize;

            if (isSelected)
            {
                m_SelectionOffset = row * kRowHeight;
            }

            if (Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition))
            {
                RowClicked(Event.current, memoryElement);
            }

            DrawData(rect, memoryElement, indent, row, isSelected);

            if (memoryElement.expanded)
            {
                DrawRecursiveData(memoryElement, ref row, indent + 1);
            }
        }