GetAnnotations() private method

private GetAnnotations ( ) : UnityEditor.Annotation[]
return UnityEditor.Annotation[]
        private void SyncToState()
        {
            Annotation[] annotations = AnnotationUtility.GetAnnotations();
            string       str         = string.Empty;

            if (AnnotationWindow.s_Debug)
            {
                str += "AnnotationWindow: SyncToState\n";
            }
            this.m_BuiltinAnnotations = new List <AInfo>();
            this.m_ScriptAnnotations  = new List <AInfo>();
            for (int index = 0; index < annotations.Length; ++index)
            {
                if (AnnotationWindow.s_Debug)
                {
                    str = str + "   same as below: icon " + (object)annotations[index].iconEnabled + " gizmo " + (object)annotations[index].gizmoEnabled + "\n";
                }
                AInfo ainfo = new AInfo(annotations[index].gizmoEnabled == 1, annotations[index].iconEnabled == 1, annotations[index].flags, annotations[index].classID, annotations[index].scriptClass);
                if (ainfo.m_ScriptClass == string.Empty)
                {
                    this.m_BuiltinAnnotations.Add(ainfo);
                    if (AnnotationWindow.s_Debug)
                    {
                        str = str + "   " + BaseObjectTools.ClassIDToString(ainfo.m_ClassID) + ": icon " + (object)ainfo.m_IconEnabled + " gizmo " + (object)ainfo.m_GizmoEnabled + "\n";
                    }
                }
                else
                {
                    this.m_ScriptAnnotations.Add(ainfo);
                    if (AnnotationWindow.s_Debug)
                    {
                        str = str + "   " + annotations[index].scriptClass + ": icon " + (object)ainfo.m_IconEnabled + " gizmo " + (object)ainfo.m_GizmoEnabled + "\n";
                    }
                }
            }
            this.m_BuiltinAnnotations.Sort();
            this.m_ScriptAnnotations.Sort();
            this.m_RecentAnnotations = new List <AInfo>();
            Annotation[] changedAnnotations = AnnotationUtility.GetRecentlyChangedAnnotations();
            for (int index = 0; index < changedAnnotations.Length && index < 5; ++index)
            {
                AInfo ainfo = this.GetAInfo(changedAnnotations[index].classID, changedAnnotations[index].scriptClass);
                if (ainfo != null)
                {
                    this.m_RecentAnnotations.Add(ainfo);
                }
            }
            this.m_SyncWithState = false;
            if (!AnnotationWindow.s_Debug)
            {
                return;
            }
            Debug.Log((object)str);
        }
        private void SyncToState()
        {
            Annotation[] annotations = AnnotationUtility.GetAnnotations();
            string       text        = "";

            if (AnnotationWindow.s_Debug)
            {
                text += "AnnotationWindow: SyncToState\n";
            }
            this.m_BuiltinAnnotations = new List <AInfo>();
            this.m_ScriptAnnotations  = new List <AInfo>();
            for (int i = 0; i < annotations.Length; i++)
            {
                if (AnnotationWindow.s_Debug)
                {
                    string text2 = text;
                    text = string.Concat(new object[]
                    {
                        text2,
                        "   same as below: icon ",
                        annotations[i].iconEnabled,
                        " gizmo ",
                        annotations[i].gizmoEnabled,
                        "\n"
                    });
                }
                bool  gizmoEnabled = annotations[i].gizmoEnabled == 1;
                bool  iconEnabled  = annotations[i].iconEnabled == 1;
                AInfo aInfo        = new AInfo(gizmoEnabled, iconEnabled, annotations[i].flags, annotations[i].classID, annotations[i].scriptClass);
                if (aInfo.m_ScriptClass == "")
                {
                    this.m_BuiltinAnnotations.Add(aInfo);
                    if (AnnotationWindow.s_Debug)
                    {
                        string text2 = text;
                        text = string.Concat(new object[]
                        {
                            text2,
                            "   ",
                            BaseObjectTools.ClassIDToString(aInfo.m_ClassID),
                            ": icon ",
                            aInfo.m_IconEnabled,
                            " gizmo ",
                            aInfo.m_GizmoEnabled,
                            "\n"
                        });
                    }
                }
                else
                {
                    this.m_ScriptAnnotations.Add(aInfo);
                    if (AnnotationWindow.s_Debug)
                    {
                        string text2 = text;
                        text = string.Concat(new object[]
                        {
                            text2,
                            "   ",
                            annotations[i].scriptClass,
                            ": icon ",
                            aInfo.m_IconEnabled,
                            " gizmo ",
                            aInfo.m_GizmoEnabled,
                            "\n"
                        });
                    }
                }
            }
            this.m_BuiltinAnnotations.Sort();
            this.m_ScriptAnnotations.Sort();
            this.m_RecentAnnotations = new List <AInfo>();
            Annotation[] recentlyChangedAnnotations = AnnotationUtility.GetRecentlyChangedAnnotations();
            int          num = 0;

            while (num < recentlyChangedAnnotations.Length && num < 5)
            {
                AInfo aInfo2 = this.GetAInfo(recentlyChangedAnnotations[num].classID, recentlyChangedAnnotations[num].scriptClass);
                if (aInfo2 != null)
                {
                    this.m_RecentAnnotations.Add(aInfo2);
                }
                num++;
            }
            this.m_SyncWithState = false;
            if (AnnotationWindow.s_Debug)
            {
                Debug.Log(text);
            }
        }
        private void SyncToState()
        {
            // Sync annotations
            Annotation[] a = AnnotationUtility.GetAnnotations();

            string debuginfo = "";

            if (s_Debug)
            {
                debuginfo += "AnnotationWindow: SyncToState\n";
            }

            m_BuiltinAnnotations = new List <AInfo>();
            m_ScriptAnnotations  = new List <AInfo>();
            for (int i = 0; i < a.Length; ++i)
            {
                if (s_Debug)
                {
                    debuginfo += "   same as below: icon " + a[i].iconEnabled + " gizmo " + a[i].gizmoEnabled + "\n";
                }

                bool  ge   = (a[i].gizmoEnabled == 1) ? true : false;
                bool  ie   = (a[i].iconEnabled == 1) ? true : false;
                AInfo anno = new AInfo(ge, ie, a[i].flags, a[i].classID, a[i].scriptClass);

                if (anno.m_ScriptClass == "")
                {
                    m_BuiltinAnnotations.Add(anno);
                    if (s_Debug)
                    {
                        debuginfo += "   " + UnityType.FindTypeByPersistentTypeID(anno.m_ClassID).name + ": icon " + anno.m_IconEnabled + " gizmo " + anno.m_GizmoEnabled + "\n";
                    }
                }
                else
                {
                    m_ScriptAnnotations.Add(anno);
                    if (s_Debug)
                    {
                        debuginfo += "   " + a[i].scriptClass + ": icon " + anno.m_IconEnabled + " gizmo " + anno.m_GizmoEnabled + "\n";
                    }
                }
            }

            m_BuiltinAnnotations.Sort();
            m_ScriptAnnotations.Sort();

            // Sync recently changed annotations
            m_RecentAnnotations = new List <AInfo>();
            Annotation[] recent = AnnotationUtility.GetRecentlyChangedAnnotations();
            for (int i = 0; i < recent.Length && i < maxShowRecent; ++i)
            {
                // Note: ainfo can be null if script has been renamed.
                AInfo ainfo = GetAInfo(recent[i].classID, recent[i].scriptClass);
                if (ainfo != null)
                {
                    m_RecentAnnotations.Add(ainfo);
                }
            }

            m_SyncWithState = false;

            if (s_Debug)
            {
                Debug.Log(debuginfo);
            }
        }
示例#4
0
        public static GizmoInfo[] GetGizmoInfo()
        {
            var annotations = AnnotationUtility.GetAnnotations();

            return(annotations.Select(x => new GizmoInfo(x)).ToArray());
        }