示例#1
0
 private static void InitializeEvetnsInterfaceCacheIfNeeded()
 {
     if (InterceptedEventsPreview.s_EventSystemInterfaces == null)
     {
         InterceptedEventsPreview.s_EventSystemInterfaces      = new List <Type>();
         InterceptedEventsPreview.s_PossibleEvents             = new List <GUIContent>();
         InterceptedEventsPreview.s_InterfaceEventSystemEvents = new Dictionary <Type, List <int> >();
         foreach (Type current in InterceptedEventsPreview.GetAccessibleTypesInLoadedAssemblies())
         {
             if (current.IsInterface)
             {
                 if (typeof(IEventSystemHandler).IsAssignableFrom(current))
                 {
                     InterceptedEventsPreview.s_EventSystemInterfaces.Add(current);
                     List <int>   list    = new List <int>();
                     MethodInfo[] methods = current.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
                     for (int i = 0; i < methods.Length; i++)
                     {
                         MethodInfo methodInfo = methods[i];
                         list.Add(InterceptedEventsPreview.s_PossibleEvents.Count);
                         InterceptedEventsPreview.s_PossibleEvents.Add(new GUIContent(methodInfo.Name));
                     }
                     InterceptedEventsPreview.s_InterfaceEventSystemEvents.Add(current, list);
                 }
             }
         }
     }
 }
 private static void InitializeEvetnsInterfaceCacheIfNeeded()
 {
     if (InterceptedEventsPreview.s_EventSystemInterfaces != null)
     {
         return;
     }
     InterceptedEventsPreview.s_EventSystemInterfaces      = new List <System.Type>();
     InterceptedEventsPreview.s_PossibleEvents             = new List <GUIContent>();
     InterceptedEventsPreview.s_InterfaceEventSystemEvents = new Dictionary <System.Type, List <int> >();
     foreach (System.Type inLoadedAssembly in InterceptedEventsPreview.GetAccessibleTypesInLoadedAssemblies())
     {
         if (inLoadedAssembly.IsInterface && typeof(IEventSystemHandler).IsAssignableFrom(inLoadedAssembly))
         {
             InterceptedEventsPreview.s_EventSystemInterfaces.Add(inLoadedAssembly);
             List <int> intList = new List <int>();
             foreach (MethodInfo method in inLoadedAssembly.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
             {
                 intList.Add(InterceptedEventsPreview.s_PossibleEvents.Count);
                 InterceptedEventsPreview.s_PossibleEvents.Add(new GUIContent(method.Name));
             }
             InterceptedEventsPreview.s_InterfaceEventSystemEvents.Add(inLoadedAssembly, intList);
         }
     }
 }