protected override TreeViewItem BuildRoot() { componentGroupsById.Clear(); queriesById.Clear(); controlsById.Clear(); var currentId = 0; var root = new TreeViewItem { id = currentId++, depth = -1, displayName = "Root" }; if (getWorldSelection() == null) { root.AddChild(new TreeViewItem { id = currentId, displayName = "No world selected" }); } else if (SelectedSystem == null) { root.AddChild(new TreeViewItem { id = currentId, displayName = "Null System" }); } else { var queries = GetQueriesForSystem(SelectedSystem); var entityManager = getWorldSelection().GetExistingManager <EntityManager>(); foreach (var query in queries) { var group = entityManager.CreateComponentGroup(query); queriesById.Add(currentId, query); componentGroupsById.Add(currentId, group); var groupItem = new TreeViewItem { id = currentId++ }; root.AddChild(groupItem); } if (SelectedSystem.ComponentGroups != null) { foreach (var group in SelectedSystem.ComponentGroups) { componentGroupsById.Add(currentId, group); var groupItem = new TreeViewItem { id = currentId++ }; root.AddChild(groupItem); } } if (componentGroupsById.Count == 0) { root.AddChild(new TreeViewItem { id = currentId, displayName = "No Component Groups or Queries in Manager" }); } else { SetupDepthsFromParentsAndChildren(root); foreach (var idGroupPair in componentGroupsById) { var newControl = new ComponentGroupGUIControl(idGroupPair.Value.GetQueryTypes(), idGroupPair.Value.GetReadAndWriteTypes(), true); controlsById.Add(idGroupPair.Key, newControl); } } } return(root); }
protected override TreeViewItem BuildRoot() { componentGroupsById.Clear(); queriesById.Clear(); controlsById.Clear(); var currentId = 0; var root = new TreeViewItem { id = currentId++, depth = -1, displayName = "Root" }; if (getWorldSelection() == null) { root.AddChild(new TreeViewItem { id = currentId, displayName = "No world selected" }); } else if (SelectedSystem == null) { root.AddChild(new TreeViewItem { id = currentId, displayName = "Null System" }); } else { var queries = GetQueriesForSystem(SelectedSystem); foreach (var query in queries) { queriesById.Add(currentId, query); var queryItem = new TreeViewItem { id = currentId++ }; root.AddChild(queryItem); } if (SelectedSystem.ComponentGroups != null) { foreach (var group in SelectedSystem.ComponentGroups) { componentGroupsById.Add(currentId, group); var groupItem = new TreeViewItem { id = currentId++ }; root.AddChild(groupItem); } } if (queriesById.Count == 0 && componentGroupsById.Count == 0) { root.AddChild(new TreeViewItem { id = currentId, displayName = "No Component Groups or Queries in Manager" }); } else { SetupDepthsFromParentsAndChildren(root); foreach (var idGroupPair in componentGroupsById) { var newControl = new ComponentGroupGUIControl(idGroupPair.Value.GetQueryTypes(), idGroupPair.Value.GetReadAndWriteTypes(), true); controlsById.Add(idGroupPair.Key, newControl); } foreach (var idQueryPair in queriesById) { var types = idQueryPair.Value.All.Concat(idQueryPair.Value.Any); types = types.Concat(idQueryPair.Value.None.Select(x => ComponentType.Subtractive(x.GetManagedType()))); var newControl = new ComponentGroupGUIControl(types, true); controlsById.Add(idQueryPair.Key, newControl); } } } return(root); }