private static GenericMenu BuildPopupList(UnityEngine.Object target, UnityEventBase dummyEvent, SerializedProperty listener) { UnityEngine.Object target1 = target; if (target1 is Component) { target1 = (UnityEngine.Object)(target as Component).gameObject; } SerializedProperty propertyRelative = listener.FindPropertyRelative("m_MethodName"); GenericMenu menu = new GenericMenu(); menu.AddItem(new GUIContent("No Function"), string.IsNullOrEmpty(propertyRelative.stringValue), new GenericMenu.MenuFunction2(UnityEventDrawer.ClearEventFunction), (object)new UnityEventDrawer.UnityEventFunction(listener, (UnityEngine.Object)null, (MethodInfo)null, PersistentListenerMode.EventDefined)); if (target1 == (UnityEngine.Object)null) { return(menu); } menu.AddSeparator(string.Empty); System.Type[] array = ((IEnumerable <System.Reflection.ParameterInfo>)dummyEvent.GetType().GetMethod("Invoke").GetParameters()).Select <System.Reflection.ParameterInfo, System.Type>((Func <System.Reflection.ParameterInfo, System.Type>)(x => x.ParameterType)).ToArray <System.Type>(); UnityEventDrawer.GeneratePopUpForType(menu, target1, false, listener, array); if (target1 is GameObject) { Component[] components = (target1 as GameObject).GetComponents <Component>(); List <string> list = ((IEnumerable <Component>)components).Where <Component>((Func <Component, bool>)(c => (UnityEngine.Object)c != (UnityEngine.Object)null)).Select <Component, string>((Func <Component, string>)(c => c.GetType().Name)).GroupBy <string, string>((Func <string, string>)(x => x)).Where <IGrouping <string, string> >((Func <IGrouping <string, string>, bool>)(g => g.Count <string>() > 1)).Select <IGrouping <string, string>, string>((Func <IGrouping <string, string>, string>)(g => g.Key)).ToList <string>(); foreach (Component component in components) { if (!((UnityEngine.Object)component == (UnityEngine.Object)null)) { UnityEventDrawer.GeneratePopUpForType(menu, (UnityEngine.Object)component, list.Contains(component.GetType().Name), listener, array); } } } return(menu); }
private static GenericMenu BuildPopupList(UnityEngine.Object target, UnityEventBase dummyEvent, SerializedProperty listener) { UnityEngine.Object @object = target; if (@object is Component) { @object = (target as Component).gameObject; } SerializedProperty serializedProperty = listener.FindPropertyRelative("m_MethodName"); GenericMenu genericMenu = new GenericMenu(); GenericMenu arg_6D_0 = genericMenu; GUIContent arg_6D_1 = new GUIContent("No Function"); bool arg_6D_2 = string.IsNullOrEmpty(serializedProperty.stringValue); if (UnityEventDrawer.< > f__mg$cache0 == null) { UnityEventDrawer.< > f__mg$cache0 = new GenericMenu.MenuFunction2(UnityEventDrawer.ClearEventFunction); } arg_6D_0.AddItem(arg_6D_1, arg_6D_2, UnityEventDrawer.< > f__mg$cache0, new UnityEventDrawer.UnityEventFunction(listener, null, null, PersistentListenerMode.EventDefined)); GenericMenu result; if (@object == null) { result = genericMenu; } else { genericMenu.AddSeparator(""); Type type = dummyEvent.GetType(); MethodInfo method = type.GetMethod("Invoke"); Type[] delegateArgumentsTypes = (from x in method.GetParameters() select x.ParameterType).ToArray <Type>(); UnityEventDrawer.GeneratePopUpForType(genericMenu, @object, false, listener, delegateArgumentsTypes); if (@object is GameObject) { Component[] components = (@object as GameObject).GetComponents <Component>(); List <string> list = (from c in components where c != null select c.GetType().Name into x group x by x into g where g.Count <string>() > 1 select g.Key).ToList <string>(); Component[] array = components; for (int i = 0; i < array.Length; i++) { Component component = array[i]; if (!(component == null)) { UnityEventDrawer.GeneratePopUpForType(genericMenu, component, list.Contains(component.GetType().Name), listener, delegateArgumentsTypes); } } } result = genericMenu; } return(result); }