public static string FormatEvent(GameObject root, AnimationEvent evt)
 {
     if (string.IsNullOrEmpty(evt.functionName))
     {
         return("(No Function Selected)");
     }
     if (!AnimationEventPopup.IsSupportedMethodName(evt.functionName))
     {
         return(evt.functionName + " (Function Not Supported)");
     }
     foreach (MonoBehaviour component in root.GetComponents <MonoBehaviour>())
     {
         if (!((UnityEngine.Object)component == (UnityEngine.Object)null))
         {
             System.Type type = component.GetType();
             if (type != typeof(MonoBehaviour) && (type.BaseType == null || !(type.BaseType.Name == "GraphBehaviour")))
             {
                 MethodInfo method = type.GetMethod(evt.functionName, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
                 if (method != null)
                 {
                     IEnumerable <System.Type> paramTypes = ((IEnumerable <System.Reflection.ParameterInfo>)method.GetParameters()).Select <System.Reflection.ParameterInfo, System.Type>((Func <System.Reflection.ParameterInfo, System.Type>)(p => p.ParameterType));
                     return(evt.functionName + AnimationEventPopup.FormatEventArguments(paramTypes, evt));
                 }
             }
         }
     }
     return(evt.functionName + " (Function Not Supported)");
 }
Exemplo n.º 2
0
 public static string FormatEvent(GameObject root, AnimationEvent evt)
 {
     if (string.IsNullOrEmpty(evt.functionName))
     {
         return("(No Function Selected)");
     }
     if (!AnimationEventPopup.IsSupportedMethodName(evt.functionName))
     {
         return(evt.functionName + " (Function Not Supported)");
     }
     MonoBehaviour[] components = root.GetComponents <MonoBehaviour>();
     for (int i = 0; i < components.Length; i++)
     {
         MonoBehaviour monoBehaviour = components[i];
         if (!(monoBehaviour == null))
         {
             Type type = monoBehaviour.GetType();
             if (type != typeof(MonoBehaviour) && (type.BaseType == null || !(type.BaseType.Name == "GraphBehaviour")))
             {
                 MethodInfo method = type.GetMethod(evt.functionName, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
                 if (method != null)
                 {
                     IEnumerable <Type> paramTypes = from p in method.GetParameters()
                                                     select p.ParameterType;
                     return(evt.functionName + AnimationEventPopup.FormatEventArguments(paramTypes, evt));
                 }
             }
         }
     }
     return(evt.functionName + " (Function Not Supported)");
 }
 private static string FormatLogicGraphEvent(AnimationEvent evt)
 {
     return("LogicGraphEvent" + AnimationEventPopup.FormatEventArguments(new Type[]
     {
         typeof(string)
     }, evt));
 }