Пример #1
0
        private void ApplyFilter()
        {
            m_SearchBits = m_SearchString.ToLower().Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);

            //reset all the filters;
            VisitItems(item => item.PassedFilter = false);

            //Apply filters
            VisitItems(item => item.PassedFilter = Filter(item));

            //Count visible
            m_FilteredItemCount = 0;
            m_TotalItemCount    = 0;
            m_FilteredItemWidth = 0;
            m_TotalItemWidth    = 0;
            VisitItems(item => {
                float min, max;
                LabelStyle.CalcMinMaxWidth(item.Content, out min, out max);
                float itemWidth = item.Depth * kIndent + max;
                if (item.PassedFilter)
                {
                    m_FilteredItemWidth = Mathf.Max(m_FilteredItemWidth, itemWidth);
                    m_FilteredItemCount++;
                }
                m_TotalItemWidth = Mathf.Max(m_TotalItemWidth, itemWidth);
                m_TotalItemCount++;
            });

            if (EditorWindow != null)
            {
                EditorWindow.Repaint();
            }

            if (SearchChanged != null)
            {
                XDebug.AssertDelegate(SearchChanged, EditorWindow);
                SearchChanged(m_SearchString);
            }
        }