protected void SortingButton(MultiColumnHeaderState.Column column, Rect headerRect, int columnIndex)
        {
            // Button logic
            if (EditorGUI.Button(headerRect, GUIContent.none, GUIStyle.none))
            {
                ColumnHeaderClicked(column, columnIndex);
            }

            // Draw sorting arrow
            if (columnIndex == state.sortedColumnIndex && Event.current.type == EventType.Repaint)
            {
                var arrowRect = GetArrowRect(column, headerRect);

                Matrix4x4 normalMatrix = GUI.matrix;
                if (column.sortedAscending)
                {
                    GUIUtility.RotateAroundPivot(180, arrowRect.center - new Vector2(0, 1));
                }

                GUI.Label(arrowRect, "\u25BE", DefaultStyles.arrowStyle);

                if (column.sortedAscending)
                {
                    GUI.matrix = normalMatrix;
                }
            }
        }
        public static void DrawOpenButton(EditorWindow window, string searchText)
        {
            Rect r = GUILayoutUtility.GetRect(Styles.gotoSearch, EditorStyles.toolbarSearchFieldJumpButton, GUILayout.MaxHeight(EditorGUI.kSingleLineHeight));

            if (EditorGUI.Button(r, Styles.gotoSearch, EditorStyles.toolbarSearchFieldJumpButton))
            {
                OpenSearchInContext(window, searchText, "jumpButton");
            }
        }
Exemple #3
0
        protected void SortingButton(MultiColumnHeaderState.Column column, Rect headerRect, int columnIndex)
        {
            if (EditorGUI.Button(headerRect, GUIContent.none, GUIStyle.none))
            {
                this.ColumnHeaderClicked(column, columnIndex);
            }
            if (columnIndex == this.state.sortedColumnIndex && Event.current.type == EventType.Repaint)
            {
                float fixedWidth = MultiColumnHeader.DefaultStyles.arrowStyle.fixedWidth;
                float y          = headerRect.y;
                float f          = 0f;
                switch (column.sortingArrowAlignment)
                {
                case TextAlignment.Left:
                    f = headerRect.x + (float)MultiColumnHeader.DefaultStyles.columnHeader.padding.left;
                    break;

                case TextAlignment.Center:
                    f = headerRect.x + headerRect.width * 0.5f - fixedWidth * 0.5f;
                    break;

                case TextAlignment.Right:
                    f = headerRect.xMax - (float)MultiColumnHeader.DefaultStyles.columnHeader.padding.right - fixedWidth;
                    break;

                default:
                    Debug.LogError("Unhandled enum");
                    break;
                }
                Rect      position = new Rect(Mathf.Round(f), y, fixedWidth, 12f);
                Matrix4x4 matrix   = GUI.matrix;
                if (column.sortedAscending)
                {
                    GUIUtility.RotateAroundPivot(180f, position.center);
                }
                GUI.Label(position, "▾", MultiColumnHeader.DefaultStyles.arrowStyle);
                if (column.sortedAscending)
                {
                    GUI.matrix = matrix;
                }
            }
        }
Exemple #4
0
 protected void SortingButton(MultiColumnHeaderState.Column column, Rect headerRect, int columnIndex)
 {
     if (EditorGUI.Button(headerRect, GUIContent.none, GUIStyle.none))
     {
         this.ColumnHeaderClicked(column, columnIndex);
     }
     if (columnIndex == this.state.sortedColumnIndex && Event.current.type == EventType.Repaint)
     {
         Rect      arrowRect = this.GetArrowRect(column, headerRect);
         Matrix4x4 matrix    = GUI.matrix;
         if (column.sortedAscending)
         {
             GUIUtility.RotateAroundPivot(180f, arrowRect.center - new Vector2(0f, 1f));
         }
         GUI.Label(arrowRect, "▾", MultiColumnHeader.DefaultStyles.arrowStyle);
         if (column.sortedAscending)
         {
             GUI.matrix = matrix;
         }
     }
 }
Exemple #5
0
        public override void OnGUI(Rect rect)
        {
            EditorGUI.BeginChangeCheck();
            m_connectionTreeView.search = m_SearchField.OnGUI(new Rect(rect.x + ConnectionDropDownStyles.searchFieldPadding, rect.y + ConnectionDropDownStyles.searchFieldPadding, rect.width - (2 * ConnectionDropDownStyles.searchFieldPadding), EditorGUI.kSingleLineHeight), m_connectionTreeView.search);

            if (!didFocus && !m_SearchField.HasFocus())
            {
                m_SearchField.SetFocus();
                didFocus = true;
            }

            if (EditorGUI.EndChangeCheck())
            {
                if (!string.IsNullOrEmpty(m_connectionTreeView.search))
                {
                    if (!searching)
                    {
                        var rows = m_connectionTreeView.GetRows();
                        m_expandedState.Clear();
                        foreach (var row in rows)
                        {
                            m_expandedState.Add(row.id, m_connectionTreeView.IsExpanded(row.id));
                        }
                    }
                    m_connectionTreeView.ExpandAll();
                    searching = true;
                }
                else
                {
                    if (searching)
                    {
                        foreach (var b in m_expandedState)
                        {
                            m_connectionTreeView.SetExpanded(b.Key, b.Value);
                        }
                        searching = false;
                    }
                }

                Reload();
            }
            rect.y += EditorGUI.kSingleLineHeight + ConnectionDropDownStyles.searchFieldVerticalSpacing;

            if (consoleAttachToPlayerState != null)
            {
                rect.y += searchToLoggingPadding;
                EditorGUI.BeginChangeCheck();
                GUI.Toggle(new Rect(rect.x + ConnectionDropDownStyles.searchFieldPadding, rect.y, rect.width, EditorGUI.kSingleLineHeight), consoleAttachToPlayerState.IsConnected(), ConnectionUIHelper.Content.PlayerLogging);
                if (EditorGUI.EndChangeCheck())
                {
                    consoleAttachToPlayerState.PlayerLoggingOptionSelected();
                }
                rect.y     += EditorGUI.kSingleLineHeight + loggingVerticalPadding;
                GUI.enabled = consoleAttachToPlayerState.IsConnected();
                m_connectionTreeView.dropDownItems.ForEach(x => x.m_Disabled = !GUI.enabled);

                EditorGUI.BeginChangeCheck();
                GUI.Toggle(new Rect(rect.x + ConnectionDropDownStyles.searchFieldPadding, rect.y, rect.width, EditorGUI.kSingleLineHeight), consoleAttachToPlayerState.IsLoggingFullLog(), ConnectionUIHelper.Content.FullLog);
                if (EditorGUI.EndChangeCheck())
                {
                    consoleAttachToPlayerState.FullLogOptionSelected();
                }
                rect.y += EditorGUI.kSingleLineHeight + loggingVerticalPadding;
            }

            m_connectionTreeView?.OnGUI(new Rect(rect.x, rect.y, rect.width, (float)m_connectionTreeView?.totalHeight));
            rect.y     += (float)m_connectionTreeView?.totalHeight;
            GUI.enabled = true;

            EditorGUI.DrawDelimiterLine(new Rect(rect.x, rect.y, rect.width, 1f));
            rect.y += 1f;
            rect.y += ConnectionDropDownStyles.troubleShootBtnPadding / 2f;
            if (EditorGUI.Button(rect, Content.TroubleShoot, ConnectionDropDownStyles.sConnectionTrouble))
            {
                var version = $"{Application.unityVersionVer}.{Application.unityVersionMaj}";
                Application.OpenURL($"https://docs.unity3d.com/{version}/Documentation/Manual/profiler-profiling-applications.html");
            }

            if (Event.current.type == EventType.MouseMove)
            {
                Event.current.Use();
            }
        }