private int GetNodesCount(TreeDSNode root, NodeTypeFilter filter) { var currentNode = root; var strictNodesCount = 0; var queue = new Queue <TreeDSNode>(); queue.Enqueue(root); while (queue.Count > 0) { currentNode = queue.Dequeue(); if (filter(currentNode)) { strictNodesCount++; } if (currentNode.isLeftNodeAvailable()) { queue.Enqueue(currentNode.Left); } if (currentNode.isRightNodeAvailable()) { queue.Enqueue(currentNode.Right); } } return(strictNodesCount); }
private void ResetView() { // clear current nodeList.Clear(); connectionList.Clear(); nodeToConnectionMap.Clear(); searchResultList.Clear(); searchText = null; searchType = NodeTypeFilter.All; searchResultDirty = true; currentNodeIndex = 0; binderCount = 0; bindableContainerCount = 0; }
private void DrawToolbar() { using (new EditorGUILayout.HorizontalScope(EditorStyles.toolbar)) { var toolbarHeight = GUILayout.Height(GraphEditorSettings.ToolbarHeight); if (GUILayout.Button("Create Graph", EditorStyles.toolbarButton, GUILayout.Width(100), toolbarHeight)) { CreateGraph(); } if (GUILayout.Button("Check Error", EditorStyles.toolbarButton, GUILayout.Width(100), toolbarHeight)) { CheckError(); } EditorGUILayout.LabelField("Find what", GUILayout.Width(70), toolbarHeight); EditorGUI.BeginChangeCheck(); { searchText = EditorGUILayout.TextField(string.Empty, searchText, new GUIStyle("ToolbarSeachTextField"), GUILayout.Width(160), toolbarHeight); if (GUILayout.Button("Close", "ToolbarSeachCancelButtonEmpty")) { // reset text searchText = null; } EditorGUILayout.LabelField("NodeType Filter", GUILayout.Width(100), toolbarHeight); searchType = (NodeTypeFilter)EditorGUILayout.EnumPopup(searchType, EditorStyles.toolbarPopup, GUILayout.Width(140), toolbarHeight); } if (EditorGUI.EndChangeCheck()) { searchResultDirty = true; } if (GUILayout.Button("Find Next", EditorStyles.toolbarButton, GUILayout.Width(100), toolbarHeight)) { Find(); } enableExtraInfo = GUILayout.Toggle(enableExtraInfo, "Enable Extra Info", EditorStyles.toolbarButton, GUILayout.Width(150), toolbarHeight); flatDepth = GUILayout.Toggle(flatDepth, "Flat Depth", EditorStyles.toolbarButton, GUILayout.Width(120), toolbarHeight); GraphEditorSettings.enableDrag = GUILayout.Toggle(GraphEditorSettings.enableDrag, "Enable Drag", EditorStyles.toolbarButton, GUILayout.Width(120), toolbarHeight); GUILayout.FlexibleSpace(); EditorGUILayout.LabelField(string.Format("Binder: {0}", binderCount), GUILayout.Width(100), toolbarHeight); EditorGUILayout.LabelField(string.Format("DataContext: {0}", dataContextCount), GUILayout.Width(120), toolbarHeight); EditorGUILayout.LabelField(string.Format("DataContextRegister: {0}", dataContextRegisterCount), GUILayout.Width(180), toolbarHeight); } }