Exemplo n.º 1
0
    internal override void ConfirmTranslate()
    {
        CinemaActionFixedWrapper wrapper = base.Wrapper as CinemaActionFixedWrapper;

        if ((wrapper != null) && (this.AlterFixedAction != null))
        {
            this.AlterFixedAction(this, new ActionFixedItemEventArgs(wrapper.Behaviour, wrapper.Firetime, wrapper.Duration, wrapper.InTime, wrapper.OutTime));
        }
    }
    public static CutsceneWrapper CreateWrapper(Cutscene cutscene)
    {
        CutsceneWrapper wrapper = new CutsceneWrapper(cutscene);

        if (cutscene != null)
        {
            wrapper.RunningTime = cutscene.RunningTime;
            wrapper.Duration    = cutscene.Duration;
            wrapper.IsPlaying   = cutscene.State == Cutscene.CutsceneState.PreviewPlaying || cutscene.State == Cutscene.CutsceneState.Playing;

            foreach (TrackGroup tg in cutscene.TrackGroups)
            {
                TrackGroupWrapper tgWrapper = new TrackGroupWrapper(tg);
                tgWrapper.Ordinal = tg.Ordinal;
                wrapper.AddTrackGroup(tg, tgWrapper);

                foreach (TimelineTrack track in tg.GetTracks())
                {
                    TimelineTrackWrapper trackWrapper = new TimelineTrackWrapper(track);
                    trackWrapper.Ordinal = track.Ordinal;
                    tgWrapper.AddTrack(track, trackWrapper);

                    foreach (TimelineItem item in track.GetTimelineItems())
                    {
                        if (item.GetType().IsSubclassOf(typeof(CinemaClipCurve)))
                        {
                            CinemaClipCurve        clip        = item as CinemaClipCurve;
                            CinemaClipCurveWrapper clipWrapper = new CinemaClipCurveWrapper(clip, clip.Firetime, clip.Duration);
                            trackWrapper.AddItem(clip, clipWrapper);
                        }
                        else if (item.GetType().IsSubclassOf(typeof(CinemaTween)))
                        {
                        }
                        else if (item.GetType().IsSubclassOf(typeof(TimelineActionFixed)))
                        {
                            TimelineActionFixed      actionFixed        = item as TimelineActionFixed;
                            CinemaActionFixedWrapper actionFixedWrapper = new CinemaActionFixedWrapper(actionFixed, actionFixed.Firetime, actionFixed.Duration, actionFixed.InTime, actionFixed.OutTime, actionFixed.ItemLength);
                            trackWrapper.AddItem(actionFixed, actionFixedWrapper);
                        }
                        else if (item.GetType().IsSubclassOf(typeof(TimelineAction)))
                        {
                            TimelineAction      action      = item as TimelineAction;
                            CinemaActionWrapper itemWrapper = new CinemaActionWrapper(action, action.Firetime, action.Duration);
                            trackWrapper.AddItem(action, itemWrapper);
                        }
                        else
                        {
                            TimelineItemWrapper itemWrapper = new TimelineItemWrapper(item, item.Firetime);
                            trackWrapper.AddItem(item, itemWrapper);
                        }
                    }
                }
            }
        }
        return(wrapper);
    }
Exemplo n.º 3
0
    internal override void ConfirmTranslate()
    {
        CinemaActionFixedWrapper cinemaActionFixedWrapper = Wrapper as CinemaActionFixedWrapper;

        if (cinemaActionFixedWrapper == null)
        {
            return;
        }
        if (this.AlterFixedAction != null)
        {
            this.AlterFixedAction(this, new ActionFixedItemEventArgs(cinemaActionFixedWrapper.Behaviour, cinemaActionFixedWrapper.Firetime, cinemaActionFixedWrapper.Duration, cinemaActionFixedWrapper.InTime, cinemaActionFixedWrapper.OutTime));
        }
    }
    public static CutsceneWrapper CreateWrapper(Cutscene cutscene)
    {
        CutsceneWrapper wrapper = new CutsceneWrapper(cutscene);
        if (cutscene != null)
        {
            wrapper.RunningTime = cutscene.RunningTime;
            wrapper.Duration = cutscene.Duration;
            wrapper.IsPlaying = cutscene.State == Cutscene.CutsceneState.PreviewPlaying || cutscene.State == Cutscene.CutsceneState.Playing;
           
            foreach (TrackGroup tg in cutscene.TrackGroups)
            {
                TrackGroupWrapper tgWrapper = new TrackGroupWrapper(tg);
                tgWrapper.Ordinal = tg.Ordinal;
                wrapper.AddTrackGroup(tg, tgWrapper);

                foreach (TimelineTrack track in tg.GetTracks())
                {
                    TimelineTrackWrapper trackWrapper = new TimelineTrackWrapper(track);
                    trackWrapper.Ordinal = track.Ordinal;
                    tgWrapper.AddTrack(track, trackWrapper);

                    foreach (TimelineItem item in track.GetTimelineItems())
                    {
                        if (item.GetType().IsSubclassOf(typeof(CinemaClipCurve)))
                        {
                            CinemaClipCurve clip = item as CinemaClipCurve;
                            CinemaClipCurveWrapper clipWrapper = new CinemaClipCurveWrapper(clip, clip.Firetime, clip.Duration);
                            trackWrapper.AddItem(clip, clipWrapper);
                        }
                        else if (item.GetType().IsSubclassOf(typeof(CinemaTween)))
                        {
                        }
                        else if (item.GetType().IsSubclassOf(typeof(TimelineActionFixed)))
                        {
                            TimelineActionFixed actionFixed = item as TimelineActionFixed;
                            CinemaActionFixedWrapper actionFixedWrapper = new CinemaActionFixedWrapper(actionFixed, actionFixed.Firetime, actionFixed.Duration, actionFixed.InTime, actionFixed.OutTime, actionFixed.ItemLength);
                            trackWrapper.AddItem(actionFixed, actionFixedWrapper);
                        }
                        else if (item.GetType().IsSubclassOf(typeof(TimelineAction)))
                        {
                            TimelineAction action = item as TimelineAction;
                            CinemaActionWrapper itemWrapper = new CinemaActionWrapper(action, action.Firetime, action.Duration);
                            trackWrapper.AddItem(action, itemWrapper);
                        }
                        else
                        {
                            TimelineItemWrapper itemWrapper = new TimelineItemWrapper(item, item.Firetime);
                            trackWrapper.AddItem(item, itemWrapper);
                        }
                    }
                }
            }
        }
        return wrapper;
    }
    public static CutsceneWrapper UpdateWrapper(Cutscene cutscene, CutsceneWrapper wrapper)
    {
        if (cutscene == null) return null;

        if (wrapper == null || !cutscene.Equals(wrapper.Behaviour))
        {
            return CreateWrapper(cutscene);
        }
        else
        {
            wrapper.Behaviour = cutscene;
            wrapper.Duration = cutscene.Duration;
            wrapper.IsPlaying = cutscene.State == Cutscene.CutsceneState.PreviewPlaying || cutscene.State == Cutscene.CutsceneState.Playing;
            wrapper.RunningTime = cutscene.RunningTime;

            List<Behaviour> itemsToRemove = new List<Behaviour>();
            foreach (Behaviour behaviour in wrapper.Behaviours)
            {
                bool found = false;
                foreach (TrackGroup group in cutscene.TrackGroups)
                {
                    if (behaviour.Equals(group))
                    {
                        found = true;
                        break;
                    }
                }
                if (!found || behaviour == null)
                {
                    itemsToRemove.Add(behaviour);
                }
            }

            foreach (Behaviour trackGroup in itemsToRemove)
            {
                wrapper.HasChanged = true;
                wrapper.RemoveTrackGroup(trackGroup);
            }

            foreach (TrackGroup tg in cutscene.TrackGroups)
            {
                TrackGroupWrapper tgWrapper = null;
                if (!wrapper.ContainsTrackGroup(tg, out tgWrapper))
                {
                    
                    tgWrapper = new TrackGroupWrapper(tg);
                    tgWrapper.Ordinal = tg.Ordinal;
                    wrapper.AddTrackGroup(tg, tgWrapper);
                    wrapper.HasChanged = true;
                }

                foreach (TimelineTrack track in tg.GetTracks())
                {
                    TimelineTrackWrapper trackWrapper = null;
                    if (!tgWrapper.ContainsTrack(track, out trackWrapper))
                    {
                        trackWrapper = new TimelineTrackWrapper(track);
                        trackWrapper.Ordinal = track.Ordinal;
                        tgWrapper.AddTrack(track, trackWrapper);
                        tgWrapper.HasChanged = true;
                    }

                    foreach (TimelineItem item in track.GetTimelineItems())
                    {
                        TimelineItemWrapper itemWrapper = null;
                        if (!trackWrapper.ContainsItem(item, out itemWrapper))
                        {
                            if (item.GetType().IsSubclassOf(typeof(CinemaClipCurve)))
                            {
                                CinemaClipCurve clip = item as CinemaClipCurve;
                                itemWrapper = new CinemaClipCurveWrapper(clip, clip.Firetime, clip.Duration);
                                trackWrapper.AddItem(clip, itemWrapper);
                            }
                            else if (item.GetType().IsSubclassOf(typeof(CinemaTween)))
                            {
                                CinemaTween tween = item as CinemaTween;
                                itemWrapper = new CinemaTweenWrapper(tween, tween.Firetime, tween.Duration);
                                trackWrapper.AddItem(tween, itemWrapper);
                            }
                            else if (item.GetType().IsSubclassOf(typeof(TimelineActionFixed)))
                            {
                                TimelineActionFixed fixedAction = item as TimelineActionFixed;
                                itemWrapper = new CinemaActionFixedWrapper(fixedAction, fixedAction.Firetime, fixedAction.Duration, fixedAction.InTime, fixedAction.OutTime, fixedAction.ItemLength);
                                trackWrapper.AddItem(fixedAction, itemWrapper);
                            }
                            else if (item.GetType().IsSubclassOf(typeof(TimelineAction)))
                            {
                                TimelineAction action = item as TimelineAction;
                                itemWrapper = new CinemaActionWrapper(action, action.Firetime, action.Duration);
                                trackWrapper.AddItem(action, itemWrapper);
                            }
                            else
                            {
                                itemWrapper = new TimelineItemWrapper(item, item.Firetime);
                                trackWrapper.AddItem(item, itemWrapper);
                            }
                            trackWrapper.HasChanged = true;
                        }
                        else
                        {
                            if (GUIUtility.hotControl == 0)
                            {
                                if (itemWrapper.GetType() == (typeof(CinemaClipCurveWrapper)))
                                {
                                    CinemaClipCurve clip = item as CinemaClipCurve;
                                    CinemaClipCurveWrapper clipWrapper = itemWrapper as CinemaClipCurveWrapper;
                                    clipWrapper.Firetime = clip.Firetime;
                                    clipWrapper.Duration = clip.Duration;
                                }
                                else if (itemWrapper.GetType() == (typeof(CinemaTweenWrapper)))
                                {
                                }
                                else if (itemWrapper.GetType() == (typeof(CinemaActionFixedWrapper)))
                                {
                                    TimelineActionFixed actionFixed = item as TimelineActionFixed;
                                    CinemaActionFixedWrapper actionFixedWrapper = itemWrapper as CinemaActionFixedWrapper;
                                    actionFixedWrapper.Firetime = actionFixed.Firetime;
                                    actionFixedWrapper.Duration = actionFixed.Duration;
                                    actionFixedWrapper.InTime = actionFixed.InTime;
                                    actionFixedWrapper.OutTime = actionFixed.OutTime;
                                    actionFixedWrapper.ItemLength = actionFixed.ItemLength;
                                }
                                else if (itemWrapper.GetType() == (typeof(CinemaActionWrapper)))
                                {
                                    TimelineAction action = item as TimelineAction;
                                    CinemaActionWrapper actionWrapper = itemWrapper as CinemaActionWrapper;
                                    actionWrapper.Firetime = action.Firetime;
                                    actionWrapper.Duration = action.Duration;
                                }
                                else
                                {
                                    itemWrapper.Firetime = item.Firetime;
                                }
                            }
                        }
                    }

                    // Remove missing track items
                    List<Behaviour> itemRemovals = new List<Behaviour>();
                    foreach (Behaviour behaviour in trackWrapper.Behaviours)
                    {
                        bool found = false;
                        foreach (TimelineItem item in track.GetTimelineItems())
                        {
                            if (behaviour.Equals(item))
                            {
                                found = true;
                                break;
                            }
                        }
                        if (!found || behaviour == null)
                        {
                            itemRemovals.Add(behaviour);
                        }
                    }
                    foreach (Behaviour item in itemRemovals)
                    {
                        trackWrapper.HasChanged = true;
                        trackWrapper.RemoveItem(item);
                    }
                }
                
                // Remove missing tracks
                List<Behaviour> removals = new List<Behaviour>();
                foreach (Behaviour behaviour in tgWrapper.Behaviours)
                {
                    bool found = false;
                    foreach (TimelineTrack track in tg.GetTracks())
                    {
                        if (behaviour.Equals(track))
                        {
                            found = true;
                            break;
                        }
                    }
                    if (!found || behaviour == null)
                    {
                        removals.Add(behaviour);
                    }
                }
                foreach (Behaviour track in removals)
                {
                    tgWrapper.HasChanged = true;
                    tgWrapper.RemoveTrack(track);
                }
            }
        }

        return wrapper;
    }
Exemplo n.º 6
0
    public static CutsceneWrapper UpdateWrapper(TimelineManager cutscene, CutsceneWrapper wrapper)
    {
        if (cutscene == null)
        {
            return(null);
        }

        if (wrapper == null || !cutscene.Equals(wrapper.Behaviour))
        {
            return(CreateWrapper(cutscene));
        }
        else
        {
            wrapper.Behaviour   = cutscene;
            wrapper.Duration    = cutscene.Duration;
            wrapper.IsPlaying   = cutscene.State == TimelineManager.TimeLineState.PreviewPlaying || cutscene.State == TimelineManager.TimeLineState.Playing;
            wrapper.RunningTime = cutscene.RunningTime;

            List <Behaviour> itemsToRemove = new List <Behaviour>();
            foreach (Behaviour behaviour in wrapper.Behaviours)
            {
                bool found = false;
                foreach (TrackGroup group in cutscene.TrackGroups)
                {
                    if (behaviour.Equals(group))
                    {
                        found = true;
                        break;
                    }
                }
                if (!found || behaviour == null)
                {
                    itemsToRemove.Add(behaviour);
                }
            }

            foreach (Behaviour trackGroup in itemsToRemove)
            {
                wrapper.HasChanged = true;
                wrapper.RemoveTrackGroup(trackGroup);
            }

            foreach (TrackGroup tg in cutscene.TrackGroups)
            {
                TrackGroupWrapper tgWrapper = null;
                if (!wrapper.ContainsTrackGroup(tg, out tgWrapper))
                {
                    tgWrapper         = new TrackGroupWrapper(tg);
                    tgWrapper.Ordinal = tg.Ordinal;
                    wrapper.AddTrackGroup(tg, tgWrapper);
                    wrapper.HasChanged = true;
                }

                foreach (TimelineTrack track in tg.GetTracks())
                {
                    TimelineTrackWrapper trackWrapper = null;
                    if (!tgWrapper.ContainsTrack(track, out trackWrapper))
                    {
                        trackWrapper         = new TimelineTrackWrapper(track);
                        trackWrapper.Ordinal = track.Ordinal;
                        tgWrapper.AddTrack(track, trackWrapper);
                        tgWrapper.HasChanged = true;
                    }

                    foreach (TimelineItem item in track.GetTimelineItems())
                    {
                        TimelineItemWrapper itemWrapper = null;
                        if (!trackWrapper.ContainsItem(item, out itemWrapper))
                        {
                            if (item.GetType().IsSubclassOf(typeof(ItemClipCurve)))
                            {
                                ItemClipCurve clip = item as ItemClipCurve;
                                itemWrapper = new CinemaClipCurveWrapper(clip, clip.Firetime, clip.Duration);
                                trackWrapper.AddItem(clip, itemWrapper);
                            }
                            else if (item.GetType().IsSubclassOf(typeof(TimelineActionFixed)))
                            {
                                TimelineActionFixed fixedAction = item as TimelineActionFixed;
                                itemWrapper = new CinemaActionFixedWrapper(fixedAction, fixedAction.Firetime, fixedAction.Duration, fixedAction.InTime, fixedAction.OutTime, fixedAction.ItemLength);
                                trackWrapper.AddItem(fixedAction, itemWrapper);
                            }
                            else if (item.GetType().IsSubclassOf(typeof(TimelineAction)))
                            {
                                TimelineAction action = item as TimelineAction;
                                itemWrapper = new CinemaActionWrapper(action, action.Firetime, action.Duration);
                                trackWrapper.AddItem(action, itemWrapper);
                            }
                            else
                            {
                                itemWrapper = new TimelineItemWrapper(item, item.Firetime);
                                trackWrapper.AddItem(item, itemWrapper);
                            }
                            trackWrapper.HasChanged = true;
                        }
                        else
                        {
                            if (GUIUtility.hotControl == 0)
                            {
                                if (itemWrapper.GetType() == (typeof(CinemaClipCurveWrapper)))
                                {
                                    ItemClipCurve          clip        = item as ItemClipCurve;
                                    CinemaClipCurveWrapper clipWrapper = itemWrapper as CinemaClipCurveWrapper;
                                    clipWrapper.Firetime = clip.Firetime;
                                    clipWrapper.Duration = clip.Duration;
                                }
                                else if (itemWrapper.GetType() == (typeof(CinemaTweenWrapper)))
                                {
                                }
                                else if (itemWrapper.GetType() == (typeof(CinemaActionFixedWrapper)))
                                {
                                    TimelineActionFixed      actionFixed        = item as TimelineActionFixed;
                                    CinemaActionFixedWrapper actionFixedWrapper = itemWrapper as CinemaActionFixedWrapper;
                                    actionFixedWrapper.Firetime   = actionFixed.Firetime;
                                    actionFixedWrapper.Duration   = actionFixed.Duration;
                                    actionFixedWrapper.InTime     = actionFixed.InTime;
                                    actionFixedWrapper.OutTime    = actionFixed.OutTime;
                                    actionFixedWrapper.ItemLength = actionFixed.ItemLength;
                                }
                                else if (itemWrapper.GetType() == (typeof(CinemaActionWrapper)))
                                {
                                    TimelineAction      action        = item as TimelineAction;
                                    CinemaActionWrapper actionWrapper = itemWrapper as CinemaActionWrapper;
                                    actionWrapper.Firetime = action.Firetime;
                                    actionWrapper.Duration = action.Duration;
                                }
                                else
                                {
                                    itemWrapper.Firetime = item.Firetime;
                                }
                            }
                        }
                    }

                    // Remove missing track items
                    List <Behaviour> itemRemovals = new List <Behaviour>();
                    foreach (Behaviour behaviour in trackWrapper.Behaviours)
                    {
                        bool found = false;
                        foreach (TimelineItem item in track.GetTimelineItems())
                        {
                            if (behaviour.Equals(item))
                            {
                                found = true;
                                break;
                            }
                        }
                        if (!found || behaviour == null)
                        {
                            itemRemovals.Add(behaviour);
                        }
                    }
                    foreach (Behaviour item in itemRemovals)
                    {
                        trackWrapper.HasChanged = true;
                        trackWrapper.RemoveItem(item);
                    }
                    trackWrapper.IsLocked = track.lockedStatus;
                }

                // Remove missing tracks
                List <Behaviour> removals = new List <Behaviour>();
                foreach (Behaviour behaviour in tgWrapper.Behaviours)
                {
                    bool found = false;
                    foreach (TimelineTrack track in tg.GetTracks())
                    {
                        if (behaviour.Equals(track))
                        {
                            found = true;
                            break;
                        }
                    }
                    if (!found || behaviour == null)
                    {
                        removals.Add(behaviour);
                    }
                }
                foreach (Behaviour track in removals)
                {
                    tgWrapper.HasChanged = true;
                    tgWrapper.RemoveTrack(track);
                }
            }
        }

        return(wrapper);
    }
Exemplo n.º 7
0
    public static CutsceneWrapper CreateWrapper(Cutscene cutscene)
    {
        CutsceneWrapper wrapper = new CutsceneWrapper(cutscene);

        if (cutscene != null)
        {
            wrapper.RunningTime = cutscene.RunningTime;
            wrapper.Duration    = cutscene.Duration;
            wrapper.IsPlaying   = cutscene.State == Cutscene.CutsceneState.PreviewPlaying || cutscene.State == Cutscene.CutsceneState.Playing;
            {
                var __array5       = cutscene.TrackGroups;
                var __arrayLength5 = __array5.Length;
                for (int __i5 = 0; __i5 < __arrayLength5; ++__i5)
                {
                    var tg = (TrackGroup)__array5[__i5];
                    {
                        TrackGroupWrapper tgWrapper = new TrackGroupWrapper(tg);
                        tgWrapper.Ordinal = tg.Ordinal;
                        wrapper.AddTrackGroup(tg, tgWrapper);
                        {
                            // foreach(var track in tg.GetTracks())
                            var __enumerator25 = (tg.GetTracks()).GetEnumerator();
                            while (__enumerator25.MoveNext())
                            {
                                var track = (TimelineTrack)__enumerator25.Current;
                                {
                                    TimelineTrackWrapper trackWrapper = new TimelineTrackWrapper(track);
                                    trackWrapper.Ordinal = track.Ordinal;
                                    tgWrapper.AddTrack(track, trackWrapper);
                                    {
                                        // foreach(var item in track.GetTimelineItems())
                                        var __enumerator33 = (track.GetTimelineItems()).GetEnumerator();
                                        while (__enumerator33.MoveNext())
                                        {
                                            var item = (TimelineItem)__enumerator33.Current;
                                            {
                                                if (item.GetType().IsSubclassOf(typeof(CinemaClipCurve)))
                                                {
                                                    CinemaClipCurve        clip        = item as CinemaClipCurve;
                                                    CinemaClipCurveWrapper clipWrapper = new CinemaClipCurveWrapper(clip, clip.Firetime, clip.Duration);
                                                    trackWrapper.AddItem(clip, clipWrapper);
                                                }
                                                else if (item.GetType().IsSubclassOf(typeof(CinemaTween)))
                                                {
                                                }
                                                else if (item.GetType().IsSubclassOf(typeof(TimelineActionFixed)))
                                                {
                                                    TimelineActionFixed      actionFixed        = item as TimelineActionFixed;
                                                    CinemaActionFixedWrapper actionFixedWrapper = new CinemaActionFixedWrapper(actionFixed, actionFixed.Firetime, actionFixed.Duration, actionFixed.InTime, actionFixed.OutTime, actionFixed.ItemLength);
                                                    trackWrapper.AddItem(actionFixed, actionFixedWrapper);
                                                }
                                                else if (item.GetType().IsSubclassOf(typeof(TimelineAction)))
                                                {
                                                    TimelineAction      action      = item as TimelineAction;
                                                    CinemaActionWrapper itemWrapper = new CinemaActionWrapper(action, action.Firetime, action.Duration);
                                                    trackWrapper.AddItem(action, itemWrapper);
                                                }
                                                else
                                                {
                                                    TimelineItemWrapper itemWrapper = new TimelineItemWrapper(item, item.Firetime);
                                                    trackWrapper.AddItem(item, itemWrapper);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        return(wrapper);
    }
Exemplo n.º 8
0
    public static CutsceneWrapper UpdateWrapper(Cutscene cutscene, CutsceneWrapper wrapper)
    {
        if (cutscene == null)
        {
            return(null);
        }

        if (wrapper == null || !cutscene.Equals(wrapper.Behaviour))
        {
            return(CreateWrapper(cutscene));
        }
        else
        {
            wrapper.Behaviour   = cutscene;
            wrapper.Duration    = cutscene.Duration;
            wrapper.IsPlaying   = cutscene.State == Cutscene.CutsceneState.PreviewPlaying || cutscene.State == Cutscene.CutsceneState.Playing;
            wrapper.RunningTime = cutscene.RunningTime;

            List <Behaviour> itemsToRemove = new List <Behaviour>();
            {
                // foreach(var behaviour in wrapper.Behaviours)
                var __enumerator1 = (wrapper.Behaviours).GetEnumerator();
                while (__enumerator1.MoveNext())
                {
                    var behaviour = (Behaviour)__enumerator1.Current;
                    {
                        bool found = false;
                        {
                            // foreach(var group in cutscene.TrackGroups)
                            var __enumerator14 = (cutscene.TrackGroups).GetEnumerator();
                            while (__enumerator14.MoveNext())
                            {
                                var group = (TrackGroup)__enumerator14.Current;
                                {
                                    if (behaviour.Equals(group))
                                    {
                                        found = true;
                                        break;
                                    }
                                }
                            }
                        }
                        if (!found || behaviour == null)
                        {
                            itemsToRemove.Add(behaviour);
                        }
                    }
                }
            }
            {
                var __list2      = itemsToRemove;
                var __listCount2 = __list2.Count;
                for (int __i2 = 0; __i2 < __listCount2; ++__i2)
                {
                    var trackGroup = (Behaviour)__list2[__i2];
                    {
                        wrapper.HasChanged = true;
                        wrapper.RemoveTrackGroup(trackGroup);
                    }
                }
            }
            {
                var __array3       = cutscene.TrackGroups;
                var __arrayLength3 = __array3.Length;
                for (int __i3 = 0; __i3 < __arrayLength3; ++__i3)
                {
                    var tg = (TrackGroup)__array3[__i3];
                    {
                        TrackGroupWrapper tgWrapper = null;
                        if (!wrapper.ContainsTrackGroup(tg, out tgWrapper))
                        {
                            tgWrapper         = new TrackGroupWrapper(tg);
                            tgWrapper.Ordinal = tg.Ordinal;
                            wrapper.AddTrackGroup(tg, tgWrapper);
                            wrapper.HasChanged = true;
                        }
                        {
                            // foreach(var track in tg.GetTracks())
                            var __enumerator19 = (tg.GetTracks()).GetEnumerator();
                            while (__enumerator19.MoveNext())
                            {
                                var track = (TimelineTrack)__enumerator19.Current;
                                {
                                    TimelineTrackWrapper trackWrapper = null;
                                    if (!tgWrapper.ContainsTrack(track, out trackWrapper))
                                    {
                                        trackWrapper         = new TimelineTrackWrapper(track);
                                        trackWrapper.Ordinal = track.Ordinal;
                                        tgWrapper.AddTrack(track, trackWrapper);
                                        tgWrapper.HasChanged = true;
                                    }
                                    {
                                        // foreach(var item in track.GetTimelineItems())
                                        var __enumerator28 = (track.GetTimelineItems()).GetEnumerator();
                                        while (__enumerator28.MoveNext())
                                        {
                                            var item = (TimelineItem)__enumerator28.Current;
                                            {
                                                TimelineItemWrapper itemWrapper = null;
                                                if (!trackWrapper.ContainsItem(item, out itemWrapper))
                                                {
                                                    if (item.GetType().IsSubclassOf(typeof(CinemaClipCurve)))
                                                    {
                                                        CinemaClipCurve clip = item as CinemaClipCurve;
                                                        itemWrapper = new CinemaClipCurveWrapper(clip, clip.Firetime, clip.Duration);
                                                        trackWrapper.AddItem(clip, itemWrapper);
                                                    }
                                                    else if (item.GetType().IsSubclassOf(typeof(CinemaTween)))
                                                    {
                                                        CinemaTween tween = item as CinemaTween;
                                                        itemWrapper = new CinemaTweenWrapper(tween, tween.Firetime, tween.Duration);
                                                        trackWrapper.AddItem(tween, itemWrapper);
                                                    }
                                                    else if (item.GetType().IsSubclassOf(typeof(TimelineActionFixed)))
                                                    {
                                                        TimelineActionFixed fixedAction = item as TimelineActionFixed;
                                                        itemWrapper = new CinemaActionFixedWrapper(fixedAction, fixedAction.Firetime, fixedAction.Duration, fixedAction.InTime, fixedAction.OutTime, fixedAction.ItemLength);
                                                        trackWrapper.AddItem(fixedAction, itemWrapper);
                                                    }
                                                    else if (item.GetType().IsSubclassOf(typeof(TimelineAction)))
                                                    {
                                                        TimelineAction action = item as TimelineAction;
                                                        itemWrapper = new CinemaActionWrapper(action, action.Firetime, action.Duration);
                                                        trackWrapper.AddItem(action, itemWrapper);
                                                    }
                                                    else
                                                    {
                                                        itemWrapper = new TimelineItemWrapper(item, item.Firetime);
                                                        trackWrapper.AddItem(item, itemWrapper);
                                                    }
                                                    trackWrapper.HasChanged = true;
                                                }
                                                else
                                                {
                                                    if (GUIUtility.hotControl == 0)
                                                    {
                                                        if (itemWrapper.GetType() == (typeof(CinemaClipCurveWrapper)))
                                                        {
                                                            CinemaClipCurve        clip        = item as CinemaClipCurve;
                                                            CinemaClipCurveWrapper clipWrapper = itemWrapper as CinemaClipCurveWrapper;
                                                            clipWrapper.Firetime = clip.Firetime;
                                                            clipWrapper.Duration = clip.Duration;
                                                        }
                                                        else if (itemWrapper.GetType() == (typeof(CinemaTweenWrapper)))
                                                        {
                                                        }
                                                        else if (itemWrapper.GetType() == (typeof(CinemaActionFixedWrapper)))
                                                        {
                                                            TimelineActionFixed      actionFixed        = item as TimelineActionFixed;
                                                            CinemaActionFixedWrapper actionFixedWrapper = itemWrapper as CinemaActionFixedWrapper;
                                                            actionFixedWrapper.Firetime   = actionFixed.Firetime;
                                                            actionFixedWrapper.Duration   = actionFixed.Duration;
                                                            actionFixedWrapper.InTime     = actionFixed.InTime;
                                                            actionFixedWrapper.OutTime    = actionFixed.OutTime;
                                                            actionFixedWrapper.ItemLength = actionFixed.ItemLength;
                                                        }
                                                        else if (itemWrapper.GetType() == (typeof(CinemaActionWrapper)))
                                                        {
                                                            TimelineAction      action        = item as TimelineAction;
                                                            CinemaActionWrapper actionWrapper = itemWrapper as CinemaActionWrapper;
                                                            actionWrapper.Firetime = action.Firetime;
                                                            actionWrapper.Duration = action.Duration;
                                                        }
                                                        else
                                                        {
                                                            itemWrapper.Firetime = item.Firetime;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }

                                    // Remove missing track items
                                    List <Behaviour> itemRemovals = new List <Behaviour>();
                                    {
                                        // foreach(var behaviour in trackWrapper.Behaviours)
                                        var __enumerator30 = (trackWrapper.Behaviours).GetEnumerator();
                                        while (__enumerator30.MoveNext())
                                        {
                                            var behaviour = (Behaviour)__enumerator30.Current;
                                            {
                                                bool found = false;
                                                {
                                                    var __array34       = track.GetTimelineItems();
                                                    var __arrayLength34 = __array34.Length;
                                                    for (int __i34 = 0; __i34 < __arrayLength34; ++__i34)
                                                    {
                                                        var item = (TimelineItem)__array34[__i34];
                                                        {
                                                            if (behaviour.Equals(item))
                                                            {
                                                                found = true;
                                                                break;
                                                            }
                                                        }
                                                    }
                                                }
                                                if (!found || behaviour == null)
                                                {
                                                    itemRemovals.Add(behaviour);
                                                }
                                            }
                                        }
                                    }
                                    {
                                        var __list31      = itemRemovals;
                                        var __listCount31 = __list31.Count;
                                        for (int __i31 = 0; __i31 < __listCount31; ++__i31)
                                        {
                                            var item = (Behaviour)__list31[__i31];
                                            {
                                                trackWrapper.HasChanged = true;
                                                trackWrapper.RemoveItem(item);
                                            }
                                        }
                                    }
                                }
                            }
                        }

                        // Remove missing tracks
                        List <Behaviour> removals = new List <Behaviour>();
                        {
                            // foreach(var behaviour in tgWrapper.Behaviours)
                            var __enumerator21 = (tgWrapper.Behaviours).GetEnumerator();
                            while (__enumerator21.MoveNext())
                            {
                                var behaviour = (Behaviour)__enumerator21.Current;
                                {
                                    bool found = false;
                                    {
                                        // foreach(var track in tg.GetTracks())
                                        var __enumerator32 = (tg.GetTracks()).GetEnumerator();
                                        while (__enumerator32.MoveNext())
                                        {
                                            var track = (TimelineTrack)__enumerator32.Current;
                                            {
                                                if (behaviour.Equals(track))
                                                {
                                                    found = true;
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                    if (!found || behaviour == null)
                                    {
                                        removals.Add(behaviour);
                                    }
                                }
                            }
                        }
                        {
                            var __list22      = removals;
                            var __listCount22 = __list22.Count;
                            for (int __i22 = 0; __i22 < __listCount22; ++__i22)
                            {
                                var track = (Behaviour)__list22[__i22];
                                {
                                    tgWrapper.HasChanged = true;
                                    tgWrapper.RemoveTrack(track);
                                }
                            }
                        }
                    }
                }
            }
        }

        return(wrapper);
    }
Exemplo n.º 9
0
    public override void HandleInput(DirectorControlState state, Rect trackPosition)
    {
        CinemaActionFixedWrapper wrapper = base.Wrapper as CinemaActionFixedWrapper;

        if (wrapper == null)
        {
            return;
        }
        if (base.isRenaming)
        {
            return;
        }
        float num  = state.TimeToPosition(wrapper.Firetime);
        float num2 = state.TimeToPosition(wrapper.Firetime + wrapper.Duration);

        base.controlPosition = new Rect(num, 0f, num2 - num, trackPosition.height);
        bool  flag1 = this.controlPosition.width < 15f;
        float num3  = flag1 ? 0f : 5f;
        Rect  rect  = new Rect(num, 0f, num3, trackPosition.height);
        Rect  rect2 = new Rect(num + num3, 0f, (num2 - num) - (2f * num3), trackPosition.height);
        Rect  rect3 = new Rect(num2 - num3, 0f, num3, trackPosition.height);

        EditorGUIUtility.AddCursorRect(rect2, MouseCursor.SlideArrow);
        if (!flag1)
        {
            EditorGUIUtility.AddCursorRect(rect, MouseCursor.ResizeHorizontal);
            EditorGUIUtility.AddCursorRect(rect3, MouseCursor.ResizeHorizontal);
        }
        base.controlID = GUIUtility.GetControlID(wrapper.Behaviour.GetInstanceID(), UnityEngine.FocusType.Passive, base.controlPosition);
        int num4 = GUIUtility.GetControlID(wrapper.Behaviour.GetInstanceID(), FocusType.Passive, rect);
        int num5 = GUIUtility.GetControlID(wrapper.Behaviour.GetInstanceID(), FocusType.Passive, rect2);
        int num6 = GUIUtility.GetControlID(wrapper.Behaviour.GetInstanceID(), FocusType.Passive, rect3);

        if (((Event.current.GetTypeForControl(base.controlID) == EventType.MouseDown) && rect2.Contains(Event.current.mousePosition)) && (Event.current.button == 1))
        {
            if (!base.IsSelected)
            {
                GameObject[] objArray = Selection.gameObjects;
                ArrayUtility.Add <GameObject>(ref objArray, base.Wrapper.Behaviour.gameObject);
                Selection.objects        = objArray;
                base.hasSelectionChanged = true;
            }
            this.showContextMenu(wrapper.Behaviour);
            if (!base.TrackControl.TargetTrack.IsLocked)
            {
                Event.current.Use();
            }
        }
        switch (Event.current.GetTypeForControl(num5))
        {
        case 0:
        {
            if (!rect2.Contains(Event.current.mousePosition) || (Event.current.button != 0))
            {
                goto Label_0447;
            }
            GUIUtility.hotControl = num5;
            if (!Event.current.control)
            {
                if (!base.IsSelected)
                {
                    Selection.activeInstanceID = base.Behaviour.GetInstanceID();
                }
                break;
            }
            if (!base.IsSelected)
            {
                GameObject[] objArray3 = Selection.gameObjects;
                ArrayUtility.Add <GameObject>(ref objArray3, base.Wrapper.Behaviour.gameObject);
                Selection.objects        = objArray3;
                base.hasSelectionChanged = true;
                break;
            }
            GameObject[] objArray2 = Selection.gameObjects;
            ArrayUtility.Remove <GameObject>(ref objArray2, base.Wrapper.Behaviour.gameObject);
            Selection.objects        = (objArray2);
            base.hasSelectionChanged = true;
            break;
        }

        case EventType.MouseUp:
            if (GUIUtility.hotControl == num5)
            {
                mouseDownOffset       = -1f;
                GUIUtility.hotControl = (0);
                if (base.mouseDragActivity)
                {
                    base.TriggerTrackItemUpdateEvent();
                }
                else if (!Event.current.control)
                {
                    Selection.activeInstanceID = (base.Behaviour.GetInstanceID());
                }
                else if (!base.hasSelectionChanged)
                {
                    if (!base.IsSelected)
                    {
                        GameObject[] objArray5 = Selection.gameObjects;
                        ArrayUtility.Add <GameObject>(ref objArray5, base.Wrapper.Behaviour.gameObject);
                        Selection.objects = (objArray5);
                    }
                    else
                    {
                        GameObject[] objArray4 = Selection.gameObjects;
                        ArrayUtility.Remove <GameObject>(ref objArray4, base.Wrapper.Behaviour.gameObject);
                        Selection.objects = (objArray4);
                    }
                }
                base.hasSelectionChanged = false;
            }
            goto Label_0447;

        case (EventType)3:
            if (GUIUtility.hotControl == num5)
            {
                Undo.RecordObject(base.Behaviour, string.Format("Changed {0}", base.Behaviour.name));
                float firetime = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                firetime = state.SnappedTime(firetime - mouseDownOffset);
                if (!base.mouseDragActivity)
                {
                    base.mouseDragActivity = base.Wrapper.Firetime != firetime;
                }
                base.TriggerRequestTrackItemTranslate(firetime);
            }
            goto Label_0447;

        default:
            goto Label_0447;
        }
        base.mouseDragActivity = false;
        mouseDownOffset        = ((Event.current.mousePosition.x - state.Translation.x) / state.Scale.x) - wrapper.Firetime;
        if (!base.TrackControl.TargetTrack.IsLocked)
        {
            Event.current.Use();
        }
Label_0447:
        switch (Event.current.GetTypeForControl(num4))
        {
        case 0:
            if (rect.Contains(Event.current.mousePosition))
            {
                GUIUtility.hotControl = (num4);
                mouseDownOffset       = ((Event.current.mousePosition.x - state.Translation.x) / state.Scale.x) - wrapper.Firetime;
                if (!base.TrackControl.TargetTrack.IsLocked)
                {
                    Event.current.Use();
                }
            }
            break;

        case (EventType)1:
            if (GUIUtility.hotControl == num4)
            {
                mouseDownOffset       = -1f;
                GUIUtility.hotControl = (0);
            }
            break;

        case (EventType)3:
            if (GUIUtility.hotControl == num4)
            {
                float time = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                time = state.SnappedTime(time);
                if (time >= 0f)
                {
                    float num9 = wrapper.InTime - (wrapper.Firetime - time);
                    num9 = Mathf.Clamp(num9, 0f, wrapper.ItemLength);
                    float num10 = num9 - wrapper.InTime;
                    wrapper.InTime    = num9;
                    wrapper.Firetime += num10;
                    if (this.AlterFixedAction != null)
                    {
                        this.AlterFixedAction(this, new ActionFixedItemEventArgs(wrapper.Behaviour, wrapper.Firetime, wrapper.Duration, wrapper.InTime, wrapper.OutTime));
                    }
                }
            }
            break;
        }
        switch (Event.current.GetTypeForControl(num6))
        {
        case 0:
            if (rect3.Contains(Event.current.mousePosition))
            {
                GUIUtility.hotControl = (num6);
                mouseDownOffset       = ((Event.current.mousePosition.x - state.Translation.x) / state.Scale.x) - wrapper.Firetime;
                if (!base.TrackControl.TargetTrack.IsLocked)
                {
                    Event.current.Use();
                }
            }
            break;

        case (EventType)1:
            if (GUIUtility.hotControl == num6)
            {
                mouseDownOffset       = -1f;
                GUIUtility.hotControl = (0);
            }
            break;

        case (EventType)3:
            if (GUIUtility.hotControl == num6)
            {
                float num11 = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                float num12 = state.SnappedTime(num11) - (wrapper.Firetime - wrapper.InTime);
                Undo.RecordObject(wrapper.Behaviour, string.Format("Changed {0}", wrapper.Behaviour.name));
                wrapper.OutTime = Mathf.Clamp(num12, 0f, wrapper.ItemLength);
                if (this.AlterFixedAction != null)
                {
                    this.AlterFixedAction(this, new ActionFixedItemEventArgs(wrapper.Behaviour, wrapper.Firetime, wrapper.Duration, wrapper.InTime, wrapper.OutTime));
                }
            }
            break;
        }
        if (Selection.activeGameObject == base.Wrapper.Behaviour.gameObject)
        {
            if ((Event.current.type == (EventType)13) && (Event.current.commandName == "Copy"))
            {
                Event.current.Use();
            }
            if ((Event.current.type == (EventType)14) && (Event.current.commandName == "Copy"))
            {
                DirectorCopyPaste.Copy(base.Wrapper.Behaviour);
                Event.current.Use();
            }
        }
        if (((Event.current.type == (EventType)4) && (Event.current.keyCode == (KeyCode)0x7f)) && (Selection.activeGameObject == base.Wrapper.Behaviour.gameObject))
        {
            base.deleteItem(base.Wrapper.Behaviour);
            Event.current.Use();
        }
    }
Exemplo n.º 10
0
    public override void HandleInput(DirectorControlState state, Rect trackPosition)
    {
        CinemaActionFixedWrapper cinemaActionFixedWrapper = base.Wrapper as CinemaActionFixedWrapper;

        if (cinemaActionFixedWrapper == null)
        {
            return;
        }
        if (this.isRenaming)
        {
            return;
        }
        float num  = state.TimeToPosition(cinemaActionFixedWrapper.Firetime);
        float num2 = state.TimeToPosition(cinemaActionFixedWrapper.Firetime + cinemaActionFixedWrapper.Duration);

        this.controlPosition = new Rect(num, 0f, num2 - num, trackPosition.height);
        bool  expr_67 = this.controlPosition.width < 15f;
        float num3    = expr_67 ? 0f : 5f;
        Rect  rect    = new Rect(num, 0f, num3, trackPosition.height);
        Rect  rect2   = new Rect(num + num3, 0f, num2 - num - 2f * num3, trackPosition.height);
        Rect  rect3   = new Rect(num2 - num3, 0f, num3, trackPosition.height);

        EditorGUIUtility.AddCursorRect(rect2, (MouseCursor)5);
        if (!expr_67)
        {
            EditorGUIUtility.AddCursorRect(rect, (MouseCursor)3);
            EditorGUIUtility.AddCursorRect(rect3, (MouseCursor)3);
        }
        this.controlID = GUIUtility.GetControlID(cinemaActionFixedWrapper.Behaviour.GetInstanceID(), (FocusType)2, this.controlPosition);
        int controlID  = GUIUtility.GetControlID(cinemaActionFixedWrapper.Behaviour.GetInstanceID(), (FocusType)2, rect);
        int controlID2 = GUIUtility.GetControlID(cinemaActionFixedWrapper.Behaviour.GetInstanceID(), (FocusType)2, rect2);
        int controlID3 = GUIUtility.GetControlID(cinemaActionFixedWrapper.Behaviour.GetInstanceID(), (FocusType)2, rect3);

        if (Event.current.GetTypeForControl(this.controlID) == EventType.MouseDown && rect2.Contains(Event.current.mousePosition) && (int)Event.current.button == 1)
        {
            if (!base.IsSelected)
            {
                GameObject[] gameObjects = Selection.gameObjects;
                ArrayUtility.Add <GameObject>(ref gameObjects, base.Wrapper.Behaviour.gameObject);
                Selection.objects        = (gameObjects);
                this.hasSelectionChanged = true;
            }
            this.showContextMenu(cinemaActionFixedWrapper.Behaviour);
            Event.current.Use();
        }
        switch ((int)Event.current.GetTypeForControl(controlID2))
        {
        case 0:
            if (rect2.Contains(Event.current.mousePosition) && (int)Event.current.button == 0)
            {
                GUIUtility.hotControl = (controlID2);
                if (Event.current.control)
                {
                    if (base.IsSelected)
                    {
                        GameObject[] gameObjects2 = Selection.gameObjects;
                        ArrayUtility.Remove <GameObject>(ref gameObjects2, base.Wrapper.Behaviour.gameObject);
                        Selection.objects        = (gameObjects2);
                        this.hasSelectionChanged = true;
                    }
                    else
                    {
                        GameObject[] gameObjects3 = Selection.gameObjects;
                        ArrayUtility.Add <GameObject>(ref gameObjects3, base.Wrapper.Behaviour.gameObject);
                        Selection.objects        = (gameObjects3);
                        this.hasSelectionChanged = true;
                    }
                }
                else if (!base.IsSelected)
                {
                    Selection.activeInstanceID = (base.Behaviour.GetInstanceID());
                }
                this.mouseDragActivity = false;
                ActionFixedItemControl.mouseDownOffset = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x - cinemaActionFixedWrapper.Firetime;
                Event.current.Use();
            }
            break;

        case 1:
            if (GUIUtility.hotControl == controlID2)
            {
                ActionFixedItemControl.mouseDownOffset = -1f;
                GUIUtility.hotControl = (0);
                if (!this.mouseDragActivity)
                {
                    if (Event.current.control)
                    {
                        if (!this.hasSelectionChanged)
                        {
                            if (base.IsSelected)
                            {
                                GameObject[] gameObjects4 = Selection.gameObjects;
                                ArrayUtility.Remove <GameObject>(ref gameObjects4, base.Wrapper.Behaviour.gameObject);
                                Selection.objects = (gameObjects4);
                            }
                            else
                            {
                                GameObject[] gameObjects5 = Selection.gameObjects;
                                ArrayUtility.Add <GameObject>(ref gameObjects5, base.Wrapper.Behaviour.gameObject);
                                Selection.objects = (gameObjects5);
                            }
                        }
                    }
                    else
                    {
                        Selection.activeInstanceID = (base.Behaviour.GetInstanceID());
                    }
                }
                else
                {
                    base.TriggerTrackItemUpdateEvent();
                }
                this.hasSelectionChanged = false;
            }
            break;

        case 3:
            if (GUIUtility.hotControl == controlID2)
            {
                Undo.RecordObject(base.Behaviour, string.Format("Changed {0}", base.Behaviour.name));
                float num4 = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                num4 = state.SnappedTime(num4 - ActionFixedItemControl.mouseDownOffset);
                if (!this.mouseDragActivity)
                {
                    this.mouseDragActivity = (base.Wrapper.Firetime != num4);
                }
                base.TriggerRequestTrackItemTranslate(num4);
            }
            break;
        }
        switch ((int)Event.current.GetTypeForControl(controlID))
        {
        case 0:
            if (rect.Contains(Event.current.mousePosition))
            {
                GUIUtility.hotControl = (controlID);
                ActionFixedItemControl.mouseDownOffset = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x - cinemaActionFixedWrapper.Firetime;
                Event.current.Use();
            }
            break;

        case 1:
            if (GUIUtility.hotControl == controlID)
            {
                ActionFixedItemControl.mouseDownOffset = -1f;
                GUIUtility.hotControl = (0);
            }
            break;

        case 3:
            if (GUIUtility.hotControl == controlID)
            {
                float num5 = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                num5 = state.SnappedTime(num5);
                if (num5 >= 0f)
                {
                    float num6 = cinemaActionFixedWrapper.InTime - (cinemaActionFixedWrapper.Firetime - num5);
                    num6 = Mathf.Clamp(num6, 0f, cinemaActionFixedWrapper.ItemLength);
                    float num7 = num6 - cinemaActionFixedWrapper.InTime;
                    cinemaActionFixedWrapper.InTime    = num6;
                    cinemaActionFixedWrapper.Firetime += num7;
                    if (this.AlterFixedAction != null)
                    {
                        this.AlterFixedAction(this, new ActionFixedItemEventArgs(cinemaActionFixedWrapper.Behaviour, cinemaActionFixedWrapper.Firetime, cinemaActionFixedWrapper.Duration, cinemaActionFixedWrapper.InTime, cinemaActionFixedWrapper.OutTime));
                    }
                }
            }
            break;
        }
        switch ((int)Event.current.GetTypeForControl(controlID3))
        {
        case 0:
            if (rect3.Contains(Event.current.mousePosition))
            {
                GUIUtility.hotControl = (controlID3);
                ActionFixedItemControl.mouseDownOffset = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x - cinemaActionFixedWrapper.Firetime;
                Event.current.Use();
            }
            break;

        case 1:
            if (GUIUtility.hotControl == controlID3)
            {
                ActionFixedItemControl.mouseDownOffset = -1f;
                GUIUtility.hotControl = (0);
            }
            break;

        case 3:
            if (GUIUtility.hotControl == controlID3)
            {
                float num8 = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                num8 = state.SnappedTime(num8);
                float num9 = num8 - (cinemaActionFixedWrapper.Firetime - cinemaActionFixedWrapper.InTime);
                Undo.RecordObject(cinemaActionFixedWrapper.Behaviour, string.Format("Changed {0}", cinemaActionFixedWrapper.Behaviour.name));
                cinemaActionFixedWrapper.OutTime = Mathf.Clamp(num9, 0f, cinemaActionFixedWrapper.ItemLength);
                if (this.AlterFixedAction != null)
                {
                    this.AlterFixedAction(this, new ActionFixedItemEventArgs(cinemaActionFixedWrapper.Behaviour, cinemaActionFixedWrapper.Firetime, cinemaActionFixedWrapper.Duration, cinemaActionFixedWrapper.InTime, cinemaActionFixedWrapper.OutTime));
                }
            }
            break;
        }
        if (Selection.activeGameObject == Wrapper.Behaviour.gameObject)
        {
            if (Event.current.type == EventType.ValidateCommand && Event.current.commandName == "Copy")
            {
                Event.current.Use();
            }
            if (Event.current.type == EventType.ExecuteCommand && Event.current.commandName == "Copy")
            {
                DirectorCopyPaste.Copy(Wrapper.Behaviour);
                Event.current.Use();
            }
        }
        if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Delete && Selection.activeGameObject == Wrapper.Behaviour.gameObject)
        {
            deleteItem(Wrapper.Behaviour);
            Event.current.Use();
        }
    }