private static void DoEditRegularParameters(AnimationEvent evt, Type selectedParameter)
 {
     if (selectedParameter == typeof(AnimationEvent) || selectedParameter == typeof(float))
     {
         evt.floatParameter = EditorGUILayout.FloatField("Float", evt.floatParameter, new GUILayoutOption[0]);
     }
     if (selectedParameter.IsEnum)
     {
         evt.intParameter = AnimationWindowEventInspector.EnumPopup("Enum", selectedParameter, evt.intParameter);
     }
     else if (selectedParameter == typeof(AnimationEvent) || selectedParameter == typeof(int))
     {
         evt.intParameter = EditorGUILayout.IntField("Int", evt.intParameter, new GUILayoutOption[0]);
     }
     if (selectedParameter == typeof(AnimationEvent) || selectedParameter == typeof(string))
     {
         evt.stringParameter = EditorGUILayout.TextField("String", evt.stringParameter, new GUILayoutOption[0]);
     }
     if (selectedParameter == typeof(AnimationEvent) || selectedParameter.IsSubclassOf(typeof(UnityEngine.Object)) || selectedParameter == typeof(UnityEngine.Object))
     {
         Type type = typeof(UnityEngine.Object);
         if (selectedParameter != typeof(AnimationEvent))
         {
             type = selectedParameter;
         }
         bool allowSceneObjects = false;
         evt.objectReferenceParameter = EditorGUILayout.ObjectField(ObjectNames.NicifyVariableName(type.Name), evt.objectReferenceParameter, type, allowSceneObjects, new GUILayoutOption[0]);
     }
 }
Example #2
0
        private static void DoEditRegularParameters(AnimationEvent[] events, Type selectedParameter)
        {
            AnimationEvent firstEvent = events[0];

            if (selectedParameter == typeof(AnimationEvent) || selectedParameter == typeof(float))
            {
                bool flag = Array.TrueForAll <AnimationEvent>(events, (AnimationEvent evt) => evt.floatParameter == firstEvent.floatParameter);
                EditorGUI.BeginChangeCheck();
                EditorGUI.showMixedValue = !flag;
                float floatParameter = EditorGUILayout.FloatField("Float", firstEvent.floatParameter, new GUILayoutOption[0]);
                EditorGUI.showMixedValue = false;
                if (EditorGUI.EndChangeCheck())
                {
                    for (int i = 0; i < events.Length; i++)
                    {
                        AnimationEvent animationEvent = events[i];
                        animationEvent.floatParameter = floatParameter;
                    }
                }
            }
            if (selectedParameter == typeof(AnimationEvent) || selectedParameter == typeof(int) || selectedParameter.IsEnum)
            {
                bool flag2 = Array.TrueForAll <AnimationEvent>(events, (AnimationEvent evt) => evt.intParameter == firstEvent.intParameter);
                EditorGUI.BeginChangeCheck();
                EditorGUI.showMixedValue = !flag2;
                int intParameter;
                if (selectedParameter.IsEnum)
                {
                    intParameter = AnimationWindowEventInspector.EnumPopup("Enum", selectedParameter, firstEvent.intParameter);
                }
                else
                {
                    intParameter = EditorGUILayout.IntField("Int", firstEvent.intParameter, new GUILayoutOption[0]);
                }
                EditorGUI.showMixedValue = false;
                if (EditorGUI.EndChangeCheck())
                {
                    for (int j = 0; j < events.Length; j++)
                    {
                        AnimationEvent animationEvent2 = events[j];
                        animationEvent2.intParameter = intParameter;
                    }
                }
            }
            if (selectedParameter == typeof(AnimationEvent) || selectedParameter == typeof(string))
            {
                bool flag3 = Array.TrueForAll <AnimationEvent>(events, (AnimationEvent evt) => evt.stringParameter == firstEvent.stringParameter);
                EditorGUI.BeginChangeCheck();
                EditorGUI.showMixedValue = !flag3;
                string stringParameter = EditorGUILayout.TextField("String", firstEvent.stringParameter, new GUILayoutOption[0]);
                EditorGUI.showMixedValue = false;
                if (EditorGUI.EndChangeCheck())
                {
                    for (int k = 0; k < events.Length; k++)
                    {
                        AnimationEvent animationEvent3 = events[k];
                        animationEvent3.stringParameter = stringParameter;
                    }
                }
            }
            if (selectedParameter == typeof(AnimationEvent) || selectedParameter.IsSubclassOf(typeof(UnityEngine.Object)) || selectedParameter == typeof(UnityEngine.Object))
            {
                bool flag4 = Array.TrueForAll <AnimationEvent>(events, (AnimationEvent evt) => evt.objectReferenceParameter == firstEvent.objectReferenceParameter);
                EditorGUI.BeginChangeCheck();
                Type type = typeof(UnityEngine.Object);
                if (selectedParameter != typeof(AnimationEvent))
                {
                    type = selectedParameter;
                }
                EditorGUI.showMixedValue = !flag4;
                bool allowSceneObjects = false;
                UnityEngine.Object objectReferenceParameter = EditorGUILayout.ObjectField(ObjectNames.NicifyVariableName(type.Name), firstEvent.objectReferenceParameter, type, allowSceneObjects, new GUILayoutOption[0]);
                EditorGUI.showMixedValue = false;
                if (EditorGUI.EndChangeCheck())
                {
                    for (int l = 0; l < events.Length; l++)
                    {
                        AnimationEvent animationEvent4 = events[l];
                        animationEvent4.objectReferenceParameter = objectReferenceParameter;
                    }
                }
            }
        }