Exemplo n.º 1
0
        public void TransferSelection(List <Guid> guids)
        {
            var references = guids.Select(g => m_ComponentCache.GetEntityReference(g)).Where(r => r && null != r).ToList();

            Selection.instanceIDs = references.Select(r => r.gameObject.GetInstanceID()).ToArray();
            IdsToExpand.AddRange(references
                                 .Select(e => e.transform.parent)
                                 .Where(p => p && null != p)
                                 .Select(p => p.gameObject.GetInstanceID()));
        }
Exemplo n.º 2
0
        private void UpdateConfigView()
        {
            if (Project == null)
            {
                return;
            }

            var configEntity = Project.WorldManager.GetConfigEntity();

            if (configEntity == Entity.Null)
            {
                return;
            }

            var configEntityRef = m_ComponentCache.GetEntityReference(configEntity);
            var rect            = EditorGUILayout.GetControlRect(false, k_FooterHeight);

            // Background
            if (Selection.activeInstanceID == configEntityRef.GetInstanceID())
            {
                HierarchyGui.BackgroundColor(rect, HierarchyColors.Hierarchy.Selection);
            }
            else if (rect.Contains(Event.current.mousePosition))
            {
                HierarchyGui.BackgroundColor(rect, HierarchyColors.Hierarchy.Hover);
            }

            // Draw top line
            var topLine = rect;

            topLine.width += 1;
            topLine.height = 1;
            HierarchyGui.BackgroundColor(topLine, HierarchyColors.Hierarchy.SceneSeparator);

            // Draw configuration entity
            var entityRect = rect;

            entityRect.x += 2;
            entityRect.y += 2;

            // Draw entity icon
            var iconRect = entityRect;

            iconRect.y    += 1;
            iconRect.width = 18;
            EditorGUI.LabelField(iconRect, new GUIContent {
                image = Icons.Entity
            });

            // Draw entity label
            var labelRect = entityRect;

            labelRect.x += 18;
            labelRect.y += 2;
            EditorGUI.LabelField(labelRect, "Configuration", GUI.skin.label);

            if (GUI.Button(rect, new GUIContent(), GUI.skin.label))
            {
                Selection.activeInstanceID = configEntityRef.GetInstanceID();
            }
        }