Esempio n. 1
0
        private bool HasExposeToEditorChildren(Transform parentTransform)
        {
            int childrenCount = parentTransform.childCount;

            if (childrenCount == 0)
            {
                return(false);
            }

            for (int i = 0; i < childrenCount; ++i)
            {
                Transform      childTransform = parentTransform.GetChild(i);
                ExposeToEditor child          = childTransform.GetComponent <ExposeToEditor>();
                if (child != null)
                {
                    return(true);
                }
                HierarchyItem hierarchyItem = childTransform.GetComponent <HierarchyItem>();
                if (hierarchyItem != null)
                {
                    if (HasExposeToEditorChildren(childTransform))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Esempio n. 2
0
        private void UpdateChildren(Transform parentTransform, ExposeToEditor parentExp)
        {
            int childrenCount = parentTransform.childCount;

            if (childrenCount == 0)
            {
                return;
            }

            for (int i = 0; i < childrenCount; ++i)
            {
                Transform      childTransform    = parentTransform.GetChild(i);
                ExposeToEditor child             = childTransform.GetComponent <ExposeToEditor>();
                HierarchyItem  childHierarcyItem = childTransform.GetComponent <HierarchyItem>();
                if (child != null)
                {
                    child.Parent = parentExp;
                    childHierarcyItem.m_parentExp = parentExp;
                }
                else
                {
                    if (childHierarcyItem != null)
                    {
                        UpdateChildren(childTransform, parentExp);
                    }
                }
            }
        }
Esempio n. 3
0
        private void Awake()
        {
            RuntimeEditorApplication.IsOpenedChanged += OnEditorIsOpenedChanged;

            m_objectType = ExposeToEditorObjectType.Undefined;

            Init();

            m_hierarchyItem = gameObject.GetComponent <HierarchyItem>();
            if (m_hierarchyItem == null)
            {
                m_hierarchyItem = gameObject.AddComponent <HierarchyItem>();
            }

            if (hideFlags != HideFlags.HideAndDontSave)
            {
                if (Awaked != null)
                {
                    Awaked(this);
                }
            }
        }
Esempio n. 4
0
        private void TryDestroyChainToParent(Transform parent, ExposeToEditor parentExp)
        {
            if (parentExp == null)
            {
                return;
            }

            while (parent != null && parent.gameObject != parentExp.gameObject)
            {
                if (!parent.GetComponent <ExposeToEditor>())
                {
                    HierarchyItem hierarchyItem = parent.GetComponent <HierarchyItem>();
                    if (hierarchyItem)
                    {
                        if (!HasExposeToEditorChildren(parent))
                        {
                            Destroy(hierarchyItem);
                        }
                    }
                }
                parent = parent.parent;
            }
        }
Esempio n. 5
0
        private void Awake()
        {
            m_rte = IOC.Resolve <IRTE>();

            m_rte.IsOpenedChanged += OnEditorIsOpenedChanged;

            m_objectType = ExposeToEditorObjectType.Undefined;

            Init();

            m_hierarchyItem = gameObject.GetComponent <HierarchyItem>();
            if (m_hierarchyItem == null)
            {
                m_hierarchyItem = gameObject.AddComponent <HierarchyItem>();
            }

            if (hideFlags != HideFlags.HideAndDontSave)
            {
                if (_Awaked != null)
                {
                    _Awaked(m_rte, this);
                }
            }
        }