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);
    }
예제 #2
0
    protected virtual void UpdateTracks(DirectorControlState state, Rect header, Rect content, Rect controlArea)
    {
        SortedDictionary <int, TimelineTrackWrapper> sortedDictionary = new SortedDictionary <int, TimelineTrackWrapper>();

        foreach (TimelineTrackWrapper current in timelineTrackMap.Keys)
        {
            timelineTrackMap[current].TargetTrack = current;
            sortedDictionary.Add(current.Ordinal, current);
        }
        float num = header.y + 17f;

        foreach (int current2 in sortedDictionary.Keys)
        {
            TimelineTrackWrapper timelineTrackWrapper = sortedDictionary[current2];
            TimelineTrackControl timelineTrackControl = timelineTrackMap[timelineTrackWrapper];
            timelineTrackControl.Ordinal = new []
            {
                trackGroup.Ordinal,
                current2
            };
            float height           = timelineTrackControl.Rect.height;
            Rect  rect             = new Rect(content.x, num, content.width, height);
            Rect  headerBackground = new Rect(header.x, num, header.width, height);
            Rect  rect2            = new Rect(header.x, num, header.width - sortingOptionsWidth - 4f, height);
            Rect  rect3            = new Rect(rect2.x + rect2.width, num, sortingOptionsWidth / 2f, 16f);
            Rect  arg_225_0        = new Rect(rect3.x + sortingOptionsWidth / 2f, num, sortingOptionsWidth / 2f, 16f);
            timelineTrackControl.UpdateTrackBodyBackground(rect);
            timelineTrackControl.UpdateHeaderBackground(headerBackground, current2);
            GUILayout.BeginArea(rect);
            timelineTrackControl.UpdateTrackContents(state, rect, controlArea);
            GUILayout.EndArea();
            timelineTrackControl.UpdateHeaderContents(state, rect2, headerBackground);
            GUI.enabled = (current2 > 0);
            if (GUI.Button(rect3, string.Empty, DirectorControl.DirectorControlStyles.UpArrowIcon))
            {
                TimelineTrackWrapper expr_1CE = timelineTrackWrapper;
                int ordinal = expr_1CE.Ordinal;
                expr_1CE.Ordinal = ordinal - 1;
                TimelineTrackWrapper expr_1F9 = timelineTrackMap[sortedDictionary[current2 - 1]].TargetTrack;
                ordinal          = expr_1F9.Ordinal;
                expr_1F9.Ordinal = ordinal + 1;
            }
            GUI.enabled = (current2 < sortedDictionary.Count - 1);
            if (GUI.Button(arg_225_0, string.Empty, DirectorControl.DirectorControlStyles.DownArrowIcon))
            {
                TimelineTrackWrapper expr_22E = timelineTrackWrapper;
                int ordinal = expr_22E.Ordinal;
                expr_22E.Ordinal = ordinal + 1;
                TimelineTrackWrapper expr_259 = timelineTrackMap[sortedDictionary[current2 + 1]].TargetTrack;
                ordinal          = expr_259.Ordinal;
                expr_259.Ordinal = ordinal - 1;
            }
            GUI.enabled = (true);
            num        += height;
        }
    }
예제 #3
0
    protected virtual void UpdateTracks(DirectorControlState state, Rect header, Rect content)
    {
        SortedDictionary <int, TimelineTrackWrapper> dictionary = new SortedDictionary <int, TimelineTrackWrapper>();

        foreach (TimelineTrackWrapper wrapper in this.timelineTrackMap.Keys)
        {
            this.timelineTrackMap[wrapper].TargetTrack = wrapper;
            dictionary.Add(wrapper.Ordinal, wrapper);
        }
        float num = header.y + 17f;

        foreach (int num2 in dictionary.Keys)
        {
            TimelineTrackWrapper wrapper2 = dictionary[num2];
            TimelineTrackControl control  = this.timelineTrackMap[wrapper2];
            control.Ordinal = new int[] { this.trackGroup.Ordinal, num2 };
            float num3         = control.Rect.height;
            Rect  position     = new Rect(content.x, num, content.width, num3);
            Rect  rect2        = new Rect(header.x, num, header.width, num3);
            Rect  rect3        = new Rect(header.x, num, (header.width - this.sortingOptionsWidth) - 4f, num3);
            float introduced17 = rect3.x;
            Rect  rect4        = new Rect(introduced17 + rect3.width, num, this.sortingOptionsWidth / 2f, 16f);
            control.UpdateTrackBodyBackground(position);
            control.UpdateHeaderBackground(rect2, num2);
            GUILayout.BeginArea(position);
            Rect rect5 = position;
            control.UpdateTrackContents(state, rect5);
            GUILayout.EndArea();
            control.UpdateHeaderContents(state, rect3, rect2);
            GUI.enabled = (num2 > 0);
            if (GUI.Button(rect4, string.Empty, DirectorControl.DirectorControlStyles.UpArrowIcon))
            {
                wrapper2.Ordinal--;
                TimelineTrackWrapper targetTrack = this.timelineTrackMap[dictionary[num2 - 1]].TargetTrack;
                targetTrack.Ordinal++;
            }
            GUI.enabled = (num2 < (dictionary.Count - 1));
            if (GUI.Button(new Rect(rect4.x + (this.sortingOptionsWidth / 2f), num, this.sortingOptionsWidth / 2f, 16f), string.Empty, DirectorControl.DirectorControlStyles.DownArrowIcon))
            {
                wrapper2.Ordinal++;
                TimelineTrackWrapper wrapper3 = this.timelineTrackMap[dictionary[num2 + 1]].TargetTrack;
                wrapper3.Ordinal--;
            }
            GUI.enabled = (true);
            num        += num3;
        }
    }
예제 #4
0
    protected virtual void updateHeaderControl5(Rect position)
    {
        Color color = GUI.color;
        int   num   = 0;

        using (IEnumerator <TimelineTrackWrapper> enumerator = this.trackGroup.Tracks.GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                TimelineTrackWrapper current = enumerator.Current;
                num++;
            }
        }
        GUI.color = ((num > 0) ? new Color(0f, 53f, 0f) : new Color(53f, 0f, 0f));
        if (GUI.Button(position, string.Empty, styles.AddIcon))
        {
            this.addTrackContext();
        }
        GUI.color = (color);
    }
예제 #5
0
    public void OnDestroy(TrackGroupWrapper trackGroup, DirectorControlState state)
    {
        SortedDictionary <int, TimelineTrackWrapper> sortedDictionary = new SortedDictionary <int, TimelineTrackWrapper>();

        foreach (TimelineTrackWrapper current in timelineTrackMap.Keys)
        {
            timelineTrackMap[current].TargetTrack = current;
            sortedDictionary.Add(current.Ordinal, current);
        }
        foreach (int current2 in sortedDictionary.Keys)
        {
            TimelineTrackWrapper timelineTrackWrapper = sortedDictionary[current2];
            TimelineTrackControl timelineTrackControl = timelineTrackMap[timelineTrackWrapper];
            timelineTrackControl.Ordinal = new[]
            {
                trackGroup.Ordinal,
                current2
            };
        }
    }
예제 #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);
    }
 public override void Initialize(TimelineItemWrapper wrapper, TimelineTrackWrapper track)
 {
     base.Initialize(wrapper, track);
     actionIcon = Resources.Load <Texture>("Director_AudioIcon");
 }
예제 #8
0
 public virtual void Initialize(TimelineItemWrapper wrapper, TimelineTrackWrapper track)
 {
     this.wrapper = wrapper;
     this.track   = track;
 }
예제 #9
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);
    }
예제 #10
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);
    }
예제 #11
0
 internal void BindTimelineItemControls(TimelineTrackWrapper track, List <TrackItemControl> newTimelineControls, List <TrackItemControl> removedTimelineControls)
 {
     if (this.TargetTrack.HasChanged)
     {
         foreach (TimelineItemWrapper current in track.Items)
         {
             TrackItemControl trackItemControl = null;
             if (!this.itemMap.TryGetValue(current, out trackItemControl))
             {
                 Type[] arg_62_0     = DirectorControlHelper.GetAllSubTypes(typeof(TrackItemControl));
                 Type   type         = typeof(TrackItemControl);
                 int    num          = 2147483647;
                 int    drawPriority = 0;
                 Type[] array        = arg_62_0;
                 for (int i = 0; i < array.Length; i++)
                 {
                     Type     type2            = array[i];
                     object[] customAttributes = type2.GetCustomAttributes(typeof(CutsceneItemControlAttribute), true);
                     for (int j = 0; j < customAttributes.Length; j++)
                     {
                         CutsceneItemControlAttribute cutsceneItemControlAttribute = (CutsceneItemControlAttribute)customAttributes[j];
                         if (cutsceneItemControlAttribute != null)
                         {
                             int subTypeDepth = DirectorControlHelper.GetSubTypeDepth(current.Behaviour.GetType(), cutsceneItemControlAttribute.ItemType);
                             if (subTypeDepth < num)
                             {
                                 type         = type2;
                                 num          = subTypeDepth;
                                 drawPriority = cutsceneItemControlAttribute.DrawPriority;
                             }
                         }
                     }
                 }
                 trackItemControl = (TrackItemControl)Activator.CreateInstance(type);
                 trackItemControl.DrawPriority = drawPriority;
                 trackItemControl.Initialize(current, this.TargetTrack);
                 trackItemControl.TrackControl = this;
                 this.initializeTrackItemControl(trackItemControl);
                 newTimelineControls.Add(trackItemControl);
                 this.itemMap.Add(current, trackItemControl);
             }
         }
         List <TimelineItemWrapper> list = new List <TimelineItemWrapper>();
         foreach (TimelineItemWrapper current2 in this.itemMap.Keys)
         {
             bool flag = false;
             foreach (TimelineItemWrapper current3 in track.Items)
             {
                 if (current2.Equals(current3))
                 {
                     flag = true;
                     break;
                 }
             }
             if (!flag)
             {
                 this.prepareTrackItemControlForRemoval(this.itemMap[current2]);
                 removedTimelineControls.Add(this.itemMap[current2]);
                 list.Add(current2);
             }
         }
         foreach (TimelineItemWrapper current4 in list)
         {
             this.itemMap.Remove(current4);
         }
     }
     track.HasChanged = false;
 }
 public override void Initialize(TimelineItemWrapper wrapper, TimelineTrackWrapper track)
 {
     base.Initialize(wrapper, track);
     actionIcon = EditorGUIUtility.Load("Cinema Suite/Cinema Director/Director_AudioIcon.png") as Texture;
 }
예제 #13
0
 public bool ContainsTrack(Behaviour behaviour, out TimelineTrackWrapper trackWrapper)
 {
     return(this.trackMap.TryGetValue(behaviour, out trackWrapper));
 }
예제 #14
0
 public void AddTrack(Behaviour behaviour, TimelineTrackWrapper wrapper)
 {
     this.trackMap.Add(behaviour, 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;
    }
    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;
    }
예제 #17
0
 internal void BindTimelineItemControls(TimelineTrackWrapper track, List <TrackItemControl> newTimelineControls, List <TrackItemControl> removedTimelineControls)
 {
     if (this.TargetTrack.HasChanged)
     {
         foreach (TimelineItemWrapper wrapper in track.Items)
         {
             TrackItemControl control = null;
             if (!this.itemMap.TryGetValue(wrapper, out control))
             {
                 Type type         = typeof(TrackItemControl);
                 int  num          = 0x7fffffff;
                 int  drawPriority = 0;
                 foreach (Type type2 in DirectorControlHelper.GetAllSubTypes(typeof(TrackItemControl)))
                 {
                     foreach (CutsceneItemControlAttribute attribute in type2.GetCustomAttributes(typeof(CutsceneItemControlAttribute), true))
                     {
                         if (attribute != null)
                         {
                             int subTypeDepth = DirectorControlHelper.GetSubTypeDepth(wrapper.Behaviour.GetType(), attribute.ItemType);
                             if (subTypeDepth < num)
                             {
                                 type         = type2;
                                 num          = subTypeDepth;
                                 drawPriority = attribute.DrawPriority;
                             }
                         }
                     }
                 }
                 control = (TrackItemControl)Activator.CreateInstance(type);
                 control.DrawPriority = drawPriority;
                 control.Initialize(wrapper, this.TargetTrack);
                 control.TrackControl = this;
                 this.initializeTrackItemControl(control);
                 newTimelineControls.Add(control);
                 this.itemMap.Add(wrapper, control);
             }
         }
         List <TimelineItemWrapper> list = new List <TimelineItemWrapper>();
         foreach (TimelineItemWrapper wrapper2 in this.itemMap.Keys)
         {
             bool flag = false;
             foreach (TimelineItemWrapper wrapper3 in track.Items)
             {
                 if (wrapper2.Equals(wrapper3))
                 {
                     flag = true;
                     break;
                 }
             }
             if (!flag)
             {
                 this.prepareTrackItemControlForRemoval(this.itemMap[wrapper2]);
                 removedTimelineControls.Add(this.itemMap[wrapper2]);
                 list.Add(wrapper2);
             }
         }
         foreach (TimelineItemWrapper wrapper4 in list)
         {
             this.itemMap.Remove(wrapper4);
         }
     }
     track.HasChanged = false;
 }