public void Add(FoldoutNode _node) { if (node.childs == null) { node.childs = new List <FoldoutNode>(); } while (node.childs.Count <= currentChildIdx) { node.childs.Add(null); } node.childs[currentChildIdx] = _node; }
private bool BeginFoldout(object _object, bool _isOpenedByDefault, string _label, Texture _icon = null) { bool wasOpened = _isOpenedByDefault; FoldoutNode node = null; if (m_openedFoldouts.Count > 0) { node = m_openedFoldouts.Peek().MoveNext(); } else { m_foldouts.TryGetValue(_object, out node); } if (node != null) { wasOpened = node.isOpened; } bool isOpened = EditorGUILayout.Foldout(wasOpened, new GUIContent(_label, _icon)); if (isOpened) { if (node == null) { node = new FoldoutNode(); if (m_openedFoldouts.Count > 0) { m_openedFoldouts.Peek().Add(node); } else { m_foldouts.Add(_object, node); } } m_openedFoldouts.Push(new FoldoutIndex(node)); EditorGUI.indentLevel++; BeginParagraphArea(); } if (node != null) { node.isOpened = isOpened; } return(isOpened); }
public FoldoutIndex(FoldoutNode _node) { node = _node; }
private bool BeginFoldout(object _object, bool _isOpenedByDefault, string _label, Texture _icon = null) { bool wasOpened = _isOpenedByDefault; FoldoutNode node = null; if (m_openedFoldouts.Count > 0) { node = m_openedFoldouts.Peek().MoveNext(); } else { m_foldouts.TryGetValue(_object, out node); } if (node != null) { wasOpened = node.isOpened; } bool isOpened = EditorGUILayout.Foldout(wasOpened, new GUIContent(_label, _icon)); if (isOpened) { if (node == null) { node = new FoldoutNode(); if (m_openedFoldouts.Count > 0) { m_openedFoldouts.Peek().Add(node); } else { m_foldouts.Add(_object, node); } } m_openedFoldouts.Push(new FoldoutIndex(node)); EditorGUI.indentLevel++; BeginParagraphArea(); } if (node != null) { node.isOpened = isOpened; } return isOpened; }
public void Add(FoldoutNode _node) { if (node.childs == null) { node.childs = new List<FoldoutNode>(); } while (node.childs.Count <= currentChildIdx) { node.childs.Add(null); } node.childs[currentChildIdx] = _node; }