private void updateTrackGroups(Rect area, Rect controlArea) { float num = area.y; SortedDictionary <int, TrackGroupWrapper> sortedDictionary = new SortedDictionary <int, TrackGroupWrapper>(); foreach (TrackGroupWrapper current in trackGroupBinding.Keys) { trackGroupBinding[current].TrackGroup = current; sortedDictionary.Add(current.Ordinal, current); } foreach (int current2 in sortedDictionary.Keys) { TrackGroupWrapper trackGroupWrapper = sortedDictionary[current2]; TrackGroupControl trackGroupControl = trackGroupBinding[trackGroupWrapper]; trackGroupControl.Ordinal = new [] { current2 }; float height = trackGroupControl.GetHeight(); Rect position = new Rect(area.x, num, area.width, height); Rect fullHeader = new Rect(area.x, num, track_header_area_width + sidebarControlArea.width, height); Rect safeHeader = new Rect(area.x, num, track_header_area_width - 32f, height); Rect rect = new Rect(safeHeader.x + safeHeader.width, num, 16f, 16f); Rect arg_1FB_0 = new Rect(rect.x + 16f, num, 16f, 16f); Rect content = new Rect(fullHeader.x + fullHeader.width, num, area.width - fullHeader.width, height); trackGroupControl.Update(trackGroupWrapper, directorState, position, fullHeader, safeHeader, content, controlArea); GUI.enabled = (current2 > 0); if (GUI.Button(rect, string.Empty, DirectorControlStyles.UpArrowIcon)) { TrackGroupWrapper expr_1A4 = trackGroupWrapper; int ordinal = expr_1A4.Ordinal; expr_1A4.Ordinal = ordinal - 1; TrackGroupWrapper expr_1CF = trackGroupBinding[sortedDictionary[current2 - 1]].TrackGroup; ordinal = expr_1CF.Ordinal; expr_1CF.Ordinal = ordinal + 1; } GUI.enabled = (current2 < sortedDictionary.Count - 1); if (GUI.Button(arg_1FB_0, string.Empty, DirectorControlStyles.DownArrowIcon)) { TrackGroupWrapper expr_204 = trackGroupWrapper; int ordinal = expr_204.Ordinal; expr_204.Ordinal = ordinal + 1; TrackGroupWrapper expr_22F = trackGroupBinding[sortedDictionary[current2 + 1]].TrackGroup; ordinal = expr_22F.Ordinal; expr_22F.Ordinal = ordinal - 1; } GUI.enabled = true; num += height; } var rollRect = new Rect(area.x, area.y, track_header_area_width, area.height); switch (Event.current.type) { case EventType.ScrollWheel: break; } }
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 virtual void Update(TrackGroupWrapper trackGroup, DirectorControlState state, Rect position, Rect fullHeader, Rect safeHeader, Rect content) { this.position = position; this.trackGroup = trackGroup; this.state = state; if (trackGroup.Behaviour != null) { this.updateHeaderBackground(fullHeader); this.updateContentBackground(content); if (base.isExpanded) { Rect header = new Rect(safeHeader.x, safeHeader.y, fullHeader.width, safeHeader.height); this.UpdateTracks(state, header, content); } this.updateHeaderContent(safeHeader); } }
private void updateTrackGroups(Rect area) { float num = area.y; SortedDictionary <int, TrackGroupWrapper> dictionary = new SortedDictionary <int, TrackGroupWrapper>(); foreach (TrackGroupWrapper wrapper in this.trackGroupBinding.Keys) { this.trackGroupBinding[wrapper].TrackGroup = wrapper; dictionary.Add(wrapper.Ordinal, wrapper); } foreach (int num2 in dictionary.Keys) { TrackGroupWrapper trackGroup = dictionary[num2]; TrackGroupControl control = this.trackGroupBinding[trackGroup]; control.Ordinal = new int[] { num2 }; float height = control.GetHeight(); Rect position = new Rect(area.x, num, area.width, height); Rect fullHeader = new Rect(area.x, num, this.track_header_area_width + this.sidebarControlArea.width, height); Rect safeHeader = new Rect(area.x, num, this.track_header_area_width - 32f, height); float introduced16 = safeHeader.x; Rect rect4 = new Rect(introduced16 + safeHeader.width, num, 16f, 16f); float introduced17 = fullHeader.x; Rect content = new Rect(introduced17 + fullHeader.width, num, area.width - fullHeader.width, height); control.Update(trackGroup, this.directorState, position, fullHeader, safeHeader, content); GUI.enabled = (num2 > 0); if (GUI.Button(rect4, string.Empty, DirectorControlStyles.UpArrowIcon)) { trackGroup.Ordinal--; TrackGroupWrapper wrapper1 = this.trackGroupBinding[dictionary[num2 - 1]].TrackGroup; wrapper1.Ordinal++; } GUI.enabled = (num2 < (dictionary.Count - 1)); if (GUI.Button(new Rect(rect4.x + 16f, num, 16f, 16f), string.Empty, DirectorControlStyles.DownArrowIcon)) { trackGroup.Ordinal++; TrackGroupWrapper wrapper3 = this.trackGroupBinding[dictionary[num2 + 1]].TrackGroup; wrapper3.Ordinal--; } GUI.enabled = (true); num += height; } }
public void OnDestroy() { SortedDictionary <int, TrackGroupWrapper> sortedDictionary = new SortedDictionary <int, TrackGroupWrapper>(); foreach (TrackGroupWrapper current in trackGroupBinding.Keys) { trackGroupBinding[current].TrackGroup = current; sortedDictionary.Add(current.Ordinal, current); } foreach (int current2 in sortedDictionary.Keys) { TrackGroupWrapper trackGroupWrapper = sortedDictionary[current2]; TrackGroupControl trackGroupControl = trackGroupBinding[trackGroupWrapper]; trackGroupControl.Ordinal = new[] { current2 }; trackGroupControl.OnDestroy(trackGroupWrapper, directorState); } }
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 }; } }
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; }
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 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); }
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); }
internal void BindTrackControls(TrackGroupWrapper trackGroup, List <SidebarControl> newSidebarControls, List <SidebarControl> removedSidebarControls, List <TrackItemControl> newTimelineControls, List <TrackItemControl> removedTimelineControls) { if (trackGroup.HasChanged) { bool flag = false; foreach (TimelineTrackWrapper wrapper in trackGroup.Tracks) { TimelineTrackControl control = null; if (!this.timelineTrackMap.TryGetValue(wrapper, out control)) { flag = true; Type type = typeof(TimelineTrackControl); int num = 0x7fffffff; foreach (Type type2 in DirectorControlHelper.GetAllSubTypes(typeof(TimelineTrackControl))) { Type c = null; foreach (CutsceneTrackAttribute attribute in type2.GetCustomAttributes(typeof(CutsceneTrackAttribute), true)) { if (attribute != null) { c = attribute.TrackType; } } if (c == wrapper.Behaviour.GetType()) { type = type2; num = 0; break; } if ((c != null) && wrapper.Behaviour.GetType().IsSubclassOf(c)) { Type baseType = wrapper.Behaviour.GetType(); int num4 = 0; while ((baseType != null) && (baseType != c)) { baseType = baseType.BaseType; num4++; } if (num4 <= num) { num = num4; type = type2; } } } control = (TimelineTrackControl)Activator.CreateInstance(type); control.Initialize(); control.TrackGroupControl = this; control.TargetTrack = wrapper; control.SetExpandedFromEditorPrefs(); newSidebarControls.Add(control); this.timelineTrackMap.Add(wrapper, control); } } List <TimelineTrackWrapper> list = new List <TimelineTrackWrapper>(); foreach (TimelineTrackWrapper wrapper2 in this.timelineTrackMap.Keys) { bool flag2 = false; foreach (TimelineTrackWrapper wrapper3 in trackGroup.Tracks) { if (wrapper2.Equals(wrapper3)) { flag2 = true; break; } } if (!flag2) { removedSidebarControls.Add(this.timelineTrackMap[wrapper2]); list.Add(wrapper2); } } foreach (TimelineTrackWrapper wrapper4 in list) { flag = true; this.timelineTrackMap.Remove(wrapper4); } if (flag) { SortedDictionary <int, TimelineTrackWrapper> dictionary = new SortedDictionary <int, TimelineTrackWrapper>(); List <TimelineTrackWrapper> list2 = new List <TimelineTrackWrapper>(); foreach (TimelineTrackWrapper wrapper5 in this.timelineTrackMap.Keys) { if ((wrapper5.Ordinal >= 0) && !dictionary.ContainsKey(wrapper5.Ordinal)) { dictionary.Add(wrapper5.Ordinal, wrapper5); } else { list2.Add(wrapper5); } } int num5 = 0; using (SortedDictionary <int, TimelineTrackWrapper> .ValueCollection.Enumerator enumerator4 = dictionary.Values.GetEnumerator()) { while (enumerator4.MoveNext()) { enumerator4.Current.Ordinal = num5; num5++; } } using (List <TimelineTrackWrapper> .Enumerator enumerator3 = list2.GetEnumerator()) { while (enumerator3.MoveNext()) { enumerator3.Current.Ordinal = num5; num5++; } } } } foreach (TimelineTrackWrapper wrapper6 in this.timelineTrackMap.Keys) { this.timelineTrackMap[wrapper6].BindTimelineItemControls(wrapper6, newTimelineControls, removedTimelineControls); } trackGroup.HasChanged = false; }
public bool ContainsTrackGroup(Behaviour behaviour, out TrackGroupWrapper trackGroupWrapper) { return(this.TrackGroupMap.TryGetValue(behaviour, out trackGroupWrapper)); }
public void AddTrackGroup(Behaviour behaviour, TrackGroupWrapper wrapper) { this.TrackGroupMap.Add(behaviour, wrapper); }
internal void BindTrackControls(TrackGroupWrapper trackGroup, List <SidebarControl> newSidebarControls, List <SidebarControl> removedSidebarControls, List <TrackItemControl> newTimelineControls, List <TrackItemControl> removedTimelineControls) { if (trackGroup.HasChanged) { bool flag = false; foreach (TimelineTrackWrapper current in trackGroup.Tracks) { TimelineTrackControl timelineTrackControl = null; if (!timelineTrackMap.TryGetValue(current, out timelineTrackControl)) { flag = true; Type[] arg_5F_0 = DirectorControlHelper.GetAllSubTypes(typeof(TimelineTrackControl)); Type type = typeof(TimelineTrackControl); int num = 2147483647; Type[] array = arg_5F_0; for (int i = 0; i < array.Length; i++) { Type type2 = array[i]; Type type3 = null; object[] customAttributes = type2.GetCustomAttributes(typeof(CutsceneTrackAttribute), true); for (int j = 0; j < customAttributes.Length; j++) { CutsceneTrackAttribute cutsceneTrackAttribute = (CutsceneTrackAttribute)customAttributes[j]; if (cutsceneTrackAttribute != null) { type3 = cutsceneTrackAttribute.TrackType; } } if (type3 == current.Behaviour.GetType()) { type = type2; break; } if (type3 != null && current.Behaviour.GetType().IsSubclassOf(type3)) { Type type4 = current.Behaviour.GetType(); int num2 = 0; while (type4 != null && type4 != type3) { type4 = type4.BaseType; num2++; } if (num2 <= num) { num = num2; type = type2; } } } timelineTrackControl = (TimelineTrackControl)Activator.CreateInstance(type); timelineTrackControl.Initialize(); timelineTrackControl.TrackGroupControl = this; timelineTrackControl.TargetTrack = current; timelineTrackControl.SetExpandedFromEditorPrefs(); newSidebarControls.Add(timelineTrackControl); timelineTrackMap.Add(current, timelineTrackControl); } } List <TimelineTrackWrapper> list = new List <TimelineTrackWrapper>(); foreach (TimelineTrackWrapper current2 in this.timelineTrackMap.Keys) { bool flag2 = false; foreach (TimelineTrackWrapper current3 in trackGroup.Tracks) { if (current2.Equals(current3)) { flag2 = true; break; } } if (!flag2) { removedSidebarControls.Add(timelineTrackMap[current2]); list.Add(current2); } } foreach (TimelineTrackWrapper current4 in list) { flag = true; this.timelineTrackMap.Remove(current4); } if (flag) { SortedDictionary <int, TimelineTrackWrapper> sortedDictionary = new SortedDictionary <int, TimelineTrackWrapper>(); List <TimelineTrackWrapper> list2 = new List <TimelineTrackWrapper>(); foreach (TimelineTrackWrapper current5 in timelineTrackMap.Keys) { if (current5.Ordinal >= 0 && !sortedDictionary.ContainsKey(current5.Ordinal)) { sortedDictionary.Add(current5.Ordinal, current5); } else { list2.Add(current5); } } int num3 = 0; using (SortedDictionary <int, TimelineTrackWrapper> .ValueCollection.Enumerator enumerator4 = sortedDictionary.Values.GetEnumerator()) { while (enumerator4.MoveNext()) { enumerator4.Current.Ordinal = num3; num3++; } } using (List <TimelineTrackWrapper> .Enumerator enumerator3 = list2.GetEnumerator()) { while (enumerator3.MoveNext()) { enumerator3.Current.Ordinal = num3; num3++; } } } } foreach (TimelineTrackWrapper current6 in timelineTrackMap.Keys) { timelineTrackMap[current6].BindTimelineItemControls(current6, newTimelineControls, removedTimelineControls); } trackGroup.HasChanged = false; }