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 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(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); }