Пример #1
0
        public static void FindTool()
        {
            EditorFindEditorTools window = EditorWindow.GetWindow <EditorFindEditorTools>();

            window.titleContent             = new GUIContent("Find Editor Tools");
            window.autoRepaintOnSceneChange = false;
            window.wantsMouseMove           = false;
            window.minSize = new Vector2(374f, 100f);
            window.Init();
            window.Show();
        }
Пример #2
0
        private void SortFilteredList()
        {
            m_lMenuCommandsFiltered.Sort();
            m_lMenuCommandsUsage = m_lMenuCommandsUsage.OrderBy(x => x.Value).ThenByDescending(x => x.Path).ToList();

            foreach (ToolUsage toolUsage in m_lMenuCommandsUsage)
            {
                int iIndex = m_lMenuCommandsFiltered.IndexOf(toolUsage.Path);
                if (iIndex != -1 && toolUsage.Value != 0)
                {
                    EditorFindEditorTools.MoveToFront(m_lMenuCommandsFiltered, iIndex);
                }
            }
        }
Пример #3
0
        private void RecreateFilteredList()
        {
            if (System.String.IsNullOrEmpty(m_sSearchString))
            {
                m_lMenuCommandsFiltered = new List <string>(m_lMenuCommands);
            }
            else
            {
                m_lMenuCommandsFiltered.Clear();
                for (int i = 0, imax = m_lMenuCommands.Count; i < imax; i++)
                {
                    string sCommand = m_lMenuCommands[i];
                    if (EditorFindEditorTools.MatchSearch(sCommand, m_sSearchString))
                    {
                        m_lMenuCommandsFiltered.Add(sCommand);
                    }
                }
            }

            m_iMenuCommandsFilteredCount = m_lMenuCommandsFiltered.Count;
            this.SortFilteredList();
        }
Пример #4
0
        private void RecreateCommandList()
        {
            m_lMenuCommands.Clear();

            string sCommands = EditorGUIUtility.SerializeMainMenuToString();

            string[] arCommands = sCommands.Split(new string[] { "\n" }, System.StringSplitOptions.RemoveEmptyEntries);

            List <string> lCurrentParents = new List <string>();

            for (int i = 0, imax = arCommands.Length; i < imax; i++)
            {
                string sCurrentRoot = lCurrentParents.Count != 0 ? lCurrentParents.First() : "";

                string sCurrentLine        = arCommands[i];
                string sCurrentLineTrimmed = sCurrentLine.TrimStart(' ');
                int    iPreviousIndention  = lCurrentParents.Count - 1;
                int    iCurrentIndention   = (sCurrentLine.Length - sCurrentLineTrimmed.Length) / 4;

                int iLastTab = sCurrentLine.LastIndexOf('\t');
                sCurrentLineTrimmed = iLastTab != -1 ? sCurrentLine.Remove(iLastTab, sCurrentLine.Length - iLastTab).Trim() : sCurrentLine.Trim();

                if (sCurrentLineTrimmed == System.String.Empty)
                {
                    continue;
                }

                if (iPreviousIndention > iCurrentIndention)
                {
                    EditorFindEditorTools.RemoveLast(lCurrentParents);
                    while (iPreviousIndention > iCurrentIndention)
                    {
                        EditorFindEditorTools.RemoveLast(lCurrentParents);
                        iPreviousIndention--;
                    }

                    if (!m_lSkipRoots.Contains(sCurrentRoot))
                    {
                        m_lMenuCommands.Add(this.CreateCommandString(sCurrentLineTrimmed, lCurrentParents));
                    }
                    lCurrentParents.Add(sCurrentLineTrimmed);
                }
                else if (iPreviousIndention < iCurrentIndention)
                {
                    if (!m_lSkipRoots.Contains(sCurrentRoot))
                    {
                        EditorFindEditorTools.RemoveLast(m_lMenuCommands);
                        m_lMenuCommands.Add(this.CreateCommandString(sCurrentLineTrimmed, lCurrentParents));
                    }
                    lCurrentParents.Add(sCurrentLineTrimmed);
                }
                else
                {
                    EditorFindEditorTools.RemoveLast(lCurrentParents);
                    if (!m_lSkipRoots.Contains(sCurrentRoot))
                    {
                        m_lMenuCommands.Add(this.CreateCommandString(sCurrentLineTrimmed, lCurrentParents));
                    }
                    lCurrentParents.Add(sCurrentLineTrimmed);
                }
            }

            this.RecreateFilteredList();
        }