private void SortMethodsDropDown() { if (this.hasSortMethods) { GUIContent gUIContent = this.m_SortingObjects[this.currentSortMethod].content; if (gUIContent == null) { gUIContent = SceneHierarchyWindow.s_Styles.defaultSortingContent; gUIContent.tooltip = this.currentSortMethod; } Rect rect = GUILayoutUtility.GetRect(gUIContent, EditorStyles.toolbarButton); if (EditorGUI.ButtonMouseDown(rect, gUIContent, FocusType.Passive, EditorStyles.toolbarButton)) { List <SceneHierarchySortingWindow.InputData> list = new List <SceneHierarchySortingWindow.InputData>(); foreach (KeyValuePair <string, BaseHierarchySort> current in this.m_SortingObjects) { list.Add(new SceneHierarchySortingWindow.InputData { m_TypeName = current.Key, m_Name = ObjectNames.NicifyVariableName(current.Key), m_Selected = current.Key == this.m_CurrentSortMethod }); } if (SceneHierarchySortingWindow.ShowAtPosition(new Vector2(rect.x, rect.y + rect.height), list, new SceneHierarchySortingWindow.OnSelectCallback(this.SortFunctionCallback))) { GUIUtility.ExitGUI(); } } } }
private void SortMethodsDropDown() { if (!this.hasSortMethods) { return; } GUIContent content = this.m_SortingObjects[this.currentSortMethod].content; if (content == null) { content = SceneHierarchyWindow.s_Styles.defaultSortingContent; content.tooltip = this.currentSortMethod; } Rect rect = GUILayoutUtility.GetRect(content, EditorStyles.toolbarButton); if (!EditorGUI.ButtonMouseDown(rect, content, FocusType.Passive, EditorStyles.toolbarButton)) { return; } List <SceneHierarchySortingWindow.InputData> data = new List <SceneHierarchySortingWindow.InputData>(); using (Dictionary <string, BaseHierarchySort> .Enumerator enumerator = this.m_SortingObjects.GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair <string, BaseHierarchySort> current = enumerator.Current; data.Add(new SceneHierarchySortingWindow.InputData() { m_TypeName = current.Key, m_Name = ObjectNames.NicifyVariableName(current.Key), m_Selected = current.Key == this.m_CurrentSortMethod }); } } if (!SceneHierarchySortingWindow.ShowAtPosition(new Vector2(rect.x, rect.y + rect.height), data, new SceneHierarchySortingWindow.OnSelectCallback(this.SortFunctionCallback))) { return; } GUIUtility.ExitGUI(); }