Пример #1
0
        public EntityHierarchyTree(Session session, TreeViewState state) : base(state)
        {
            useScrollView           = true;
            m_Session               = session;
            m_EntityManager         = session.GetManager <IWorldManager>().EntityManager;
            m_CachedSceneItems      = new Dictionary <SceneGuid, TreeViewItem>();
            m_SceneManager          = m_Session.GetManager <IEditorSceneManagerInternal>();
            m_ComponentCache        = m_Session.GetManager <UnityComponentCacheManager>();
            m_HierarchySearchFilter = FilterUtility.CreateHierarchyFilter(m_EntityManager, string.Empty);
            foldoutOverride         = HandleFoldout;

            m_DroppedOnMethod = new Dictionary <System.Type, DropOnItemAction>
            {
                { typeof(SceneItem), DropUponSceneItem },
                { typeof(EntityItem), DropUponEntityItem },
            };

            m_DroppedBetweenMethod = new Dictionary <System.Type, DropBetweenAction>
            {
                { typeof(HierarchyItem), DropBetweenSceneItems },
                { typeof(SceneItem), DropBetweenRootEntities },
                { typeof(EntityItem), DropBetweenChildrenEntities },
            };

            IdsToExpand = new List <int>();
            Reload();
        }
Пример #2
0
        public EntityItem(Session session, Entity entity, Guid guid, EntityNode node)
        {
            m_Session        = session;
            m_WorldManager   = session.GetManager <IWorldManager>();
            m_ComponentCache = m_Session.GetManager <UnityComponentCacheManager>();

            Entity = entity;
            Guid   = guid;
            Node   = node;

            m_ComponentCache.CreateLink(entity, guid);
        }
Пример #3
0
        private void EnterSession()
        {
            if (null == Session)
            {
                return;
            }

            // TODO: Track state
            if (null == m_ContentState)
            {
                m_ContentState = new TreeViewState();
            }

            m_TreeView = new EntityHierarchyTree(Session, m_ContentState);
            m_AuthoringRoot.style.display    = DisplayStyle.Flex;
            m_NonAuthoringRoot.style.display = DisplayStyle.None;
            m_ComponentCache = Session.GetManager <UnityComponentCacheManager>();
            Session.GetManager <IChangeManager>().RegisterChangeCallback(HandleChanges);
        }
Пример #4
0
        public EntityNode(ISceneGraph graph, Session session, Entity entity)
            : base(graph)
        {
            m_Session        = session;
            m_WorldManager   = m_Session.GetManager <IWorldManager>();
            m_EntityManager  = m_WorldManager.EntityManager;
            m_ComponentCache = m_Session.GetManager <UnityComponentCacheManager>();

            Entity = entity;
            Guid   = m_WorldManager.GetEntityGuid(entity);

            if (m_EntityManager.HasComponent <SiblingIndex>(Entity))
            {
                Index = m_EntityManager.GetComponentData <SiblingIndex>(Entity);
            }
            else
            {
                Index = new SiblingIndex {
                    Index = int.MaxValue
                };
                m_EntityManager.AddComponentData(Entity, Index);
            }
        }