Пример #1
0
        public ThreadTable(TreeViewState state, MultiColumnHeader multicolumnHeader, List <string> threadNames, List <string> threadUINames, ThreadSelection threadSelection) : base(state, multicolumnHeader)
        {
            StateChanged = false;

            m_AllThreadIdentifier = new ThreadIdentifier();
            m_AllThreadIdentifier.SetName("All");
            m_AllThreadIdentifier.SetAll();

            Assert.AreEqual(m_SortOptions.Length, Enum.GetValues(typeof(MyColumns)).Length, "Ensure number of sort options are in sync with number of MyColumns enum values");

            // Custom setup
            rowHeight = kRowHeights;
            showAlternatingRowBackgrounds = true;
            columnIndexForTreeFoldouts    = (int)(MyColumns.GroupName);
            showBorder           = true;
            customFoldoutYOffset = (kRowHeights - EditorGUIUtility.singleLineHeight) * 0.5f; // center foldout in the row since we also center content. See RowGUI
            // extraSpaceBeforeIconAndLabel = 0;
            multicolumnHeader.sortingChanged        += OnSortingChanged;
            multicolumnHeader.visibleColumnsChanged += OnVisibleColumnsChanged;

            m_ThreadNames     = threadNames;
            m_ThreadUINames   = threadUINames;
            m_ThreadSelection = new ThreadSelection(threadSelection);
#if UNITY_2018_3_OR_NEWER
            this.foldoutOverride += DoFoldout;
#endif
            Reload();
        }
Пример #2
0
        public ThreadSelection(ThreadSelection threadSelection)
        {
            groups    = new List <string>();
            selection = new List <string>();

            Set(threadSelection);
        }
Пример #3
0
 void SetData(ProfileAnalyzerWindow profileAnalyzerWindow, ThreadSelection threadSelection, List <string> threadNames, List <string> threadUINames)
 {
     m_ProfileAnalyzerWindow   = profileAnalyzerWindow;
     m_OriginalThreadSelection = threadSelection;
     m_ThreadNames             = threadNames;
     m_ThreadUINames           = threadUINames;
     CreateTable(profileAnalyzerWindow, threadNames, threadUINames, threadSelection);
 }
Пример #4
0
        public void Set(ThreadSelection threadSelection)
        {
            groups.Clear();
            selection.Clear();

            if (threadSelection.groups != null)
            {
                groups.AddRange(threadSelection.groups);
            }
            if (threadSelection.selection != null)
            {
                selection.AddRange(threadSelection.selection);
            }
        }
        void CreateTable(ProfileAnalyzerWindow profileAnalyzerWindow, List <string> threadNames, List <string> threadUINames, ThreadSelection threadSelection)
        {
            if (m_ThreadTreeViewState == null)
            {
                m_ThreadTreeViewState = new TreeViewState();
            }

            m_ThreadMulticolumnHeaderState = ThreadTable.CreateDefaultMultiColumnHeaderState(700);

            var multiColumnHeader = new MultiColumnHeader(m_ThreadMulticolumnHeaderState);

            multiColumnHeader.SetSorting((int)ThreadTable.MyColumns.ThreadName, true);
            multiColumnHeader.ResizeToFit();
            m_ThreadTable = new ThreadTable(m_ThreadTreeViewState, multiColumnHeader, threadNames, threadUINames, threadSelection);
        }
        static public ThreadSelectionWindow Open(float screenX, float screenY, ProfileAnalyzerWindow profileAnalyzerWindow, ThreadSelection threadSelection, List <string> threadNames, List <string> threadUINames)
        {
            ThreadSelectionWindow window = GetWindow <ThreadSelectionWindow>("Threads");

            window.position = new Rect(screenX, screenY, 400, 500);
            window.SetData(profileAnalyzerWindow, threadSelection, threadNames, threadUINames);
            window.Show();

            return(window);
        }
Пример #7
0
        void CreateTable(ProfileAnalyzerWindow profileAnalyzerWindow, List <string> threadNames, List <string> threadUINames, ThreadSelection threadSelection)
        {
            if (m_ThreadTreeViewState == null)
            {
                m_ThreadTreeViewState = new TreeViewState();
            }

            int  sortedColumn;
            bool sortAscending;

            if (m_ThreadMulticolumnHeaderState == null)
            {
                m_ThreadMulticolumnHeaderState = ThreadTable.CreateDefaultMultiColumnHeaderState(700);
                sortedColumn  = (int)ThreadTable.MyColumns.GroupName;
                sortAscending = true;
            }
            else
            {
                // Remember last sort key
                sortedColumn  = m_ThreadMulticolumnHeaderState.sortedColumnIndex;
                sortAscending = m_ThreadMulticolumnHeaderState.columns[sortedColumn].sortedAscending;
            }

            var multiColumnHeader = new MultiColumnHeader(m_ThreadMulticolumnHeaderState);

            multiColumnHeader.SetSorting(sortedColumn, sortAscending);
            multiColumnHeader.ResizeToFit();
            m_ThreadTable = new ThreadTable(m_ThreadTreeViewState, multiColumnHeader, threadNames, threadUINames, threadSelection);
        }