public override void ResizeControlPosition(DirectorControlState state, Rect trackPosition)
    {
        CinemaActionWrapper wrapper = base.Wrapper as CinemaActionWrapper;

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

        this.controlPosition = new Rect(num, 0f, num2 - num, trackPosition.height);
        SkillParticleActionItem action = Wrapper.Behaviour as SkillParticleActionItem;

        if (action == null)
        {
            return;
        }
        if (ParentEmitter != null)
        {
            int level = ParentEmitter.GetLevel();
            controlPosition = new Rect(controlPosition.x, trackPosition.height - trackPosition.height / level, controlPosition.width, trackPosition.height / level);
        }
    }
示例#2
0
    internal override void ConfirmTranslate()
    {
        CinemaActionWrapper wrapper = base.Wrapper as CinemaActionWrapper;

        if ((wrapper != null) && (this.AlterAction != null))
        {
            this.AlterAction(this, new ActionItemEventArgs(wrapper.Behaviour, wrapper.Firetime, wrapper.Duration));
        }
    }
    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);
    }
示例#4
0
    internal override float RequestTranslate(float amount)
    {
        CinemaActionWrapper cinemaActionWrapper = base.Wrapper as CinemaActionWrapper;

        if (cinemaActionWrapper == null)
        {
            return(0f);
        }
        float num        = base.Wrapper.Firetime + amount;
        float num2       = base.Wrapper.Firetime + amount;
        bool  flag       = true;
        float num3       = 0f;
        float num4       = float.PositiveInfinity;
        float newEndtime = num2 + cinemaActionWrapper.Duration;

        using (IEnumerator <TimelineItemWrapper> enumerator = base.Track.Items.GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                CinemaActionWrapper cinemaActionWrapper2 = enumerator.Current as CinemaActionWrapper;
                if (cinemaActionWrapper2 != null && cinemaActionWrapper2.Behaviour != cinemaActionWrapper.Behaviour && !Selection.Contains(cinemaActionWrapper2.Behaviour.gameObject))
                {
                    float num5 = cinemaActionWrapper2.Firetime + cinemaActionWrapper2.Duration;
                    float num6 = cinemaActionWrapper.Firetime + cinemaActionWrapper.Duration;
                    if (this.doActionsConflict(cinemaActionWrapper2.Firetime, num5, num2, newEndtime))
                    {
                        flag = false;
                    }
                    if (num5 <= cinemaActionWrapper.Firetime)
                    {
                        num3 = Mathf.Max(num3, num5);
                    }
                    if (cinemaActionWrapper2.Firetime >= num6)
                    {
                        num4 = Mathf.Min(num4, cinemaActionWrapper2.Firetime);
                    }
                }
            }
        }
        float num7;

        if (flag)
        {
            num7 = Mathf.Max(0f, num2);
        }
        else
        {
            num2 = Mathf.Max(num3, num2);
            num2 = Mathf.Min(num4 - cinemaActionWrapper.Duration, num2);
            num7 = num2;
        }
        return(amount + (num7 - num));
    }
示例#5
0
    internal override void ConfirmTranslate()
    {
        CinemaActionWrapper cinemaActionWrapper = base.Wrapper as CinemaActionWrapper;

        if (cinemaActionWrapper == null)
        {
            return;
        }
        if (AlterAction != null)
        {
            AlterAction(this, new ActionItemEventArgs(cinemaActionWrapper.Behaviour, cinemaActionWrapper.Firetime, cinemaActionWrapper.Duration));
        }
    }
示例#6
0
    internal override float RequestTranslate(float amount)
    {
        CinemaActionWrapper wrapper = base.Wrapper as CinemaActionWrapper;

        if (wrapper == null)
        {
            return(0f);
        }
        float num              = base.Wrapper.Firetime + amount;
        float newFiretime      = base.Wrapper.Firetime + amount;
        float num3             = newFiretime;
        bool  flag             = true;
        float num4             = 0f;
        float positiveInfinity = float.PositiveInfinity;
        float newEndtime       = newFiretime + wrapper.Duration;

        foreach (CinemaActionWrapper wrapper2 in base.Track.Items)
        {
            if (((wrapper2 != null) && (wrapper2.Behaviour != wrapper.Behaviour)) && !Selection.Contains(wrapper2.Behaviour.gameObject))
            {
                float endtime = wrapper2.Firetime + wrapper2.Duration;
                float num8    = wrapper.Firetime + wrapper.Duration;
                if (this.doActionsConflict(wrapper2.Firetime, endtime, newFiretime, newEndtime))
                {
                    flag = false;
                }
                if (endtime <= wrapper.Firetime)
                {
                    num4 = Mathf.Max(num4, endtime);
                }
                if (wrapper2.Firetime >= num8)
                {
                    positiveInfinity = Mathf.Min(positiveInfinity, wrapper2.Firetime);
                }
            }
        }
        if (flag)
        {
            num3 = Mathf.Max(0f, newFiretime);
        }
        else
        {
            newFiretime = Mathf.Max(num4, newFiretime);
            num3        = Mathf.Min(positiveInfinity - wrapper.Duration, newFiretime);
        }
        return(amount + (num3 - num));
    }
示例#7
0
    public virtual void ResizeControlPosition(DirectorControlState state, Rect trackPosition)
    {
        CinemaActionWrapper wrapper = base.Wrapper as CinemaActionWrapper;

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

        this.controlPosition = new Rect(num, 0f, num2 - num, trackPosition.height);
    }
示例#8
0
    public override void ResizeControlPosition(DirectorControlState state, Rect trackPosition)
    {
        CinemaActionWrapper wrapper = base.Wrapper as CinemaActionWrapper;

        if (wrapper == null)
        {
            return;
        }
        if (base.isRenaming)
        {
            return;
        }
        SkillParticleEmitterItem action = Wrapper.Behaviour as SkillParticleEmitterItem;
        float num  = (wrapper.Firetime * state.Scale.x) + state.Translation.x;
        float num2 = ((wrapper.Firetime + wrapper.Duration) * state.Scale.x) + state.Translation.x;

        this.controlPosition = new Rect(num, 0f, num2 - num, trackPosition.height / action.GetLevel());
    }
    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;
    }
示例#11
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);
    }
示例#12
0
    public override void HandleInput(DirectorControlState state, Rect trackPosition)
    {
        CinemaActionWrapper cinemaActionWrapper = base.Wrapper as CinemaActionWrapper;

        if (cinemaActionWrapper == null)
        {
            return;
        }
        if (this.isRenaming)
        {
            return;
        }
        float num  = cinemaActionWrapper.Firetime * state.Scale.x + state.Translation.x;
        float num2 = (cinemaActionWrapper.Firetime + cinemaActionWrapper.Duration) * state.Scale.x + state.Translation.x;

        this.controlPosition = new Rect(num, 0f, num2 - num, trackPosition.height);
        Rect rect  = new Rect(num, 0f, 5f, this.controlPosition.height);
        Rect rect2 = new Rect(num + 5f, 0f, num2 - num - 10f, this.controlPosition.height);
        Rect rect3 = new Rect(num2 - 5f, 0f, 5f, this.controlPosition.height);

        EditorGUIUtility.AddCursorRect(rect, (MouseCursor)3);
        EditorGUIUtility.AddCursorRect(rect2, (MouseCursor)5);
        EditorGUIUtility.AddCursorRect(rect3, (MouseCursor)3);
        this.controlID = GUIUtility.GetControlID(Wrapper.Behaviour.GetInstanceID(), (FocusType)2, this.controlPosition);
        int controlID  = GUIUtility.GetControlID(Wrapper.Behaviour.GetInstanceID(), (FocusType)2, rect);
        int controlID2 = GUIUtility.GetControlID(Wrapper.Behaviour.GetInstanceID(), (FocusType)2, rect2);
        int controlID3 = GUIUtility.GetControlID(Wrapper.Behaviour.GetInstanceID(), (FocusType)2, rect3);

        if (Event.current.GetTypeForControl(this.controlID) == EventType.MouseDown && rect2.Contains(Event.current.mousePosition) && Event.current.button == 1)
        {
            if (!IsSelected)
            {
                GameObject[] gameObjects = Selection.gameObjects;
                ArrayUtility.Add(ref gameObjects, Wrapper.Behaviour.gameObject);
                Selection.objects   = (gameObjects);
                hasSelectionChanged = true;
            }
            this.showContextMenu(base.Wrapper.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;
                ActionItemControl.mouseDownOffset = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x - cinemaActionWrapper.Firetime;
                Event.current.Use();
            }
            break;

        case 1:
            if (GUIUtility.hotControl == controlID2)
            {
                ActionItemControl.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 && !this.hasSelectionChanged)
            {
                Undo.RecordObject(base.Behaviour, string.Format("Changed {0}", base.Behaviour.name));
                float num3 = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                num3 = state.SnappedTime(num3 - ActionItemControl.mouseDownOffset);
                if (!this.mouseDragActivity)
                {
                    this.mouseDragActivity = (base.Wrapper.Firetime != num3);
                }
                base.TriggerRequestTrackItemTranslate(num3);
            }
            break;
        }
        switch ((int)Event.current.GetTypeForControl(controlID))
        {
        case 0:
            if (rect.Contains(Event.current.mousePosition))
            {
                GUIUtility.hotControl             = (controlID);
                ActionItemControl.mouseDownOffset = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x - cinemaActionWrapper.Firetime;
                Event.current.Use();
            }
            break;

        case 1:
            if (GUIUtility.hotControl == controlID)
            {
                ActionItemControl.mouseDownOffset = -1f;
                GUIUtility.hotControl             = (0);
                if (this.AlterAction != null)
                {
                    this.AlterAction(this, new ActionItemEventArgs(cinemaActionWrapper.Behaviour, cinemaActionWrapper.Firetime, cinemaActionWrapper.Duration));
                }
            }
            break;

        case 3:
            if (GUIUtility.hotControl == controlID)
            {
                float num4 = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                num4 = state.SnappedTime(num4);
                float num5 = 0f;
                float num6 = cinemaActionWrapper.Firetime + cinemaActionWrapper.Duration;
                using (IEnumerator <TimelineItemWrapper> enumerator = base.Track.Items.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        CinemaActionWrapper cinemaActionWrapper2 = enumerator.Current as CinemaActionWrapper;
                        if (cinemaActionWrapper2 != null && cinemaActionWrapper2.Behaviour != base.Wrapper.Behaviour)
                        {
                            float num7 = cinemaActionWrapper2.Firetime + cinemaActionWrapper2.Duration;
                            if (num7 <= base.Wrapper.Firetime)
                            {
                                num5 = Mathf.Max(num5, num7);
                            }
                        }
                    }
                }
                num4 = Mathf.Max(num5, num4);
                num4 = Mathf.Min(num6, num4);
                cinemaActionWrapper.Duration += base.Wrapper.Firetime - num4;
                cinemaActionWrapper.Firetime  = num4;
            }
            break;
        }
        switch ((int)Event.current.GetTypeForControl(controlID3))
        {
        case 0:
            if (rect3.Contains(Event.current.mousePosition))
            {
                GUIUtility.hotControl             = (controlID3);
                ActionItemControl.mouseDownOffset = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x - base.Wrapper.Firetime;
                Event.current.Use();
            }
            break;

        case 1:
            if (GUIUtility.hotControl == controlID3)
            {
                ActionItemControl.mouseDownOffset = -1f;
                GUIUtility.hotControl             = (0);
                if (this.AlterAction != null)
                {
                    this.AlterAction(this, new ActionItemEventArgs(cinemaActionWrapper.Behaviour, cinemaActionWrapper.Firetime, cinemaActionWrapper.Duration));
                }
            }
            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 = float.PositiveInfinity;
                using (IEnumerator <TimelineItemWrapper> enumerator = base.Track.Items.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        CinemaActionWrapper cinemaActionWrapper3 = enumerator.Current as CinemaActionWrapper;
                        if (cinemaActionWrapper3 != null && cinemaActionWrapper3.Behaviour != base.Wrapper.Behaviour)
                        {
                            float num10 = cinemaActionWrapper.Firetime + cinemaActionWrapper.Duration;
                            if (cinemaActionWrapper3.Firetime >= num10)
                            {
                                num9 = Mathf.Min(num9, cinemaActionWrapper3.Firetime);
                            }
                        }
                    }
                }
                num8 = Mathf.Clamp(num8, base.Wrapper.Firetime, num9);
                cinemaActionWrapper.Duration = num8 - base.Wrapper.Firetime;
            }
            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)127 && Selection.activeGameObject == base.Wrapper.Behaviour.gameObject)
        {
            base.deleteItem(base.Wrapper.Behaviour);
            Event.current.Use();
        }
    }
示例#13
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);
    }
示例#14
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);
    }
示例#15
0
    public override void HandleInput(DirectorControlState state, Rect trackPosition)
    {
        CinemaActionWrapper wrapper = base.Wrapper as CinemaActionWrapper;

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

        ResizeControlPosition(state, trackPosition);
        Rect rect  = new Rect(num, this.controlPosition.y, 5f, this.controlPosition.height);
        Rect rect2 = new Rect(num + 5f, this.controlPosition.y, (num2 - num) - 10f, this.controlPosition.height);
        Rect rect3 = new Rect(num2 - 5f, this.controlPosition.y, 5f, this.controlPosition.height);

        EditorGUIUtility.AddCursorRect(rect, (MouseCursor)3);
        EditorGUIUtility.AddCursorRect(rect2, (MouseCursor)5);
        EditorGUIUtility.AddCursorRect(rect3, (MouseCursor)3);
        base.controlID = GUIUtility.GetControlID(base.Wrapper.Behaviour.GetInstanceID(), (FocusType)2, base.controlPosition);
        int num3 = GUIUtility.GetControlID(base.Wrapper.Behaviour.GetInstanceID(), (FocusType)2, rect);
        int num4 = GUIUtility.GetControlID(base.Wrapper.Behaviour.GetInstanceID(), (FocusType)2, rect2);
        int num5 = GUIUtility.GetControlID(base.Wrapper.Behaviour.GetInstanceID(), (FocusType)2, 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(base.Wrapper.Behaviour);
            Event.current.Use();
        }
        switch (Event.current.GetTypeForControl(num4))
        {
        case 0:
        {
            if (!rect2.Contains(Event.current.mousePosition) || (Event.current.button != 0))
            {
                goto Label_0471;
            }
            GUIUtility.hotControl = (num4);
            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)1:
            if (GUIUtility.hotControl == num4)
            {
                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_0471;

        case (EventType)3:
            if ((GUIUtility.hotControl == num4) && !base.hasSelectionChanged)
            {
                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_0471;

        default:
            goto Label_0471;
        }
        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_0471:
        switch (Event.current.GetTypeForControl(num3))
        {
        case 0:
            if (rect.Contains(Event.current.mousePosition))
            {
                GUIUtility.hotControl = (num3);
                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 == num3)
            {
                mouseDownOffset       = -1f;
                GUIUtility.hotControl = (0);
                if (this.AlterAction != null)
                {
                    this.AlterAction(this, new ActionItemEventArgs(wrapper.Behaviour, wrapper.Firetime, wrapper.Duration));
                }
            }
            break;

        case (EventType)3:
            if (GUIUtility.hotControl == num3)
            {
                float time = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                time = state.SnappedTime(time);
                float num8 = 0f;
                float num9 = wrapper.Firetime + wrapper.Duration;
                foreach (CinemaActionWrapper wrapper2 in base.Track.Items)
                {
                    if ((wrapper2 != null) && (wrapper2.Behaviour != base.Wrapper.Behaviour))
                    {
                        float num10 = wrapper2.Firetime + wrapper2.Duration;
                        if (num10 <= base.Wrapper.Firetime)
                        {
                            num8 = Mathf.Max(num8, num10);
                        }
                    }
                }
                time              = Mathf.Max(num8, time);
                time              = Mathf.Min(num9, time);
                wrapper.Duration += base.Wrapper.Firetime - time;
                wrapper.Firetime  = time;
            }
            break;
        }
        switch (Event.current.GetTypeForControl(num5))
        {
        case 0:
            if (rect3.Contains(Event.current.mousePosition))
            {
                GUIUtility.hotControl = (num5);
                mouseDownOffset       = ((Event.current.mousePosition.x - state.Translation.x) / state.Scale.x) - base.Wrapper.Firetime;
                if (!base.TrackControl.TargetTrack.IsLocked)
                {
                    Event.current.Use();
                }
            }
            break;

        case (EventType)1:
            if (GUIUtility.hotControl == num5)
            {
                mouseDownOffset       = -1f;
                GUIUtility.hotControl = (0);
                if (this.AlterAction != null)
                {
                    this.AlterAction(this, new ActionItemEventArgs(wrapper.Behaviour, wrapper.Firetime, wrapper.Duration));
                }
            }
            break;

        case (EventType)3:
            if (GUIUtility.hotControl == num5)
            {
                float num11 = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                num11 = state.SnappedTime(num11);
                float positiveInfinity = float.PositiveInfinity;
                foreach (CinemaActionWrapper wrapper3 in base.Track.Items)
                {
                    if ((wrapper3 != null) && (wrapper3.Behaviour != base.Wrapper.Behaviour))
                    {
                        float num13 = wrapper.Firetime + wrapper.Duration;
                        if (wrapper3.Firetime >= num13)
                        {
                            positiveInfinity = Mathf.Min(positiveInfinity, wrapper3.Firetime);
                        }
                    }
                }
                num11            = Mathf.Clamp(num11, base.Wrapper.Firetime, positiveInfinity);
                wrapper.Duration = num11 - base.Wrapper.Firetime;
            }
            break;
        }
        if (base.Wrapper.Behaviour.gameObject != null && Selection.activeGameObject != null && 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();
        }
    }