예제 #1
0
        protected static List <InterceptedEventsPreview.ComponentInterceptedEvents> GetEventsInfo(GameObject gameObject)
        {
            InterceptedEventsPreview.InitializeEvetnsInterfaceCacheIfNeeded();
            List <InterceptedEventsPreview.ComponentInterceptedEvents> list = new List <InterceptedEventsPreview.ComponentInterceptedEvents>();

            MonoBehaviour[] components = gameObject.GetComponents <MonoBehaviour>();
            int             i          = 0;
            int             num        = components.Length;

            while (i < num)
            {
                InterceptedEventsPreview.ComponentInterceptedEvents componentInterceptedEvents = null;
                MonoBehaviour monoBehaviour = components[i];
                if (!(monoBehaviour == null))
                {
                    Type type = monoBehaviour.GetType();
                    if (!InterceptedEventsPreview.s_ComponentEvents2.ContainsKey(type))
                    {
                        List <int> list2 = null;
                        if (typeof(IEventSystemHandler).IsAssignableFrom(type))
                        {
                            for (int j = 0; j < InterceptedEventsPreview.s_EventSystemInterfaces.Count; j++)
                            {
                                Type type2 = InterceptedEventsPreview.s_EventSystemInterfaces[j];
                                if (type2.IsAssignableFrom(type))
                                {
                                    if (list2 == null)
                                    {
                                        list2 = new List <int>();
                                    }
                                    list2.AddRange(InterceptedEventsPreview.s_InterfaceEventSystemEvents[type2]);
                                }
                            }
                        }
                        if (list2 != null)
                        {
                            componentInterceptedEvents = new InterceptedEventsPreview.ComponentInterceptedEvents();
                            componentInterceptedEvents.componentName     = new GUIContent(type.Name);
                            componentInterceptedEvents.interceptedEvents = (from index in list2
                                                                            orderby InterceptedEventsPreview.s_PossibleEvents[index].text
                                                                            select index).ToArray <int>();
                        }
                        InterceptedEventsPreview.s_ComponentEvents2.Add(type, componentInterceptedEvents);
                    }
                    else
                    {
                        componentInterceptedEvents = InterceptedEventsPreview.s_ComponentEvents2[type];
                    }
                    if (componentInterceptedEvents != null)
                    {
                        list.Add(componentInterceptedEvents);
                    }
                }
                i++;
            }
            return(list);
        }
        protected static List <InterceptedEventsPreview.ComponentInterceptedEvents> GetEventsInfo(GameObject gameObject)
        {
            InterceptedEventsPreview.InitializeEvetnsInterfaceCacheIfNeeded();
            List <InterceptedEventsPreview.ComponentInterceptedEvents> interceptedEventsList = new List <InterceptedEventsPreview.ComponentInterceptedEvents>();

            MonoBehaviour[] components = gameObject.GetComponents <MonoBehaviour>();
            int             index1     = 0;

            for (int length = components.Length; index1 < length; ++index1)
            {
                InterceptedEventsPreview.ComponentInterceptedEvents interceptedEvents = (InterceptedEventsPreview.ComponentInterceptedEvents)null;
                MonoBehaviour monoBehaviour = components[index1];
                if (!((UnityEngine.Object)monoBehaviour == (UnityEngine.Object)null))
                {
                    System.Type type = monoBehaviour.GetType();
                    if (!InterceptedEventsPreview.s_ComponentEvents2.ContainsKey(type))
                    {
                        List <int> source = (List <int>)null;
                        if (typeof(IEventSystemHandler).IsAssignableFrom(type))
                        {
                            for (int index2 = 0; index2 < InterceptedEventsPreview.s_EventSystemInterfaces.Count; ++index2)
                            {
                                System.Type eventSystemInterface = InterceptedEventsPreview.s_EventSystemInterfaces[index2];
                                if (eventSystemInterface.IsAssignableFrom(type))
                                {
                                    if (source == null)
                                    {
                                        source = new List <int>();
                                    }
                                    source.AddRange((IEnumerable <int>)InterceptedEventsPreview.s_InterfaceEventSystemEvents[eventSystemInterface]);
                                }
                            }
                        }
                        if (source != null)
                        {
                            interceptedEvents = new InterceptedEventsPreview.ComponentInterceptedEvents();
                            interceptedEvents.componentName     = new GUIContent(type.Name);
                            interceptedEvents.interceptedEvents = source.OrderBy <int, string>((Func <int, string>)(index => InterceptedEventsPreview.s_PossibleEvents[index].text)).ToArray <int>();
                        }
                        InterceptedEventsPreview.s_ComponentEvents2.Add(type, interceptedEvents);
                    }
                    else
                    {
                        interceptedEvents = InterceptedEventsPreview.s_ComponentEvents2[type];
                    }
                    if (interceptedEvents != null)
                    {
                        interceptedEventsList.Add(interceptedEvents);
                    }
                }
            }
            return(interceptedEventsList);
        }