Esempio n. 1
0
        public static bool Highlight(string windowTitle, string text, HighlightSearchMode mode)
        {
            bool flag = false;

            if (Highlighter.s_RecursionLock || Highlighter.searching)
            {
                Debug.LogWarning("Highlighter recursion detected.  You are calling Highlighter.Highlight() with too much abandon.  Avoid highlighting during layout and repaint events.");
            }
            else if (Event.current != null && Event.current.type == EventType.Layout)
            {
                Debug.LogWarning("You are calling Highlighter.Highlight() inorrectly.  Avoid highlighting during layout and repaint events.");
            }
            else
            {
                Highlighter.s_RecursionLock = true;
                Highlighter.Stop();
                if (!Highlighter.SetWindow(windowTitle))
                {
                    Debug.LogWarning("Window " + windowTitle + " not found.");
                }
                else if (mode != HighlightSearchMode.None)
                {
                    Highlighter.active       = true;
                    Highlighter.activeText   = text;
                    Highlighter.s_SearchMode = mode;
                    Highlighter.s_LastTime   = Time.realtimeSinceStartup;
                    flag = Highlighter.Search();
                    if (flag)
                    {
                        Delegate arg_D8_0 = EditorApplication.update;
                        if (Highlighter.< > f__mg$cache0 == null)
                        {
                            Highlighter.< > f__mg$cache0 = new EditorApplication.CallbackFunction(Highlighter.Update);
                        }
                        EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(arg_D8_0, Highlighter.< > f__mg$cache0);
                        Delegate arg_109_0 = EditorApplication.update;
                        if (Highlighter.< > f__mg$cache1 == null)
                        {
                            Highlighter.< > f__mg$cache1 = new EditorApplication.CallbackFunction(Highlighter.Update);
                        }
                        EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Combine(arg_109_0, Highlighter.< > f__mg$cache1);
                    }
                    else
                    {
                        Debug.LogWarning(string.Concat(new string[]
                        {
                            "Item ",
                            text,
                            " not found in window ",
                            windowTitle,
                            "."
                        }));
                        Highlighter.Stop();
                    }
                    InternalEditorUtility.RepaintAllViews();
                }
                Highlighter.s_RecursionLock = false;
            }
            return(flag);
        }
Esempio n. 2
0
        public static bool Highlight(string windowTitle, string text, HighlightSearchMode mode)
        {
            Highlighter.Stop();
            Highlighter.active = true;
            if (!Highlighter.SetWindow(windowTitle))
            {
                Debug.LogWarning("Window " + windowTitle + " not found.");
                return(false);
            }
            Highlighter.activeText   = text;
            Highlighter.s_SearchMode = mode;
            Highlighter.s_LastTime   = Time.realtimeSinceStartup;
            bool flag = Highlighter.Search();

            if (flag)
            {
                EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.update, new EditorApplication.CallbackFunction(Highlighter.Update));
                EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Combine(EditorApplication.update, new EditorApplication.CallbackFunction(Highlighter.Update));
            }
            else
            {
                Debug.LogWarning(string.Concat(new string[]
                {
                    "Item ",
                    text,
                    " not found in window ",
                    windowTitle,
                    "."
                }));
                Highlighter.Stop();
            }
            InternalEditorUtility.RepaintAllViews();
            return(flag);
        }
Esempio n. 3
0
        /// <summary>
        ///   <para>Highlights an element in the editor.</para>
        /// </summary>
        /// <param name="windowTitle">The title of the window the element is inside.</param>
        /// <param name="text">The text to identify the element with.</param>
        /// <param name="mode">Optional mode to specify how to search for the element.</param>
        /// <returns>
        ///   <para>true if the requested element was found; otherwise false.</para>
        /// </returns>
        public static bool Highlight(string windowTitle, string text, HighlightSearchMode mode)
        {
            Highlighter.Stop();
            Highlighter.active = true;
            if (!Highlighter.SetWindow(windowTitle))
            {
                Debug.LogWarning((object)("Window " + windowTitle + " not found."));
                return(false);
            }
            Highlighter.activeText   = text;
            Highlighter.s_SearchMode = mode;
            Highlighter.s_LastTime   = Time.realtimeSinceStartup;
            bool flag = Highlighter.Search();

            if (flag)
            {
                EditorApplication.update -= new EditorApplication.CallbackFunction(Highlighter.Update);
                EditorApplication.update += new EditorApplication.CallbackFunction(Highlighter.Update);
            }
            else
            {
                Debug.LogWarning((object)("Item " + text + " not found in window " + windowTitle + "."));
                Highlighter.Stop();
            }
            InternalEditorUtility.RepaintAllViews();
            return(flag);
        }
Esempio n. 4
0
 private static bool Search()
 {
     Highlighter.searchMode = Highlighter.s_SearchMode;
     Highlighter.s_View.RepaintImmediately();
     if (Highlighter.searchMode == HighlightSearchMode.None)
     {
         return(true);
     }
     Highlighter.searchMode = HighlightSearchMode.None;
     Highlighter.Stop();
     return(false);
 }
Esempio n. 5
0
        private static void Update()
        {
            Rect activeRect = Highlighter.activeRect;

            if (Highlighter.activeRect.width == 0f || Highlighter.s_View == null)
            {
                Delegate arg_51_0 = EditorApplication.update;
                if (Highlighter.< > f__mg$cache2 == null)
                {
                    Highlighter.< > f__mg$cache2 = new EditorApplication.CallbackFunction(Highlighter.Update);
                }
                EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(arg_51_0, Highlighter.< > f__mg$cache2);
                Highlighter.Stop();
                InternalEditorUtility.RepaintAllViews();
            }
            else
            {
                Highlighter.Search();
            }
            if (Highlighter.activeVisible)
            {
                Highlighter.s_HighlightElapsedTime += Time.realtimeSinceStartup - Highlighter.s_LastTime;
            }
            Highlighter.s_LastTime = Time.realtimeSinceStartup;
            Rect rect = Highlighter.activeRect;

            if (activeRect.width > 0f)
            {
                rect.xMin = Mathf.Min(rect.xMin, activeRect.xMin);
                rect.xMax = Mathf.Max(rect.xMax, activeRect.xMax);
                rect.yMin = Mathf.Min(rect.yMin, activeRect.yMin);
                rect.yMax = Mathf.Max(rect.yMax, activeRect.yMax);
            }
            rect = Highlighter.highlightStyle.padding.Add(rect);
            rect = Highlighter.highlightStyle.overflow.Add(rect);
            rect = new RectOffset(7, 7, 7, 7).Add(rect);
            if (Highlighter.s_HighlightElapsedTime < 0.43f)
            {
                rect = new RectOffset((int)rect.width / 2, (int)rect.width / 2, (int)rect.height / 2, (int)rect.height / 2).Add(rect);
            }
            Highlighter.s_RepaintRegion = rect;
            UnityEngine.Object[] array = Resources.FindObjectsOfTypeAll(typeof(GUIView));
            for (int i = 0; i < array.Length; i++)
            {
                GUIView gUIView = (GUIView)array[i];
                if (gUIView.window == Highlighter.s_View.window)
                {
                    gUIView.SendEvent(EditorGUIUtility.CommandEvent("HandleControlHighlight"));
                }
            }
        }
Esempio n. 6
0
        public static bool Highlight(string windowTitle, string text, HighlightSearchMode mode)
        {
            Highlighter.Stop();
            Highlighter.active = true;
            bool result;

            if (!Highlighter.SetWindow(windowTitle))
            {
                Debug.LogWarning("Window " + windowTitle + " not found.");
                result = false;
            }
            else
            {
                Highlighter.activeText   = text;
                Highlighter.s_SearchMode = mode;
                Highlighter.s_LastTime   = Time.realtimeSinceStartup;
                bool flag = Highlighter.Search();
                if (flag)
                {
                    Delegate arg_79_0 = EditorApplication.update;
                    if (Highlighter.< > f__mg$cache0 == null)
                    {
                        Highlighter.< > f__mg$cache0 = new EditorApplication.CallbackFunction(Highlighter.Update);
                    }
                    EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(arg_79_0, Highlighter.< > f__mg$cache0);
                    Delegate arg_AA_0 = EditorApplication.update;
                    if (Highlighter.< > f__mg$cache1 == null)
                    {
                        Highlighter.< > f__mg$cache1 = new EditorApplication.CallbackFunction(Highlighter.Update);
                    }
                    EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Combine(arg_AA_0, Highlighter.< > f__mg$cache1);
                }
                else
                {
                    Debug.LogWarning(string.Concat(new string[]
                    {
                        "Item ",
                        text,
                        " not found in window ",
                        windowTitle,
                        "."
                    }));
                    Highlighter.Stop();
                }
                InternalEditorUtility.RepaintAllViews();
                result = flag;
            }
            return(result);
        }
Esempio n. 7
0
        private static bool Search()
        {
            Highlighter.searchMode = Highlighter.s_SearchMode;
            Highlighter.s_View.RepaintImmediately();
            bool result;

            if (Highlighter.searchMode == HighlightSearchMode.None)
            {
                result = true;
            }
            else
            {
                Highlighter.s_SearchMode = HighlightSearchMode.None;
                Highlighter.Stop();
                result = false;
            }
            return(result);
        }
Esempio n. 8
0
        private static void Update()
        {
            Rect activeRect = Highlighter.activeRect;

            if ((double)Highlighter.activeRect.width == 0.0 || (Object)Highlighter.s_View == (Object)null)
            {
                EditorApplication.update -= new EditorApplication.CallbackFunction(Highlighter.Update);
                Highlighter.Stop();
                InternalEditorUtility.RepaintAllViews();
            }
            else
            {
                Highlighter.Search();
            }
            if (Highlighter.activeVisible)
            {
                Highlighter.s_HighlightElapsedTime += Time.realtimeSinceStartup - Highlighter.s_LastTime;
            }
            Highlighter.s_LastTime = Time.realtimeSinceStartup;
            Rect rect = Highlighter.activeRect;

            if ((double)activeRect.width > 0.0)
            {
                rect.xMin = Mathf.Min(rect.xMin, activeRect.xMin);
                rect.xMax = Mathf.Max(rect.xMax, activeRect.xMax);
                rect.yMin = Mathf.Min(rect.yMin, activeRect.yMin);
                rect.yMax = Mathf.Max(rect.yMax, activeRect.yMax);
            }
            rect = Highlighter.highlightStyle.padding.Add(rect);
            rect = Highlighter.highlightStyle.overflow.Add(rect);
            rect = new RectOffset(7, 7, 7, 7).Add(rect);
            if ((double)Highlighter.s_HighlightElapsedTime < 0.430000007152557)
            {
                rect = new RectOffset((int)rect.width / 2, (int)rect.width / 2, (int)rect.height / 2, (int)rect.height / 2).Add(rect);
            }
            Highlighter.s_RepaintRegion = rect;
            foreach (GUIView guiView in Resources.FindObjectsOfTypeAll(typeof(GUIView)))
            {
                if ((Object)guiView.window == (Object)Highlighter.s_View.window)
                {
                    guiView.SendEvent(EditorGUIUtility.CommandEvent("HandleControlHighlight"));
                }
            }
        }