Пример #1
0
        public void AddEvent(AnimationWindowState state)
        {
            float time  = ((float)state.frame) / state.frameRate;
            int   index = AnimationEventPopup.Create(state.activeRootGameObject, state.activeAnimationClip, time, this.m_Owner);

            this.Select(state.activeAnimationClip, index);
        }
Пример #2
0
        public void EventLineContextMenuEdit(object obj)
        {
            EventLineContextMenuObject obj2 = (EventLineContextMenuObject)obj;

            AnimationEventPopup.Edit(obj2.m_Animated, obj2.m_Clip, obj2.m_Index, this.m_Owner);
            this.Select(obj2.m_Clip, obj2.m_Index);
        }
Пример #3
0
 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 = AnimationEventPopup.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]);
     }
 }
Пример #4
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)");
 }
Пример #5
0
 private void AddEventButtonOnGUI()
 {
     if (GUILayout.Button(AnimationWindowStyles.addEventContent, EditorStyles.toolbarButton, new GUILayoutOption[0]))
     {
         AnimationEventPopup.Create(this.m_State.activeRootGameObject, this.m_State.activeAnimationClip, this.m_State.currentTime, this.m_OwnerWindow);
     }
 }
 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)");
 }
Пример #7
0
        public void EventLineContextMenuAdd(object obj)
        {
            AnimationEventTimeLine.EventLineContextMenuObject eventLineContextMenuObject = (AnimationEventTimeLine.EventLineContextMenuObject)obj;
            int index = AnimationEventPopup.Create(eventLineContextMenuObject.m_Animated, eventLineContextMenuObject.m_Clip, eventLineContextMenuObject.m_Time, this.m_Owner);

            this.Select(eventLineContextMenuObject.m_Clip, index);
        }
        private void DoEditLogicGraphEventParameters(AnimationEvent evt)
        {
            if (string.IsNullOrEmpty(this.m_LogicEventName))
            {
                this.m_LogicEventName = evt.stringParameter;
            }
            bool flag = AnimationEventPopup.EnterPressed();

            this.m_LogicEventName = EditorGUILayout.TextField("Event name", this.m_LogicEventName, new GUILayoutOption[0]);
            if (this.m_LogicEventName == evt.stringParameter || this.m_LogicEventName.Trim() == string.Empty)
            {
                return;
            }
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Set", EditorStyles.miniButton, new GUILayoutOption[0]) || flag)
            {
                AnimationEventPopup.RenameAllReferencesToTheLogicGraphAnimationEventInCurrentScene(this.m_Root.GetComponent(typeof(Animation)) as Animation, evt.stringParameter, this.m_LogicEventName);
                evt.stringParameter = this.m_LogicEventName;
                this.LogicGraphEventParameterEditingDone(evt);
                GUI.changed = true;
            }
            if (GUILayout.Button("Cancel", EditorStyles.miniButton, new GUILayoutOption[0]) || AnimationEventPopup.EscapePressed())
            {
                this.LogicGraphEventParameterEditingDone(evt);
            }
            GUILayout.EndHorizontal();
        }
 private static string FormatLogicGraphEvent(AnimationEvent evt)
 {
     return("LogicGraphEvent" + AnimationEventPopup.FormatEventArguments(new Type[]
     {
         typeof(string)
     }, evt));
 }
Пример #10
0
        public void EventLineContextMenuAdd(object obj)
        {
            AnimationEventTimeLine.EventLineContextMenuObject eventLineContextMenuObject = (AnimationEventTimeLine.EventLineContextMenuObject)obj;
            int num = AnimationEventPopup.Create(eventLineContextMenuObject.m_Animated, eventLineContextMenuObject.m_Clip, eventLineContextMenuObject.m_Time, this.m_Owner);

            this.Select(eventLineContextMenuObject.m_Clip, num);
            this.m_EventsSelected      = new bool[AnimationUtility.GetAnimationEvents(eventLineContextMenuObject.m_Clip).Length];
            this.m_EventsSelected[num] = true;
        }
Пример #11
0
        public void EventLineContextMenuAdd(object obj)
        {
            EventLineContextMenuObject obj2 = (EventLineContextMenuObject)obj;
            int index = AnimationEventPopup.Create(obj2.m_Animated, obj2.m_Clip, obj2.m_Time, this.m_Owner);

            this.Select(obj2.m_Clip, index);
            this.m_EventsSelected        = new bool[AnimationUtility.GetAnimationEvents(obj2.m_Clip).Length];
            this.m_EventsSelected[index] = true;
        }
Пример #12
0
        internal static void ClosePopup()
        {
            Object[]            objArray = Resources.FindObjectsOfTypeAll(typeof(AnimationEventPopup));
            AnimationEventPopup popup    = (objArray.Length <= 0) ? null : ((AnimationEventPopup)objArray[0]);

            if (popup != null)
            {
                popup.Close();
            }
        }
Пример #13
0
        internal static void ClosePopup()
        {
            UnityEngine.Object[] array = Resources.FindObjectsOfTypeAll(typeof(AnimationEventPopup));
            AnimationEventPopup  animationEventPopup = (array.Length <= 0) ? null : ((AnimationEventPopup)array[0]);

            if (animationEventPopup != null)
            {
                animationEventPopup.Close();
            }
        }
        internal static void ClosePopup()
        {
            UnityEngine.Object[] objectsOfTypeAll    = Resources.FindObjectsOfTypeAll(typeof(AnimationEventPopup));
            AnimationEventPopup  animationEventPopup = objectsOfTypeAll.Length <= 0 ? (AnimationEventPopup)null : (AnimationEventPopup)objectsOfTypeAll[0];

            if (!((UnityEngine.Object)animationEventPopup != (UnityEngine.Object)null))
            {
                return;
            }
            animationEventPopup.Close();
        }
Пример #15
0
 private static string GetEventNameForLogicGraphEvent(IEnumerable <AnimationEvent> events, AnimationEvent animEvent)
 {
     for (int i = 1; i < 1000; i++)
     {
         string name = "LogicGraphEvent" + i;
         if (!events.Any((AnimationEvent evt) => AnimationEventPopup.IsLogicGraphEvent(evt) && evt.stringParameter == name))
         {
             string text = "LogicGraphEvent" + i;
             animEvent.stringParameter = text;
             return(text);
         }
     }
     return(string.Empty);
 }
Пример #16
0
        internal static void UpdateSelection(GameObject root, AnimationClip clip, int index, EditorWindow owner)
        {
            UnityEngine.Object[] array = Resources.FindObjectsOfTypeAll(typeof(AnimationEventPopup));
            AnimationEventPopup  animationEventPopup = (array.Length <= 0) ? null : ((AnimationEventPopup)array[0]);

            if (animationEventPopup == null)
            {
                return;
            }
            animationEventPopup.m_Root     = root;
            animationEventPopup.m_Clip     = clip;
            animationEventPopup.eventIndex = index;
            animationEventPopup.m_Owner    = owner;
            animationEventPopup.Repaint();
        }
        internal static void UpdateSelection(GameObject root, AnimationClip clip, int index, EditorWindow owner)
        {
            UnityEngine.Object[] objectsOfTypeAll    = Resources.FindObjectsOfTypeAll(typeof(AnimationEventPopup));
            AnimationEventPopup  animationEventPopup = objectsOfTypeAll.Length <= 0 ? (AnimationEventPopup)null : (AnimationEventPopup)objectsOfTypeAll[0];

            if ((UnityEngine.Object)animationEventPopup == (UnityEngine.Object)null)
            {
                return;
            }
            animationEventPopup.m_Root     = root;
            animationEventPopup.m_Clip     = clip;
            animationEventPopup.eventIndex = index;
            animationEventPopup.m_Owner    = owner;
            animationEventPopup.Repaint();
        }
Пример #18
0
        internal static int Create(GameObject root, AnimationClip clip, float time, EditorWindow owner)
        {
            AnimationEvent evt = new AnimationEvent {
                time = time
            };
            int num = InsertAnimationEvent(ref AnimationUtility.GetAnimationEvents(clip), clip, evt);
            AnimationEventPopup window = EditorWindow.GetWindow <AnimationEventPopup>(true);

            InitWindow(window);
            window.m_Root     = root;
            window.m_Clip     = clip;
            window.eventIndex = num;
            window.m_Owner    = owner;
            return(num);
        }
Пример #19
0
        internal static void Edit(GameObject root, AnimationClip clip, int index, EditorWindow owner)
        {
            UnityEngine.Object[] objArray = Resources.FindObjectsOfTypeAll(typeof(AnimationEventPopup));
            AnimationEventPopup  window   = (objArray.Length <= 0) ? null : ((AnimationEventPopup)objArray[0]);

            if (window == null)
            {
                window = EditorWindow.GetWindow <AnimationEventPopup>(true);
                InitWindow(window);
            }
            window.m_Root     = root;
            window.m_Clip     = clip;
            window.eventIndex = index;
            window.m_Owner    = owner;
            window.Repaint();
        }
        internal static void Edit(AnimationClipInfoProperties clipInfo, int index)
        {
            UnityEngine.Object[] objectsOfTypeAll = Resources.FindObjectsOfTypeAll(typeof(AnimationEventPopup));
            AnimationEventPopup  popup            = objectsOfTypeAll.Length <= 0 ? (AnimationEventPopup)null : (AnimationEventPopup)objectsOfTypeAll[0];

            if ((UnityEngine.Object)popup == (UnityEngine.Object)null)
            {
                popup = EditorWindow.GetWindow <AnimationEventPopup>(true);
                AnimationEventPopup.InitWindow(popup);
            }
            popup.m_Root     = (GameObject)null;
            popup.m_Clip     = (AnimationClip)null;
            popup.m_ClipInfo = clipInfo;
            popup.eventIndex = index;
            popup.Repaint();
        }
Пример #21
0
        internal static void Edit(AnimationClipInfoProperties clipInfo, int index)
        {
            UnityEngine.Object[] array = Resources.FindObjectsOfTypeAll(typeof(AnimationEventPopup));
            AnimationEventPopup  animationEventPopup = (array.Length <= 0) ? null : ((AnimationEventPopup)array[0]);

            if (animationEventPopup == null)
            {
                animationEventPopup = EditorWindow.GetWindow <AnimationEventPopup>(true);
                AnimationEventPopup.InitWindow(animationEventPopup);
            }
            animationEventPopup.m_Root     = null;
            animationEventPopup.m_Clip     = null;
            animationEventPopup.m_ClipInfo = clipInfo;
            animationEventPopup.eventIndex = index;
            animationEventPopup.Repaint();
        }
        internal static void Edit(GameObject root, AnimationClip clip, int index, EditorWindow owner)
        {
            UnityEngine.Object[] objectsOfTypeAll = Resources.FindObjectsOfTypeAll(typeof(AnimationEventPopup));
            AnimationEventPopup  popup            = objectsOfTypeAll.Length <= 0 ? (AnimationEventPopup)null : (AnimationEventPopup)objectsOfTypeAll[0];

            if ((UnityEngine.Object)popup == (UnityEngine.Object)null)
            {
                popup = EditorWindow.GetWindow <AnimationEventPopup>(true);
                AnimationEventPopup.InitWindow(popup);
            }
            popup.m_Root     = root;
            popup.m_Clip     = clip;
            popup.eventIndex = index;
            popup.m_Owner    = owner;
            popup.Repaint();
        }
Пример #23
0
        internal static void Edit(AnimationClipInfoProperties clipInfo, int index)
        {
            UnityEngine.Object[] objArray = Resources.FindObjectsOfTypeAll(typeof(AnimationEventPopup));
            AnimationEventPopup  window   = (objArray.Length <= 0) ? null : ((AnimationEventPopup)objArray[0]);

            if (window == null)
            {
                window = EditorWindow.GetWindow <AnimationEventPopup>(true);
                InitWindow(window);
            }
            window.m_Root     = null;
            window.m_Clip     = null;
            window.m_ClipInfo = clipInfo;
            window.eventIndex = index;
            window.Repaint();
        }
Пример #24
0
        private void AddEventButtonOnGUI()
        {
            if (this.m_State.policy != null && !this.m_State.policy.allowAddEvent)
            {
                return;
            }
            AnimationWindowSelectionItem selectedItem = this.m_State.selectedItem;

            if (selectedItem != null)
            {
                using (new EditorGUI.DisabledScope(!selectedItem.animationIsEditable))
                {
                    if (GUILayout.Button(AnimationWindowStyles.addEventContent, EditorStyles.toolbarButton, new GUILayoutOption[0]))
                    {
                        AnimationEventPopup.Create(selectedItem.rootGameObject, selectedItem.animationClip, this.m_State.currentTime - selectedItem.timeOffset, this.m_OwnerWindow);
                    }
                }
            }
        }
Пример #25
0
        private bool DeleteEvents(ref AnimationEvent[] eventList, bool[] deleteIndices)
        {
            bool flag = false;

            for (int index = eventList.Length - 1; index >= 0; --index)
            {
                if (deleteIndices[index])
                {
                    ArrayUtility.RemoveAt <AnimationEvent>(ref eventList, index);
                    flag = true;
                }
            }
            if (flag)
            {
                AnimationEventPopup.ClosePopup();
                this.m_EventsSelected = new bool[eventList.Length];
            }
            return(flag);
        }
Пример #26
0
        private void DeleteEvents(AnimationClip clip, bool[] deleteIndices)
        {
            bool flag = false;
            List <AnimationEvent> list = new List <AnimationEvent>(AnimationUtility.GetAnimationEvents(clip));

            for (int i = list.Count - 1; i >= 0; i--)
            {
                if (deleteIndices[i])
                {
                    list.RemoveAt(i);
                    flag = true;
                }
            }
            if (flag)
            {
                AnimationEventPopup.ClosePopup();
                Undo.RegisterCompleteObjectUndo(clip, "Delete Event");
                AnimationUtility.SetAnimationEvents(clip, list.ToArray());
                this.m_EventsSelected = new bool[list.Count];
                this.m_DirtyTooltip   = true;
            }
        }
Пример #27
0
        private void DeleteEvents(AnimationClip clip, bool[] deleteIndices)
        {
            bool flag = false;
            List <AnimationEvent> animationEventList = new List <AnimationEvent>((IEnumerable <AnimationEvent>)AnimationUtility.GetAnimationEvents(clip));

            for (int index = animationEventList.Count - 1; index >= 0; --index)
            {
                if (deleteIndices[index])
                {
                    animationEventList.RemoveAt(index);
                    flag = true;
                }
            }
            if (!flag)
            {
                return;
            }
            AnimationEventPopup.ClosePopup();
            Undo.RegisterCompleteObjectUndo((UnityEngine.Object)clip, "Delete Event");
            AnimationUtility.SetAnimationEvents(clip, animationEventList.ToArray());
            this.m_EventsSelected = new bool[animationEventList.Count];
            this.m_DirtyTooltip   = true;
        }
Пример #28
0
        public void EventLineGUI(Rect rect, AnimationWindowState state)
        {
            AnimationClip activeAnimationClip  = state.activeAnimationClip;
            GameObject    activeRootGameObject = state.activeRootGameObject;

            if (activeRootGameObject == null)
            {
                return;
            }
            GUI.BeginGroup(rect);
            Color color = GUI.color;
            Rect  rect2 = new Rect(0f, 0f, rect.width, rect.height);
            float time  = Mathf.Max((float)Mathf.RoundToInt(state.PixelToTime(Event.current.mousePosition.x, rect) * state.frameRate) / state.frameRate, 0f);

            if (activeAnimationClip != null)
            {
                AnimationEvent[] animationEvents = AnimationUtility.GetAnimationEvents(activeAnimationClip);
                Texture          image           = EditorGUIUtility.IconContent("Animation.EventMarker").image;
                Rect[]           array           = new Rect[animationEvents.Length];
                Rect[]           array2          = new Rect[animationEvents.Length];
                int num  = 1;
                int num2 = 0;
                for (int i = 0; i < animationEvents.Length; i++)
                {
                    AnimationEvent animationEvent = animationEvents[i];
                    if (num2 == 0)
                    {
                        num = 1;
                        while (i + num < animationEvents.Length && animationEvents[i + num].time == animationEvent.time)
                        {
                            num++;
                        }
                        num2 = num;
                    }
                    num2--;
                    float num3 = Mathf.Floor(state.FrameToPixel(animationEvent.time * activeAnimationClip.frameRate, rect));
                    int   num4 = 0;
                    if (num > 1)
                    {
                        float num5 = (float)Mathf.Min((num - 1) * (image.width - 1), (int)(state.FrameDeltaToPixel(rect) - (float)(image.width * 2)));
                        num4 = Mathf.FloorToInt(Mathf.Max(0f, num5 - (float)((image.width - 1) * num2)));
                    }
                    Rect rect3 = new Rect(num3 + (float)num4 - (float)(image.width / 2), (rect.height - 10f) * (float)(num2 - num + 1) / (float)Mathf.Max(1, num - 1), (float)image.width, (float)image.height);
                    array[i]  = rect3;
                    array2[i] = rect3;
                }
                if (this.m_DirtyTooltip)
                {
                    if (this.m_HoverEvent >= 0 && this.m_HoverEvent < array.Length)
                    {
                        this.m_InstantTooltipText  = AnimationEventPopup.FormatEvent(activeRootGameObject, animationEvents[this.m_HoverEvent]);
                        this.m_InstantTooltipPoint = new Vector2(array[this.m_HoverEvent].xMin + (float)((int)(array[this.m_HoverEvent].width / 2f)) + rect.x - 30f, rect.yMax);
                    }
                    this.m_DirtyTooltip = false;
                }
                if (this.m_EventsSelected == null || this.m_EventsSelected.Length != animationEvents.Length)
                {
                    this.m_EventsSelected = new bool[animationEvents.Length];
                    AnimationEventPopup.ClosePopup();
                }
                Vector2        zero = Vector2.zero;
                int            num6;
                float          num7;
                float          num8;
                HighLevelEvent highLevelEvent = EditorGUIExt.MultiSelection(rect, array2, new GUIContent(image), array, ref this.m_EventsSelected, null, out num6, out zero, out num7, out num8, GUIStyle.none);
                if (highLevelEvent != HighLevelEvent.None)
                {
                    switch (highLevelEvent)
                    {
                    case HighLevelEvent.DoubleClick:
                        if (num6 != -1)
                        {
                            AnimationEventPopup.Edit(activeRootGameObject, state.activeAnimationClip, num6, this.m_Owner);
                        }
                        else
                        {
                            this.EventLineContextMenuAdd(new AnimationEventTimeLine.EventLineContextMenuObject(activeRootGameObject, activeAnimationClip, time, -1));
                        }
                        break;

                    case HighLevelEvent.ContextClick:
                    {
                        GenericMenu genericMenu = new GenericMenu();
                        AnimationEventTimeLine.EventLineContextMenuObject userData = new AnimationEventTimeLine.EventLineContextMenuObject(activeRootGameObject, activeAnimationClip, animationEvents[num6].time, num6);
                        genericMenu.AddItem(new GUIContent("Edit Animation Event"), false, new GenericMenu.MenuFunction2(this.EventLineContextMenuEdit), userData);
                        genericMenu.AddItem(new GUIContent("Add Animation Event"), false, new GenericMenu.MenuFunction2(this.EventLineContextMenuAdd), userData);
                        genericMenu.AddItem(new GUIContent("Delete Animation Event"), false, new GenericMenu.MenuFunction2(this.EventLineContextMenuDelete), userData);
                        genericMenu.ShowAsContext();
                        this.m_InstantTooltipText = null;
                        this.m_DirtyTooltip       = true;
                        state.Repaint();
                        break;
                    }

                    case HighLevelEvent.BeginDrag:
                        this.m_EventsAtMouseDown = animationEvents;
                        this.m_EventTimes        = new float[animationEvents.Length];
                        for (int j = 0; j < animationEvents.Length; j++)
                        {
                            this.m_EventTimes[j] = animationEvents[j].time;
                        }
                        break;

                    case HighLevelEvent.Drag:
                    {
                        for (int k = animationEvents.Length - 1; k >= 0; k--)
                        {
                            if (this.m_EventsSelected[k])
                            {
                                AnimationEvent animationEvent2 = this.m_EventsAtMouseDown[k];
                                animationEvent2.time = this.m_EventTimes[k] + zero.x * state.PixelDeltaToTime(rect);
                                animationEvent2.time = Mathf.Max(0f, animationEvent2.time);
                                animationEvent2.time = (float)Mathf.RoundToInt(animationEvent2.time * activeAnimationClip.frameRate) / activeAnimationClip.frameRate;
                            }
                        }
                        int[] array3 = new int[this.m_EventsSelected.Length];
                        for (int l = 0; l < array3.Length; l++)
                        {
                            array3[l] = l;
                        }
                        Array.Sort(this.m_EventsAtMouseDown, array3, new AnimationEventTimeLine.EventComparer());
                        bool[]  array4 = (bool[])this.m_EventsSelected.Clone();
                        float[] array5 = (float[])this.m_EventTimes.Clone();
                        for (int m = 0; m < array3.Length; m++)
                        {
                            this.m_EventsSelected[m] = array4[array3[m]];
                            this.m_EventTimes[m]     = array5[array3[m]];
                        }
                        Undo.RegisterCompleteObjectUndo(activeAnimationClip, "Move Event");
                        AnimationUtility.SetAnimationEvents(activeAnimationClip, this.m_EventsAtMouseDown);
                        this.m_DirtyTooltip = true;
                        break;
                    }

                    case HighLevelEvent.Delete:
                        this.DeleteEvents(activeAnimationClip, this.m_EventsSelected);
                        break;

                    case HighLevelEvent.SelectionChanged:
                        state.ClearKeySelections();
                        if (num6 != -1)
                        {
                            AnimationEventPopup.UpdateSelection(activeRootGameObject, state.activeAnimationClip, num6, this.m_Owner);
                        }
                        break;
                    }
                }
                this.CheckRectsOnMouseMove(rect, animationEvents, array);
            }
            if (Event.current.type == EventType.ContextClick && rect2.Contains(Event.current.mousePosition))
            {
                Event.current.Use();
                GenericMenu genericMenu2 = new GenericMenu();
                genericMenu2.AddItem(new GUIContent("Add Animation Event"), false, new GenericMenu.MenuFunction2(this.EventLineContextMenuAdd), new AnimationEventTimeLine.EventLineContextMenuObject(activeRootGameObject, activeAnimationClip, time, -1));
                genericMenu2.ShowAsContext();
            }
            GUI.color = color;
            GUI.EndGroup();
        }
Пример #29
0
        public void AddEvent(float time, GameObject rootGameObject, AnimationClip animationClip)
        {
            int index = AnimationEventPopup.Create(rootGameObject, animationClip, time, this.m_Owner);

            this.Select(animationClip, index);
        }
Пример #30
0
 public void EventLineContextMenuEdit(object obj)
 {
     AnimationEventTimeLine.EventLineContextMenuObject eventLineContextMenuObject = (AnimationEventTimeLine.EventLineContextMenuObject)obj;
     AnimationEventPopup.Edit(eventLineContextMenuObject.m_Animated, eventLineContextMenuObject.m_Clip, eventLineContextMenuObject.m_Index, this.m_Owner);
     this.Select(eventLineContextMenuObject.m_Clip, eventLineContextMenuObject.m_Index);
 }
		internal static void InitWindow(AnimationEventPopup popup)
		{
			popup.minSize = new Vector2(400f, 140f);
			popup.maxSize = new Vector2(400f, 140f);
			popup.title = EditorGUIUtility.TextContent("UnityEditor.AnimationEventPopup").text;
		}