void PopulateListViewWithSearchResults() { BuildFilterResults(); foreach (var filteredItem in m_ListViewFilteredItems) { filteredItem.Release(); } m_ListViewFilteredItems.Clear(); foreach (var system in m_SearchResultsFlatSystemList) { var listViewItems = SystemTreeViewItem.Acquire(PlayerLoopSystemGraph.Current, system.Node, null, m_World); m_ListViewFilteredItems.Add(listViewItems); } m_SystemListView.Refresh(); }
void PopulateAllChildren(SystemTreeViewItem item) { if (item.SystemHandle != null) { var systemForSearch = new SystemForSearch(item.SystemHandle) { Node = item.Node }; m_AllSystemsForSearch.Add(systemForSearch); var keyString = Properties.Editor.TypeUtility.GetTypeDisplayName(item.SystemHandle.GetSystemType()).Replace(".", "|"); // TODO: Find better solution to be able to uniquely identify each system. // At the moment, we are using system name to identify each system, which is not reliable // because there can be multiple systems with the same name in a world. This is only a // temporary solution to avoid the error of adding the same key into the map. We need to // find a proper solution to be able to uniquely identify each system. if (!m_SystemDependencyMap.ContainsKey(keyString)) { m_SystemDependencyMap.Add(keyString, SystemDependencyUtilities.GetDependencySystemNamesFromGivenSystemType(item.SystemHandle.GetSystemType()).ToArray()); } } // Get last selected item. if (item.id == m_LastSelectedItemId) { m_LastSelectedItem?.Release(); m_LastSelectedItem = SystemTreeViewItem.Acquire(item.Graph, item.Node, (SystemTreeViewItem)item.parent, item.World); m_SystemDetailsVisualElement.LastSelectedItem = m_LastSelectedItem; } if (!item.HasChildren) { return; } item.PopulateChildren(); foreach (var child in item.children) { PopulateAllChildren(child as SystemTreeViewItem); } }
void OnSelectionChanged(SystemTreeViewItem selectedItem) { m_LastSelectedItem?.Release(); m_LastSelectedItem = null; if (null == selectedItem) { return; } if (!selectedItem.SystemHandle.Valid) { if (Contains(m_SystemDetailsVisualElement)) { Remove(m_SystemDetailsVisualElement); } return; } // Remember last selected item id so that query information can be properly updated. m_LastSelectedItemId = selectedItem.id; m_LastSelectedItem = SystemTreeViewItem.Acquire(selectedItem.Graph, selectedItem.Node, (SystemTreeViewItem)selectedItem.parent, selectedItem.World); m_ScrollToItemId = selectedItem.id; // Start fresh. if (Contains(m_SystemDetailsVisualElement)) { Remove(m_SystemDetailsVisualElement); } m_SystemDetailsVisualElement.Target = selectedItem; m_SystemDetailsVisualElement.SearchFilter = SearchFilter; m_SystemDetailsVisualElement.Parent = this; m_SystemDetailsVisualElement.LastSelectedItem = m_LastSelectedItem; Add(m_SystemDetailsVisualElement); }
void RecreateTreeViewRootItems() { ReleaseAllPooledItems(); if (World.All.Count > 0 && string.IsNullOrEmpty(SearchFilter.ErrorComponentType)) { var graph = PlayerLoopSystemGraph.Current; foreach (var node in graph.Roots) { if (!node.ShowForWorld(m_World)) { continue; } var item = SystemTreeViewItem.Acquire(graph, node, null, m_World); PopulateAllChildren(item); m_TreeViewRootItems.Add(item); } m_SystemTreeView.Refresh(); } }