private GenericMenu MenuForEffectTimeLine(JTimelineBase line, JEffectTrack track)
        {
            GenericMenu contextMenu = new GenericMenu();
            float       newTime     = (((UnityEngine.Event.current.mousePosition.x + XScroll) / DisplayArea.width) * line.Sequence.Duration) / XScale;

            contextMenu.AddItem(new GUIContent("AddNewTrack"),
                                false, (obj) => AddNewEffectTrack(((JTimelineBase)((object[])obj)[0])),
                                new object[] { line });


            foreach (var effectType in Enum.GetValues(typeof(EffectType)))
            {
                string name = Enum.GetName(typeof(EffectType), (EffectType)effectType);
                contextMenu.AddItem(new GUIContent("AddClip/" + name),

                                    false, (obj) => AddNewEffectClip(((JEffectTrack)((object[])obj)[0]), ((EffectType)((object[])obj)[1]), ((float)((object[])obj)[2])),
                                    new object[] { track, (EffectType)effectType, newTime });
            }

            contextMenu.AddItem(new GUIContent("DeleteLine"),
                                false, (obj) => RemoveEffectLine(((JEffectTrack)((object[])obj)[0])),
                                new object[] { track });

            return(contextMenu);
        }
Пример #2
0
        private GenericMenu MenuForEventTimeLine(JTimelineBase line, JEventTrack track)
        {
            GenericMenu contextMenu = new GenericMenu();
            float       newTime     = (((UnityEngine.Event.current.mousePosition.x + XScroll) / DisplayArea.width) * line.Sequence.Duration) / XScale;

            contextMenu.AddItem(new GUIContent("AddNewEventTimeline"),
                                false, (obj) => AddNewEventTrack(((JTimelineBase)((object[])obj)[0])),
                                new object[] { line });

            string baseAdd = "Add Event/";

            var baseType = typeof(JEventBase);
            var types    = USEditorUtility.GetAllSubTypes(baseType).Where(type => type.IsSubclassOf(baseType));

            foreach (Type type in types)
            {
                string fullAdd          = baseAdd;
                var    customAttributes = type.GetCustomAttributes(true).Where(attr => attr is JEventAttribute).Cast <JEventAttribute>();
                foreach (JEventAttribute customAttribute in customAttributes)
                {
                    fullAdd += customAttribute.EventPath;
                }
                contextMenu.AddItem(new GUIContent(fullAdd),
                                    false, (obj) => AddNewTrackEvent(((JEventTrack)((object[])obj)[0]), ((float)((object[])obj)[1]), ((Type)((object[])obj)[2])),
                                    new object[] { track, newTime, type });
            }


            contextMenu.AddItem(new GUIContent("DeleteEventLine"),
                                false, (obj) => RemoveEventTrack(((JEventTrack)((object[])obj)[0])),
                                new object[] { track });

            return(contextMenu);
        }
        private void AddRenderDataForEffect(JTimelineBase timeline)
        {
            if (timeline is JTimelineEffect)
            {
                JTimelineEffect tline = (JTimelineEffect)timeline;
                for (int k = 0; k < tline.EffectTracks.Count; k++)
                {
                    List <JClipRenderData> list  = new List <JClipRenderData>();
                    JEffectTrack           track = tline.EffectTracks[k];
                    for (int l = 0; l < track.TrackClips.Count; l++)
                    {
                        JEffectClipData key        = track.TrackClips[l];
                        var             cachedData = ScriptableObject.CreateInstance <JClipRenderData>();
                        cachedData.ClipData = key;
                        list.Add(cachedData);
                    }

                    if (!timelineClipRenderDataMap.ContainsKey(track))
                    {
                        timelineClipRenderDataMap.Add(track, list);
                    }
                    else
                    {
                        timelineClipRenderDataMap[track] = list;
                    }
                }
            }
        }
Пример #4
0
        //时间线的侧边栏绘制
        private void SideBarAndLineForAnimation(JTimelineBase timeline)
        {
            if (timeline is JTimelineAnimation)
            {
                GUILayout.BeginVertical();
                JTimelineAnimation animationline = (JTimelineAnimation)timeline;
                for (int j = 0; j < animationline.AnimationTracks.Count; j++)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Box(new GUIContent("" + animationline.AffectedObject.name, ""), USEditorUtility.USeqSkin.GetStyle("TimelinePaneBackground"), GUILayout.Height(lineHeight), GUILayout.MaxWidth(FloatingWidth));
                    Rect FloatingRect = GUILayoutUtility.GetLastRect();
                    GUILayout.Box(new GUIContent("", "AnimationTimeline for" + animationline.AffectedObject.name + " Track " + j + " " + animationline.AnimationTracks[j].name), USEditorUtility.USeqSkin.GetStyle("TimelinePaneBackground"), GUILayout.Height(lineHeight), GUILayout.ExpandWidth(true));
                    Rect ContentRect = GUILayoutUtility.GetLastRect();
                    GUILayout.EndHorizontal();

                    //GUILayout.Box("" + animationline.AffectedObject.name, USEditorUtility.USeqSkin.GetStyle("TimelinePaneBackground"), GUILayout.Height(lineHeight), GUILayout.MaxWidth(FloatingWidth));
                    Rect addRect   = FloatingRect;// GUILayoutUtility.GetLastRect();
                    Rect labelRect = addRect;
                    labelRect.x    += 40;
                    labelRect.width = (lineHeight + 41);
                    //标签
                    GUI.Label(labelRect, "Track " + j);
                    //轨道名字
                    Rect nameRect = addRect;
                    nameRect.x     += 40 + lineHeight + 40;
                    nameRect.width -= (lineHeight + 120);
                    //animationline.AnimationTracks[j].name=GUI.TextField(nameRect, animationline.AnimationTracks[j].name);
                    int select = SkillNames.ActionNames.Contains(animationline.AnimationTracks[j].name)? SkillNames.ActionNames.IndexOf(animationline.AnimationTracks[j].name) : 0;
                    select = EditorGUI.Popup(nameRect, select, SkillNames.ActionNames.ToArray());
                    animationline.AnimationTracks[j].name = SkillNames.ActionNames[select];

                    Rect enableRect = addRect;
                    enableRect.x     = addRect.x + addRect.width - 2 * lineHeight - 2.0f;;
                    enableRect.width = lineHeight;
                    //enable开关
                    animationline.AnimationTracks[j].Enable = GUI.Toggle(enableRect, animationline.AnimationTracks[j].Enable, new GUIContent("", USEditorUtility.EditButton, "Enable The Timeline"));

                    addRect.x     = addRect.x + addRect.width - lineHeight - 1.0f;
                    addRect.width = lineHeight;
                    GenericMenu contextMenu = new GenericMenu();
                    if (GUI.Button(addRect, new GUIContent("", USEditorUtility.EditButton, "Options for this Timeline"), USEditorUtility.ToolbarButtonSmall))
                    {
                        contextMenu = MenuForAnimationTimeLine(animationline, animationline.AnimationTracks[j]);
                        contextMenu.ShowAsContext();
                    }

                    if (timelineClipRenderDataMap.ContainsKey(animationline.AnimationTracks[j]))
                    {
                        ///时间线背景 区域 只接受右键
                        // GUILayout.Box(new GUIContent("", "AnimationTimeline for" + animationline.AffectedObject.name + "Track " + j), USEditorUtility.USeqSkin.GetStyle("TimelinePaneBackground"), GUILayout.Height(lineHeight), GUILayout.ExpandWidth(true));
                        DisplayArea = ContentRect;// GUILayoutUtility.GetLastRect();
                        GUI.BeginGroup(DisplayArea);
                        List <JClipRenderData> renderDataList = timelineClipRenderDataMap[animationline.AnimationTracks[j]];
                        AnimationGUI(animationline, animationline.AnimationTracks[j], renderDataList.ToArray());
                        GUI.EndGroup();
                    }
                }
                GUILayout.EndVertical();
            }
        }
Пример #5
0
        private GenericMenu MenuForTransformTimeLine(JTimelineBase line, JTransformTrack track)
        {
            GenericMenu contextMenu = new GenericMenu();
            float       newTime     = (((UnityEngine.Event.current.mousePosition.x + XScroll) / DisplayArea.width) * line.Sequence.Duration) / XScale;

            contextMenu.AddItem(new GUIContent("AddNewTrack"),
                                false, (obj) => AddNewTransFormTrack(((JTimelineBase)((object[])obj)[0])),
                                new object[] { line });

            contextMenu.AddItem(new GUIContent("AddKeyFrame"),
                                false, (obj) => AddNewKeyFrameWithOutIndex(((JTransformTrack)((object[])obj)[0]), ((float)((object[])obj)[1])),
                                new object[] { track, newTime });

            string closestate = track.ObjectSpline.IsClosed ? "Open The Path" : "Close The Path";

            contextMenu.AddItem(new GUIContent(closestate),
                                false, (obj) => CloseThePath(((JTransformTrack)((object[])obj)[0])),
                                new object[] { track });

            contextMenu.AddItem(new GUIContent("DeleteTransformLine"),
                                false, (obj) => RemoveTransformLine(((JTransformTrack)((object[])obj)[0])),
                                new object[] { track });

            return(contextMenu);
        }
Пример #6
0
 private void AddRenderDataForTransform(JTimelineBase timeline)
 {
     if (timeline is JTimelineTransform)
     {
         JTimelineTransform tline = (JTimelineTransform)timeline;
         for (int k = 0; k < tline.Tracks.Count; k++)
         {
             List <JClipRenderData> list  = new List <JClipRenderData>();
             JTransformTrack        track = tline.Tracks[k];
             for (int l = 0; l < track.Keyframes.Count; l++)
             {
                 JSplineKeyframe key        = track.Keyframes[l];
                 var             cachedData = ScriptableObject.CreateInstance <JClipRenderData>();
                 cachedData.ClipData = key;
                 list.Add(cachedData);
             }
             if (!timelineClipRenderDataMap.ContainsKey(track))
             {
                 timelineClipRenderDataMap.Add(track, list);
             }
             else
             {
                 timelineClipRenderDataMap[track] = list;
             }
         }
     }
 }
        private void SideBarAndLineForParticle(JTimelineBase timeline)
        {
            if (timeline == null)
            {
                return;
            }
            if (timeline is JTimelineParticle)
            {
                GUILayout.BeginVertical();

                JTimelineParticle particleline = (JTimelineParticle)timeline;
                for (int j = 0; j < particleline.ParticleTracks.Count; j++)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Box(new GUIContent("" + particleline.AffectedObject.name, ""), USEditorUtility.USeqSkin.GetStyle("TimelinePaneBackground"), GUILayout.Height(lineHeight), GUILayout.MaxWidth(FloatingWidth));
                    Rect FloatingRect = GUILayoutUtility.GetLastRect();
                    GUILayout.Box(new GUIContent("", "ParticleTimeline for" + particleline.AffectedObject.name + "Track " + j), USEditorUtility.USeqSkin.GetStyle("TimelinePaneBackground"), GUILayout.Height(lineHeight), GUILayout.ExpandWidth(true));
                    Rect ContentRect = GUILayoutUtility.GetLastRect();
                    GUILayout.EndHorizontal();

                    // GUILayout.Box("" + particleline.AffectedObject.name, USEditorUtility.USeqSkin.GetStyle("TimelinePaneBackground"), GUILayout.Height(lineHeight), GUILayout.ExpandWidth(true));
                    Rect addRect   = FloatingRect;// GUILayoutUtility.GetLastRect();
                    Rect labelRect = addRect;
                    labelRect.x     += 40;
                    labelRect.width -= (lineHeight + 41);
                    GUI.Label(labelRect, "Track " + j);

                    //轨道名字
                    Rect nameRect = addRect;
                    nameRect.x     += 40 + lineHeight + 40;
                    nameRect.width -= (lineHeight + 120);
                    particleline.ParticleTracks[j].name = GUI.TextField(nameRect, particleline.ParticleTracks[j].name);

                    Rect enableRect = addRect;
                    enableRect.x     = addRect.x + addRect.width - 2 * lineHeight - 2.0f;;
                    enableRect.width = lineHeight;
                    //enable开关
                    particleline.ParticleTracks[j].Enable = GUI.Toggle(enableRect, particleline.ParticleTracks[j].Enable, new GUIContent("", USEditorUtility.EditButton, "Enable The Timeline"));

                    addRect.x     = addRect.x + addRect.width - lineHeight - 1.0f;
                    addRect.width = lineHeight;
                    GenericMenu contextMenu = new GenericMenu();

                    if (GUI.Button(addRect, new GUIContent("", USEditorUtility.EditButton, "Options for this Timeline"), USEditorUtility.ToolbarButtonSmall))
                    {
                        contextMenu = MenuForParticleTimeLine(particleline, particleline.ParticleTracks[j]);
                        contextMenu.ShowAsContext();
                    }
                    if (timelineClipRenderDataMap.ContainsKey(particleline.ParticleTracks[j]))
                    {
                        DisplayArea = ContentRect;// GUILayoutUtility.GetLastRect();
                        GUI.BeginGroup(DisplayArea);
                        List <JClipRenderData> renderDataList = timelineClipRenderDataMap[particleline.ParticleTracks[j]];
                        ParticleGUI(particleline, particleline.ParticleTracks[j], renderDataList.ToArray());
                        GUI.EndGroup();
                    }
                }
                GUILayout.EndVertical();
            }
        }
 private void AddRenderDataForParticle(JTimelineBase timeline)
 {
     if (timeline is JTimelineParticle)
     {
         JTimelineParticle      particleline = (JTimelineParticle)timeline;
         List <JClipRenderData> list         = new List <JClipRenderData>();
         for (int i = 0; i < particleline.ParticleTracks.Count; i++)
         {
             JParticleTrack track = particleline.ParticleTracks[i];
             if (track)
             {
                 for (int j = 0; j < track.TrackClips.Count; j++)
                 {
                     JParticleClipData ClipData = track.TrackClips[j];
                     var cachedData             = ScriptableObject.CreateInstance <JClipRenderData>();
                     cachedData.ClipData = ClipData;
                     list.Add(cachedData);
                 }
                 if (!timelineClipRenderDataMap.ContainsKey(track))
                 {
                     timelineClipRenderDataMap.Add(track, list);
                 }
             }
         }
     }
 }
Пример #9
0
 private void AddNewCameraTrack(JTimelineBase line)
 {
     if (line is JTimelineCamera)
     {
         JTimelineCamera tline = (JTimelineCamera)line;
         var             track = ScriptableObject.CreateInstance <JCameraTrack>();
         tline.AddTrack(track);
         AddRenderDataForCamera(tline);
     }
 }
 private void AddNewEffectTrack(JTimelineBase line)
 {
     if (line is JTimelineEffect)
     {
         JTimelineEffect tline = (JTimelineEffect)line;
         var             track = ScriptableObject.CreateInstance <JEffectTrack>();
         tline.AddTrack(track);
         AddRenderDataForEffect(tline);
     }
 }
Пример #11
0
 private void AddNewAnimationTrack(JTimelineBase line)
 {
     if (line is JTimelineAnimation)
     {
         JTimelineAnimation tline = (JTimelineAnimation)line;
         var track = ScriptableObject.CreateInstance <JAnimationTrack>();
         tline.AddTrack(track);
         AddRenderDataForAnimation(tline);
     }
 }
Пример #12
0
 private void AddNewSoundTrack(JTimelineBase line)
 {
     if (line is JTimelineSound)
     {
         JTimelineSound tline = (JTimelineSound)line;
         var            track = ScriptableObject.CreateInstance <JSoundTrack>();
         tline.AddTrack(track);
         AddRenderDataForSound(tline);
     }
 }
 private void AddNewTrajectoryTrack(JTimelineBase line)
 {
     if (line is JTimelineTrajectory)
     {
         JTimelineTrajectory tline = (JTimelineTrajectory)line;
         var track = ScriptableObject.CreateInstance <JTrajectoryTrack>();
         tline.AddTrack(track);
         AddRenderDataForTrajectory(tline);
     }
 }
 private void AddNewParticleTrack(JTimelineBase line)
 {
     if (line is JTimelineParticle)
     {
         JTimelineParticle tline = (JTimelineParticle)line;
         var track = ScriptableObject.CreateInstance <JParticleTrack>();
         tline.AddTrack(track);
         AddRenderDataForParticle(tline);
     }
 }
Пример #15
0
 private void AddNewTransFormTrack(JTimelineBase line)
 {
     if (line is JTimelineTransform)
     {
         JTimelineTransform tline = (JTimelineTransform)line;
         var track = ScriptableObject.CreateInstance <JTransformTrack>();
         tline.AddTrack(track);
         tline.Build();
         AddRenderDataForTransform(tline);
     }
 }
Пример #16
0
 public ContextData(int controlId, Type type, Type pairedType, JTimelineBase line, JSoundTrack track, string category, string label, float firetime)
 {
     ControlID  = controlId;
     Type       = type;
     PairedType = pairedType;
     Line       = line;
     Track      = track;
     Category   = category;
     Label      = label;
     Firetime   = firetime;
 }
Пример #17
0
 /// <summary>
 /// 移除时间线的渲染数据
 /// </summary>
 /// <param name="line"></param>
 public void RemoveTimeLine(JTimelineBase line)
 {/*
   * if (CurrentSequence)
   * {
   * if (line is JTimelineAnimation)
   *     RemoveAnimationTimeline((JTimelineAnimation)line);
   * else
   * if (line is JTimeLineParticle)
   *     RemoveParticleTimeline((JTimeLineParticle)line);
   * if (line is JTimelineSound)
   *     RemoveSoundTimeline((JTimelineSound)line);
   *
   * }*/
 }
Пример #18
0
 /// <summary>
 /// 添加新的时间线渲染数据
 /// </summary>
 /// <param name="line"></param>
 public void AddNewTimeLineForRender(JTimelineBase line)
 {
     if (CurrentSequence)
     {
         #region ExtensionRegion
         AddRenderDataForAnimation(line);
         AddRenderDataForParticle(line);
         AddRenderDataForSound(line);
         AddRenderDataForTransform(line);
         AddRenderDataForEvent(line);
         AddRenderDataForTrajectory(line);
         AddRenderDataForCamera(line);
         AddRenderDataForEffect(line);
         #endregion
     }
 }
Пример #19
0
 public void AddNewTrack(JTimelineBase line)
 {
     if (CurrentSequence)
     {
         #region ExtensionRegion
         AddNewAnimationTrack(line);
         AddNewSoundTrack(line);
         AddNewParticleTrack(line);
         AddNewTransFormTrack(line);
         AddNewEventTrack(line);
         AddNewTrajectoryTrack(line);
         AddNewCameraTrack(line);
         AddNewEffectTrack(line);
         #endregion
     }
 }
        public JTimelineBase AddNewTimeline(TimeLineType type)
        {
            JTimelineBase timeline = null;
            string        name     = Enum.GetName(typeof(TimeLineType), type);

            UnityEngine.Transform line = transform.Find(name + "Timeline for " + affectedObject.name);
            if (line == null)
            {
                GameObject newTimeline = new GameObject(name + "Timeline for " + affectedObject.name);
                newTimeline.transform.parent = transform;
                line = newTimeline.transform;
            }

            if (type == TimeLineType.Animation && (timeline = line.GetComponent <JTimelineAnimation>()) == null)
            {
                timeline = line.gameObject.AddComponent <JTimelineAnimation>();
            }
            if (type == TimeLineType.Particle && (timeline = line.GetComponent <JTimelineParticle>()) == null)
            {
                timeline = line.gameObject.AddComponent <JTimelineParticle>();
            }
            if (type == TimeLineType.Sound && (timeline = line.GetComponent <JTimelineSound>()) == null)
            {
                timeline = line.gameObject.AddComponent <JTimelineSound>();
            }
            if (type == TimeLineType.Transform && (timeline = line.GetComponent <JTimelineTransform>()) == null)
            {
                timeline = line.gameObject.AddComponent <JTimelineTransform>();
            }
            if (type == TimeLineType.Event && (timeline = line.GetComponent <JTimelineEvent>()) == null)
            {
                timeline = line.gameObject.AddComponent <JTimelineEvent>();
            }
            if (type == TimeLineType.Trajectory && (timeline = line.GetComponent <JTimelineTrajectory>()) == null)
            {
                timeline = line.gameObject.AddComponent <JTimelineTrajectory>();
            }
            if (type == TimeLineType.CameraAction && (timeline = line.GetComponent <JTimelineCamera>()) == null)
            {
                timeline = line.gameObject.AddComponent <JTimelineCamera>();
            }
            if (type == TimeLineType.Effect && (timeline = line.GetComponent <JTimelineEffect>()) == null)
            {
                timeline = line.gameObject.AddComponent <JTimelineEffect>();
            }
            return(timeline);
        }
        private GenericMenu MenuForTrajectoryTimeLine(JTimelineBase line, JTrajectoryTrack track)
        {
            GenericMenu contextMenu = new GenericMenu();
            float       newTime     = (((UnityEngine.Event.current.mousePosition.x + XScroll) / DisplayArea.width) * line.Sequence.Duration) / XScale;

            contextMenu.AddItem(new GUIContent("AddNewTrack"),
                                false, (obj) => AddNewTrajectoryTrack(((JTimelineBase)((object[])obj)[0])),
                                new object[] { line });

            contextMenu.AddItem(new GUIContent("AddClip"),
                                false, (obj) => AddNewTrajectoryClip(((JTrajectoryTrack)((object[])obj)[0]), ((float)((object[])obj)[1])),
                                new object[] { track, newTime });


            contextMenu.AddItem(new GUIContent("DeleteLine"),
                                false, (obj) => RemoveTrajectoryLine(((JTrajectoryTrack)((object[])obj)[0])),
                                new object[] { track });

            return(contextMenu);
        }
Пример #22
0
 //为时间线添加绘制片段数据
 private void AddRenderDataForAnimation(JTimelineBase timeline)
 {
     if (timeline is JTimelineAnimation)
     {
         JTimelineAnimation     animationline = (JTimelineAnimation)timeline;
         List <JClipRenderData> list          = new List <JClipRenderData>();
         for (int k = 0; k < animationline.AnimationTracks.Count; k++)
         {
             JAnimationTrack track = animationline.AnimationTracks[k];
             for (int l = 0; l < track.TrackClips.Count; l++)
             {
                 JAnimationClipData animationClipData = track.TrackClips[l];
                 var cachedData = ScriptableObject.CreateInstance <JClipRenderData>();
                 cachedData.ClipData = animationClipData;
                 list.Add(cachedData);
             }
             if (!timelineClipRenderDataMap.ContainsKey(track))
             {
                 timelineClipRenderDataMap.Add(track, list);
             }
         }
     }
 }
Пример #23
0
 private void AddRenderDataForSound(JTimelineBase timeline)
 {
     if (timeline is JTimelineSound)
     {
         JTimelineSound         Soundline = (JTimelineSound)timeline;
         List <JClipRenderData> list      = new List <JClipRenderData>();
         for (int k = 0; k < Soundline.SoundTracks.Count; k++)
         {
             JSoundTrack track = Soundline.SoundTracks[k];
             for (int l = 0; l < track.TrackClips.Count; l++)
             {
                 JSoundClipData SoundClipData = track.TrackClips[l];
                 var            cachedData    = ScriptableObject.CreateInstance <JClipRenderData>();
                 cachedData.ClipData = SoundClipData;
                 list.Add(cachedData);
             }
             if (!timelineClipRenderDataMap.ContainsKey(track))
             {
                 timelineClipRenderDataMap.Add(track, list);
             }
         }
     }
 }
Пример #24
0
        public void OnTransformSceneGUI(JTimelineBase timeline)
        {
            if (timeline == null)
            {
                return;
            }
            if (timeline.LineType() == TimeLineType.Transform)
            {
                JTimelineTransform ObjectPathTimeline = (JTimelineTransform)timeline;
                if (ObjectPathTimeline.Tracks == null)
                {
                    return;
                }

                for (int i = 0; i < ObjectPathTimeline.Tracks.Count; i++)
                {
                    JTransformTrack tTrack = ObjectPathTimeline.Tracks[i];
                    if (SelectedNodeIndex >= 0)
                    {
                        if (UnityEngine.Event.current.isKey && (UnityEngine.Event.current.keyCode == KeyCode.Delete || UnityEngine.Event.current.keyCode == KeyCode.Backspace))
                        {
                            UnityEngine.Event.current.Use();
                            RemoveKeyFrameWithKeyframe(SelectedNodeIndex);
                            SelectedNodeIndex = -1;
                        }
                    }

                    if (UnityEngine.Event.current.type == EventType.mouseDown)
                    {
                        var nearestIndex = GetNearestNodeForMousePosition(tTrack, UnityEngine.Event.current.mousePosition);

                        if (nearestIndex != -1)
                        {
                            SelectedNodeIndex = nearestIndex;
                            if (UnityEngine.Event.current.clickCount == 1 && UnityEngine.Event.current.button == 0)
                            {
                                ResetSelection();
                                Selection.activeObject = tTrack.Keyframes[SelectedNodeIndex];
                                OnSelectedObjects(new List <Object> {
                                    tTrack.Keyframes[SelectedNodeIndex]
                                });
                            }
                            if (UnityEngine.Event.current.clickCount > 1)
                            {
                                var cameraTransform = UnityEditor.SceneView.currentDrawingSceneView.camera.transform;
                                var keyframe        = tTrack.Keyframes[SelectedNodeIndex];
                                int next            = SelectedNodeIndex == (tTrack.Keyframes.Count - 1) ? (SelectedNodeIndex - 1) : (SelectedNodeIndex + 1);

                                var   nextKeyframe = tTrack.Keyframes[next];
                                float newtime      = (keyframe.StartTime + nextKeyframe.StartTime) * 0.5f;

                                AddNewKeyFrame(tTrack, newtime, SelectedNodeIndex);

                                GUI.changed = true;
                            }
                        }
                    }

                    if (tTrack.Keyframes.Count >= 2)
                    {
                        if (Vector3.Distance(tTrack.Keyframes[0].Position, tTrack.Keyframes[tTrack.Keyframes.Count - 1].Position) == 0)
                        {
                            Handles.Label(tTrack.Keyframes[0].Position, "Start and End");
                        }
                        else
                        {
                            Handles.Label(tTrack.Keyframes[0].Position, "Start");
                            Handles.Label(tTrack.Keyframes[tTrack.Keyframes.Count - 1].Position, "End");
                        }
                    }
                    for (int nodeIndex = 0; nodeIndex < tTrack.Keyframes.Count; nodeIndex++)
                    {
                        var node = tTrack.Keyframes[nodeIndex];

                        if (node && nodeIndex > 0 && nodeIndex < tTrack.Keyframes.Count - 1)
                        {
                            float handleSize = HandlesUtility.GetHandleSize(node.Position);
                            Handles.Label(node.Position + new Vector3(0.25f * handleSize, 0.0f * handleSize, 0.0f * handleSize), nodeIndex.ToString());
                        }
                        var        existingKeyframe = tTrack.Keyframes[nodeIndex];
                        Quaternion oldrotation      = Quaternion.Euler(existingKeyframe.Rotation);
                        Vector3    oldpos           = existingKeyframe.Position;
                        Vector3    oldtang          = existingKeyframe.Tangent;
                        Vector3    oldnormal        = existingKeyframe.Normal;
                        Vector3    newPosition      = HandlesUtility.PositionHandle(existingKeyframe.Position, oldrotation);
                        Vector3    newtangent       = HandlesUtility.TangentHandle(existingKeyframe.Position + existingKeyframe.Tangent) - existingKeyframe.Position;
                        if (oldpos != newPosition || oldtang != newtangent)
                        {
                            tTrack.AlterKeyframe(newPosition, oldrotation.eulerAngles, newtangent, oldnormal, nodeIndex);
                            EditorUtility.SetDirty(tTrack);
                        }
                    }
                }
            }
        }
Пример #25
0
        private void TransformGUI(JTimelineBase timeline, JTransformTrack track, JClipRenderData[] renderDataList)
        {
            GenericMenu contextMenu = new GenericMenu();
            ///event 右键点击
            bool isContext = UnityEngine.Event.current.type == EventType.MouseDown && UnityEngine.Event.current.button == 1 && UnityEngine.Event.current.clickCount == 1;
            bool isChoose  = UnityEngine.Event.current.type == EventType.MouseDown && UnityEngine.Event.current.button == 0 && UnityEngine.Event.current.clickCount == 1;
            bool isDouble  = UnityEngine.Event.current.type == EventType.MouseDown && UnityEngine.Event.current.button == 0 && UnityEngine.Event.current.clickCount == 2;
            bool hasBox    = false;

            Rect DisplayAreaTemp = DisplayArea;

            DisplayAreaTemp.x = 0;
            DisplayAreaTemp.y = 0;

            var linestartX = ConvertTimeToXPos(track.StartTime);
            var lineendX   = ConvertTimeToXPos(track.EndTime);

            Rect linerenderRect     = new Rect(linestartX, DisplayArea.y, lineendX - linestartX, DisplayArea.height);
            Rect linerenderRectTemp = linerenderRect;

            linerenderRectTemp.x -= DisplayArea.x;
            linerenderRectTemp.y  = 0;

            GUI.color = new Color(85 / 255.0f, 47 / 255.0f, 176 / 255.0f, 1f);
            GUI.Box(linerenderRectTemp, "", USEditorUtility.NormalWhiteOutLineBG);
            GUI.color = Color.white;

            for (int j = 0; j < renderDataList.Length; j++)
            {
                JClipRenderData renderdata  = renderDataList[j];
                JSplineKeyframe key         = (JSplineKeyframe)renderdata.ClipData;
                var             startX      = ConvertTimeToXPos(key.StartTime);
                var             handleWidth = 5.0f;

                Rect renderRect     = new Rect(startX - handleWidth, DisplayArea.y, handleWidth * 2, DisplayArea.height);
                Rect renderRectTemp = renderRect;
                renderRectTemp.x -= DisplayArea.x;
                renderRectTemp.y  = 0;

                Rect labelRect = new Rect();

                GUI.color = new Color(255 / 255.0f, 122 / 255.0f, 105 / 255.0f, 1);
                if (SelectedObjects.Contains(renderdata))
                {
                    GUI.color = ColorTools.SelectColor;
                }
                GUI.Box(renderRectTemp, "", USEditorUtility.NormalWhiteOutLineBG);
                labelRect                 = renderRectTemp;
                renderdata.renderRect     = renderRect;
                renderdata.labelRect      = renderRect;
                renderdata.renderPosition = new Vector2(startX - handleWidth, DisplayArea.y);
                renderdata.ClipData       = key;
                GUI.color                 = Color.black;
                GUI.Label(labelRect, "" + track.Keyframes.IndexOf(key), USEditorUtility.USeqSkin.label);
                GUI.color = Color.white;

                if (isContext && renderRectTemp.Contains(UnityEngine.Event.current.mousePosition))
                {
                    hasBox = true;
                    contextMenu.AddItem(new GUIContent("DeleteKeyFrame"),
                                        false, (obj) => RemoveKeyFrame(((JClipRenderData)((object[])obj)[0])),
                                        new object[] { renderdata });
                }
                if (hasBox && isContext && renderRectTemp.Contains(UnityEngine.Event.current.mousePosition))
                {
                    UnityEngine.Event.current.Use();
                    contextMenu.ShowAsContext();
                }
            }

            if (!hasBox && isChoose && linerenderRectTemp.Contains(UnityEngine.Event.current.mousePosition) && (UnityEngine.Event.current.control || UnityEngine.Event.current.command))
            {
                //代码选中hierarchy中的对象 显示inspector 按住Ctrl or command
                //GameObject go = GameObject.Find(tline.gameObject.name);
                Selection.activeObject = track;
                EditorGUIUtility.PingObject(track);
            }

            if (!hasBox && isContext && linerenderRectTemp.Contains(UnityEngine.Event.current.mousePosition))
            {
                contextMenu = MenuForTransformTimeLine(timeline, track);
            }
            if (!hasBox && isContext && linerenderRectTemp.Contains(UnityEngine.Event.current.mousePosition))
            {
                UnityEngine.Event.current.Use();
                contextMenu.ShowAsContext();
            }
            if (!hasBox && isDouble && linerenderRectTemp.Contains(UnityEngine.Event.current.mousePosition))
            {
                int   index   = 1;
                float newTime = (((UnityEngine.Event.current.mousePosition.x + XScroll) / DisplayArea.width) * timeline.Sequence.Duration) / XScale;
                for (int i = 1; i < track.Keyframes.Count; i++)
                {
                    if (newTime <= track.Keyframes[i].StartTime)
                    {
                        index = i;
                        break;
                    }
                }
                AddNewKeyFrame(track, newTime, index);
            }
        }
        private void TrajectoryGUI(JTimelineBase timeline, JTrajectoryTrack track, JClipRenderData[] renderDataList)
        {
            if (timeline is JTimelineTrajectory)
            {
                JTimelineTrajectory trajectoryline = (JTimelineTrajectory)timeline;

                GenericMenu contextMenu = new GenericMenu();
                ///event 右键点击
                bool isContext       = UnityEngine.Event.current.type == EventType.MouseDown && UnityEngine.Event.current.button == 1;
                bool isChoose        = UnityEngine.Event.current.type == EventType.MouseDown && UnityEngine.Event.current.button == 0 && UnityEngine.Event.current.clickCount == 1;
                bool hasBox          = false;
                Rect DisplayAreaTemp = DisplayArea;
                DisplayAreaTemp.x = 0;
                DisplayAreaTemp.y = 0;
                for (int j = 0; j < renderDataList.Length; j++)
                {
                    JClipRenderData     renderdata         = renderDataList[j];
                    JTrajectoryClipData trajectoryClipData = (JTrajectoryClipData)renderdata.ClipData;
                    JTrajectoryTrack    linetrack          = trajectoryClipData.Track;
                    if (linetrack != track)
                    {
                        continue;
                    }
                    var startX      = ConvertTimeToXPos(trajectoryClipData.StartTime);
                    var endX        = ConvertTimeToXPos(trajectoryClipData.StartTime + trajectoryClipData.PlaybackDuration);
                    var transitionX = ConvertTimeToXPos(trajectoryClipData.StartTime + trajectoryClipData.PlaybackDuration);
                    var handleWidth = 2.0f;

                    Rect renderRect     = new Rect(startX, DisplayArea.y, endX - startX, DisplayArea.height);
                    Rect transitionRect = new Rect(startX, DisplayArea.y, transitionX - startX, DisplayArea.height);
                    Rect leftHandle     = new Rect(startX, DisplayArea.y, handleWidth * 2.0f, DisplayArea.height);
                    Rect rightHandle    = new Rect(endX - (handleWidth * 2.0f), DisplayArea.y, handleWidth * 2.0f, DisplayArea.height);
                    Rect labelRect      = new Rect();

                    Rect renderRecttemp = renderRect;
                    renderRecttemp.x -= DisplayArea.x;
                    renderRecttemp.y  = 0;
                    Rect transitionRecttemp = transitionRect;
                    transitionRecttemp.y  = 0;
                    transitionRecttemp.x -= DisplayArea.x;
                    Rect leftHandletemp = leftHandle;
                    leftHandletemp.y  = 0;
                    leftHandletemp.x -= DisplayArea.x;
                    Rect rightHandletemp = rightHandle;
                    rightHandletemp.x -= DisplayArea.x;
                    rightHandletemp.y  = 0;

                    GUI.color = new Color(156 / 255.0f, 11 / 255.0f, 11 / 255.0f, 1);
                    if (SelectedObjects.Contains(renderdata))
                    {
                        GUI.color = ColorTools.SelectColor;
                    }

                    GUI.Box(renderRecttemp, "", USEditorUtility.NormalWhiteOutLineBG);
                    GUI.Box(leftHandletemp, "");
                    GUI.Box(rightHandletemp, "");

                    labelRect       = renderRecttemp;
                    labelRect.width = DisplayArea.width;

                    renderdata.renderRect     = renderRect;
                    renderdata.labelRect      = renderRect;
                    renderdata.renderPosition = new Vector2(startX, DisplayArea.y);
                    renderdata.transitionRect = transitionRect;
                    renderdata.leftHandle     = leftHandle;
                    renderdata.rightHandle    = rightHandle;
                    renderdata.ClipData       = trajectoryClipData;


                    labelRect.x += 4.0f;  // Nudge this along a bit so it isn't flush with the side.

                    GUI.color = Color.black;
                    GUI.Label(labelRect, trajectoryClipData.FriendlyName);

                    GUI.color = Color.white;

                    if (isContext && renderRecttemp.Contains(UnityEngine.Event.current.mousePosition))
                    {
                        hasBox = true;
                        contextMenu.AddItem(new GUIContent("DeleteClip"),
                                            false, (obj) => RemoveTrajectoryClip(((JClipRenderData)((object[])obj)[0])),
                                            new object[] { renderdata });
                    }
                    if (isContext && renderRecttemp.Contains(UnityEngine.Event.current.mousePosition))
                    {
                        UnityEngine.Event.current.Use();
                        contextMenu.ShowAsContext();
                    }
                }

                if (!hasBox && isChoose && DisplayAreaTemp.Contains(UnityEngine.Event.current.mousePosition) && (UnityEngine.Event.current.control || UnityEngine.Event.current.command))
                {
                    //代码选中hierarchy中的对象 显示inspector 按住Ctrl or command
                    //GameObject go = GameObject.Find(Animationline.gameObject.name);
                    Selection.activeGameObject = trajectoryline.gameObject;
                    EditorGUIUtility.PingObject(trajectoryline.gameObject);
                }
                if (!hasBox && isContext && DisplayAreaTemp.Contains(UnityEngine.Event.current.mousePosition))
                {
                    contextMenu = MenuForTrajectoryTimeLine(trajectoryline, track);
                }
                if (!hasBox && isContext && DisplayAreaTemp.Contains(UnityEngine.Event.current.mousePosition))
                {
                    UnityEngine.Event.current.Use();
                    contextMenu.ShowAsContext();
                }
            }
        }
Пример #27
0
        /// <summary>
        /// 侧边栏渲染
        /// </summary>
        private void DrawSideBarAndTimeLines()
        {
            CountClip = 0;
            foreach (KeyValuePair <UnityEngine.Object, List <JClipRenderData> > kvp in timelineClipRenderDataMap)
            {
                foreach (var clip in kvp.Value)
                {
                    clip.index = CountClip++;
                }
            }

            TypeList = CurrentSequence.SortedTimelinesLists;
            JTimelineContainer[] containers = CurrentSequence.SortedTimelineContainers;

            for (int i = 0; i < containers.Length; i++)
            {
                GUILayout.BeginVertical();
                JTimelineContainer container = containers[i];
                GUILayout.BeginHorizontal();
                GUILayout.Box(new GUIContent("", ""), USEditorUtility.USeqSkin.GetStyle("TimelinePaneBackground"), GUILayout.Height(lineHeight), GUILayout.MaxWidth(FloatingWidth));
                Rect FloatingRect = GUILayoutUtility.GetLastRect();
                GUILayout.Box(new GUIContent("", ""), USEditorUtility.USeqSkin.GetStyle("TimelinePaneBackground"), GUILayout.Height(lineHeight), GUILayout.ExpandWidth(true));

                GUILayout.EndHorizontal();
                FloatingRect.width -= lineHeight + 1;

                bool CurcontainerfoldState = false;
                if (FoldStateDict.ContainsKey(i + 1))
                {
                    Rect temp = FloatingRect;
                    temp.width            = 20;
                    FoldStateDict[i + 1]  = EditorGUI.Foldout(temp, FoldStateDict[i + 1], "");
                    CurcontainerfoldState = FoldStateDict[i + 1];
                    Rect temp1 = FloatingRect;
                    temp1.x += 20;
                    //  temp1.y -= 1;
                    temp1.width -= 20;
                    //  temp1.height -=2;
                    if (GUI.Button(temp1, new GUIContent(container.AffectedObject.name, "模型"), EditorStyles.toolbarButton))
                    {
                        ResetSelection();
                        Selection.activeGameObject = container.gameObject;
                    }

                    Rect menuBtn = FloatingRect;
                    menuBtn.x     = menuBtn.x + menuBtn.width;
                    menuBtn.width = lineHeight;
                    if (GUI.Button(menuBtn, new GUIContent("", USEditorUtility.DeleteButton, "Delete Timelines"), USEditorUtility.ToolbarButtonSmall))
                    {
                        GameObject.DestroyImmediate(container.gameObject);
                    }
                }

                if (CurcontainerfoldState)
                {
                    foreach (TimeLineType type in showTypeList)
                    {
                        // TODO: 遍历操作
                        int index = (int)type;
                        GUILayout.BeginVertical();
                        GUILayout.BeginHorizontal();
                        GUILayout.Box(new GUIContent("", ""), USEditorUtility.USeqSkin.GetStyle("TimelinePaneBackground"), GUILayout.Height(lineHeight), GUILayout.MaxWidth(FloatingWidth));
                        Rect FloatingRect1 = GUILayoutUtility.GetLastRect();
                        GUILayout.Box(new GUIContent("", ""), USEditorUtility.USeqSkin.GetStyle("TimelinePaneBackground"), GUILayout.Height(lineHeight), GUILayout.ExpandWidth(true));

                        GUILayout.EndHorizontal();
                        GUILayout.EndVertical();

                        FloatingRect1.x      = +20;
                        FloatingRect1.width -= (20 + lineHeight + 1);
                        int  foldkey      = (i + 1) * 100 + index;
                        bool Curfoldstate = false;
                        if (FoldStateDict.ContainsKey(foldkey))
                        {
                            FoldStateDict[foldkey] = EditorGUI.Foldout(FloatingRect1, FoldStateDict[foldkey], Enum.GetName(typeof(TimeLineType), type));
                            Curfoldstate           = FoldStateDict[foldkey];
                        }

                        Rect menuBtn = FloatingRect1;
                        menuBtn.x     = menuBtn.x + menuBtn.width + 1.0f;
                        menuBtn.width = lineHeight;
                        if (GUI.Button(menuBtn, new GUIContent("", USEditorUtility.MoreButton, "Add Timeline"), USEditorUtility.ToolbarButtonSmall))
                        {
                            JTimelineBase line = container.AddNewTimeline(type);
                            if (line)
                            {
                                AddNewTrack(line);
                            }
                        }

                        if (Curfoldstate)
                        {
                            List <JTimelineBase> timelines = TypeList[index];
                            for (int k = 0; k < timelines.Count; k++)
                            {
                                GUILayout.BeginVertical();
                                JTimelineBase line = timelines[k];
                                if (line.TimelineContainer == container)
                                {
                                    #region ExtensionRegion
                                    SideBarAndLineForAnimation(line);
                                    SideBarAndLineForParticle(line);
                                    SideBarAndLineForSound(line);
                                    SideBarAndLineForTranform(line);
                                    SideBarAndLineForEvent(line);
                                    SideBarAndLineForTrajectory(line);
                                    SideBarAndLineForCamera(line);
                                    SideBarAndLineForEffect(line);
                                    #endregion
                                }
                                GUILayout.EndVertical();
                            }
                        }
                    }
                }
                GUILayout.EndVertical();
            }
        }
Пример #28
0
 public static int Comparer(JTimelineBase a, JTimelineBase b)
 {
     return(a.LineType().CompareTo(b.LineType()));
 }
        public static SkillAssetData MakeSkillAssetData(JSequencer sequenceer)
        {
            SkillAssetData    skillart       = new SkillAssetData();
            Transform         AffectedObject = sequenceer.TimelineContainers[0].AffectedObject;
            string            ModelName      = AffectedObject.name;
            List <GameObject> plist          = AssetUtility.GetAllFBXWithType(ModelTargetType.Player);
            List <GameObject> nlist          = AssetUtility.GetAllFBXWithType(ModelTargetType.NPC);

            skillart.skillArt.modelType = ModelTargetType.Player;
            bool findtype = false;

            for (int i = 0; i < plist.Count && !findtype; i++)
            {
                if (plist[i].name == ModelName)
                {
                    skillart.skillArt.modelType = ModelTargetType.Player;
                    findtype = true;
                }
            }
            for (int i = 0; i < nlist.Count && !findtype; i++)
            {
                if (nlist[i].name == ModelName)
                {
                    skillart.skillArt.modelType = ModelTargetType.NPC;
                    findtype = true;
                }
            }
            skillart.skillArt.modelName = ModelName;
            skillart.skillArt.model     = AssetUtility.GetFBXWithName(ModelName);
            Animator Animator = AffectedObject.GetComponent <Animator>();

            skillart.skillArt.animationController = Animator.runtimeAnimatorController.name;
            skillart.skillArt.id = EditorDataContainer.GetSkillIdByString(AffectedObject.parent.name.Split('_')[1]);
            if (sequenceer.TimelineContainers.Length > 0)
            {
                JTimelineBase[] lines = sequenceer.TimelineContainers[0].Timelines;
                for (int i = 0; i < lines.Length; i++)
                {
                    JTimelineBase line = lines[i];
                    //动作时间线 guideaction

                    /* if (line.LineType() == TimeLineType.Animation)
                     * {
                     *   JTimelineAnimation aniline = (JTimelineAnimation)line;
                     *   foreach (var track in aniline.AnimationTracks)
                     *   {
                     *       if (track.name == SkillNames.ActionNames[(int)SkillNames.GuideAction.GuideAction])
                     *       {
                     *           if (track.TrackClips.Count > 0)
                     *           {
                     *               skillart.skillArt.guideAction = track.TrackClips[0].StateName;
                     *           }
                     *       }
                     *       else if (track.name == SkillNames.ActionNames[(int)SkillNames.GuideAction.GuidingAction])
                     *       {
                     *           if (track.TrackClips.Count > 0)
                     *           {
                     *               skillart.skillArt.guidingAction = track.TrackClips[0].StateName;
                     *           }
                     *       }
                     *       else if (track.name == SkillNames.ActionNames[(int)SkillNames.GuideAction.EndAction])
                     *       {
                     *           if (track.TrackClips.Count > 0)
                     *           {
                     *               skillart.skillArt.endAction = track.TrackClips[0].StateName;
                     *           }
                     *       }
                     *   }
                     * }*/
                    //特效时间线 begineffect
                    if (line.LineType() == TimeLineType.Effect)
                    {
                        JTimelineEffect aniline = (JTimelineEffect)line;
                        foreach (var track in aniline.EffectTracks)
                        {
                            if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.GuideAction])
                            {
                                if (track.TrackClips.Count > 0)
                                {
                                    skillart.skillArt.guideAction = track.TrackClips[0].StateName;
                                }
                            }
                            if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.GuidingAction])
                            {
                                if (track.TrackClips.Count > 0)
                                {
                                    skillart.skillArt.guidingAction = track.TrackClips[0].StateName;
                                }
                            }
                            if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.EndAction])
                            {
                                if (track.TrackClips.Count > 0)
                                {
                                    skillart.skillArt.endAction = track.TrackClips[0].StateName;
                                }
                            }

                            if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.BeginEffect0] || track.name == SkillNames.EffectNames[(int)SkillNames.Effect.BeginEffect1])
                            {
                                if (skillart.skillArt.beginEffect == null)
                                {
                                    skillart.skillArt.beginEffect = new List <SkillEffectUnit>();
                                }
                                skillart.skillArt.beginEffect.Add(track.TrackClips[0].effectunit.Copy());
                            }


                            if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.EndEffect])
                            {
                                if (skillart.skillArt.endEffect == null)
                                {
                                    skillart.skillArt.endEffect = new List <SkillEffectUnit>();
                                }
                                skillart.skillArt.endEffect.Add(track.TrackClips[0].effectunit.Copy());
                            }
                            if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.UnitEffect])
                            {
                                if (skillart.skillArt.unitEffect == null)
                                {
                                    skillart.skillArt.unitEffect = new List <SkillEffectUnit>();
                                }
                                if (skillart.skillUnit == null)
                                {
                                    skillart.skillUnit = new JSkillUnit();
                                }
                                skillart.skillArt.unitEffect.Add(track.TrackClips[0].effectunit.Copy());
                                skillart.skillUnit = track.TrackClips[0].skillunit.Copy();
                            }
                            if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.HitEffect])
                            {
                                if (skillart.skillArt.hitEffect == null)
                                {
                                    skillart.skillArt.hitEffect = new List <SkillEffectUnit>();
                                }
                                skillart.skillArt.hitEffect.Add(track.TrackClips[0].effectunit.Copy());
                            }
                            if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.TipEffect])
                            {
                                if (skillart.skillArt.tipEffect == null)
                                {
                                    skillart.skillArt.tipEffect = new List <SkillEffectUnit>();
                                }
                                skillart.skillArt.tipEffect.Add(track.TrackClips[0].effectunit.Copy());
                            }
                            if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.BeginCameraAction])
                            {
                                if (skillart.skillArt.beginCameraAction == null)
                                {
                                    skillart.skillArt.beginCameraAction = new List <SkillCameraAction>();
                                }
                                skillart.skillArt.beginCameraAction.Add(track.TrackClips[0].cameraAction.Copy());
                            }
                            if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.MoveCameraAction])
                            {
                                if (skillart.skillArt.moveCameraAction == null)
                                {
                                    skillart.skillArt.moveCameraAction = new List <SkillCameraAction>();
                                }
                                skillart.skillArt.moveCameraAction.Add(track.TrackClips[0].cameraAction.Copy());
                            }
                            if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.HitCameraAction])
                            {
                                if (skillart.skillArt.hitCameraAction == null)
                                {
                                    skillart.skillArt.hitCameraAction = new List <SkillCameraAction>();
                                }
                                skillart.skillArt.hitCameraAction.Add(track.TrackClips[0].cameraAction.Copy());
                            }
                        }
                    }
                    if (skillart.skillArt.beginEffect != null)
                    {
                        skillart.skillArt.beginEffect.Sort(delegate(SkillEffectUnit x, SkillEffectUnit y)
                        {
                            return(x.artEffect.beginTime.CompareTo(y.artEffect.beginTime));
                        });
                    }


                    /*
                     *  if (line.LineType() == TimeLineType.Particle)
                     *  {
                     *      JTimelineParticle aniline = (JTimelineParticle)line;
                     *      foreach (var track in aniline.ParticleTracks)
                     *      {
                     *          if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.BeginEffect0]|| track.name == SkillNames.EffectNames[(int)SkillNames.Effect.BeginEffect1]|| track.name == SkillNames.EffectNames[(int)SkillNames.Effect.EndEffect])
                     *          {
                     *              if (track.TrackClips.Count > 0)
                     *              {
                     *                  SkillEffectUnit unit = new SkillEffectUnit();
                     *                  unit.configure = track.TrackClips[0].EffectConfig.Copy();
                     *                  unit.artEffect.beginTime = (int)(track.TrackClips[0].StartTime*1000f);
                     *                  unit.artEffect.phaseTime = (int)(track.TrackClips[0].PlaybackDuration * 1000f);
                     *                  unit.artEffect.effectObj = track.TrackClips[0].Effect;
                     *                  unit.artEffect.effect = EditorDataContainer.GetIdByString(track.TrackClips[0].ParticleName);
                     *                  begineffect.Insert(0, unit);
                     *              }
                     *          }
                     *
                     *      }
                     *  }
                     *  //弹道时间线
                     *  if (skillart.skillArt.unitEffect == null)
                     *      skillart.skillArt.unitEffect = new List<SkillEffectUnit>();
                     *  List<SkillEffectUnit> unitEffect = skillart.skillArt.unitEffect;
                     *  unitEffect.Clear();
                     *  if (line.LineType() == TimeLineType.Trajectory)
                     *  {
                     *      JTimelineTrajectory aniline = (JTimelineTrajectory)line;
                     *
                     *      foreach (var track in aniline.TrajectoryTracks)
                     *      {
                     *          if (track.name == SkillNames.EffectNames[(int)SkillNames.Effect.UnitEffect])
                     *          {
                     *              if (track.TrackClips.Count > 0)
                     *              {
                     *                  skillart.skillUnit = track.TrackClips[0].skillunit.Copy();
                     *                  unitEffect.Add(track.TrackClips[0].effectunit.Copy());
                     *              }
                     *          }
                     *      }
                     *  }
                     */
                }
            }
            Debug.Log(skillart.skillArt.beginEffect.Count);

            return(skillart);
        }