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