public static void Copy(Behaviour obj) { clipboard = obj; GameObject gameObject = clipboard.gameObject; deepCopy = Object.Instantiate(gameObject); deepCopy.name = DirectorControlHelper.GetNameForDuplicate(obj, gameObject.name); deepCopy.hideFlags = (HideFlags)(13); }
public static void Copy(Behaviour obj) { clipboard = obj; GameObject obj2 = clipboard.gameObject; deepCopy = GameObject.Instantiate <GameObject>(obj2); deepCopy.name = (DirectorControlHelper.GetNameForDuplicate(obj, obj2.name)); deepCopy.hideFlags = (HideFlags)(0x3d); }
private void bindTrackGroupControls(CutsceneWrapper cutscene, List <SidebarControl> newSidebarControls, List <SidebarControl> removedSidebarControls, List <TrackItemControl> newTimelineControls, List <TrackItemControl> removedTimelineControls) { if (cutscene.HasChanged) { foreach (TrackGroupWrapper wrapper in cutscene.TrackGroups) { TrackGroupControl control = null; if (!this.trackGroupBinding.TryGetValue(wrapper, out control)) { Type type = typeof(TrackGroupControl); int num2 = 0x7fffffff; foreach (Type type2 in DirectorControlHelper.GetAllSubTypes(typeof(TrackGroupControl))) { Type c = null; foreach (CutsceneTrackGroupAttribute attribute in type2.GetCustomAttributes(typeof(CutsceneTrackGroupAttribute), true)) { if (attribute != null) { c = attribute.TrackGroupType; } } if (c == wrapper.Behaviour.GetType()) { type = type2; num2 = 0; break; } if (wrapper.Behaviour.GetType().IsSubclassOf(c)) { Type baseType = wrapper.Behaviour.GetType(); int num5 = 0; while ((baseType != null) && (baseType != c)) { baseType = baseType.BaseType; num5++; } if (num5 <= num2) { num2 = num5; type = type2; } } } control = (TrackGroupControl)Activator.CreateInstance(type); control.TrackGroup = wrapper; control.DirectorControl = this; control.Initialize(); control.SetExpandedFromEditorPrefs(); newSidebarControls.Add(control); this.trackGroupBinding.Add(wrapper, control); } } List <TrackGroupWrapper> list = new List <TrackGroupWrapper>(); foreach (TrackGroupWrapper wrapper2 in this.trackGroupBinding.Keys) { bool flag = false; foreach (TrackGroupWrapper wrapper3 in cutscene.TrackGroups) { if (wrapper2.Equals(wrapper3)) { flag = true; break; } } if (!flag) { removedSidebarControls.Add(this.trackGroupBinding[wrapper2]); list.Add(wrapper2); } } foreach (TrackGroupWrapper wrapper4 in list) { this.trackGroupBinding.Remove(wrapper4); } SortedDictionary <int, TrackGroupWrapper> dictionary = new SortedDictionary <int, TrackGroupWrapper>(); List <TrackGroupWrapper> list2 = new List <TrackGroupWrapper>(); foreach (TrackGroupWrapper wrapper5 in this.trackGroupBinding.Keys) { if ((wrapper5.Ordinal >= 0) && !dictionary.ContainsKey(wrapper5.Ordinal)) { dictionary.Add(wrapper5.Ordinal, wrapper5); } else { list2.Add(wrapper5); } } int num = 0; using (SortedDictionary <int, TrackGroupWrapper> .ValueCollection.Enumerator enumerator4 = dictionary.Values.GetEnumerator()) { while (enumerator4.MoveNext()) { enumerator4.Current.Ordinal = num; num++; } } using (List <TrackGroupWrapper> .Enumerator enumerator3 = list2.GetEnumerator()) { while (enumerator3.MoveNext()) { enumerator3.Current.Ordinal = num; num++; } } cutscene.HasChanged = false; } foreach (TrackGroupWrapper wrapper6 in this.trackGroupBinding.Keys) { this.trackGroupBinding[wrapper6].BindTrackControls(wrapper6, newSidebarControls, removedSidebarControls, newTimelineControls, removedTimelineControls); } }
private void bindTrackGroupControls(CutsceneWrapper cutscene, List <SidebarControl> newSidebarControls, List <SidebarControl> removedSidebarControls, List <TrackItemControl> newTimelineControls, List <TrackItemControl> removedTimelineControls) { if (cutscene.HasChanged) { foreach (TrackGroupWrapper current in cutscene.TrackGroups) { TrackGroupControl trackGroupControl = null; if (!trackGroupBinding.TryGetValue(current, out trackGroupControl)) { Type[] arg_5F_0 = DirectorControlHelper.GetAllSubTypes(typeof(TrackGroupControl)); Type type = typeof(TrackGroupControl); 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(CutsceneTrackGroupAttribute), true); for (int j = 0; j < customAttributes.Length; j++) { CutsceneTrackGroupAttribute cutsceneTrackGroupAttribute = (CutsceneTrackGroupAttribute)customAttributes[j]; if (cutsceneTrackGroupAttribute != null) { type3 = cutsceneTrackGroupAttribute.TrackGroupType; } } if (type3 == current.Behaviour.GetType()) { type = type2; break; } if (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; } } } trackGroupControl = (TrackGroupControl)Activator.CreateInstance(type); trackGroupControl.TrackGroup = current; trackGroupControl.DirectorControl = this; trackGroupControl.Initialize(); trackGroupControl.SetExpandedFromEditorPrefs(); newSidebarControls.Add(trackGroupControl); trackGroupBinding.Add(current, trackGroupControl); } } List <TrackGroupWrapper> list = new List <TrackGroupWrapper>(); foreach (TrackGroupWrapper current2 in this.trackGroupBinding.Keys) { bool flag = false; foreach (TrackGroupWrapper current3 in cutscene.TrackGroups) { if (current2.Equals(current3)) { flag = true; break; } } if (!flag) { removedSidebarControls.Add(trackGroupBinding[current2]); list.Add(current2); } } foreach (TrackGroupWrapper current4 in list) { trackGroupBinding.Remove(current4); } SortedDictionary <int, TrackGroupWrapper> sortedDictionary = new SortedDictionary <int, TrackGroupWrapper>(); List <TrackGroupWrapper> list2 = new List <TrackGroupWrapper>(); foreach (TrackGroupWrapper current5 in this.trackGroupBinding.Keys) { if (current5.Ordinal >= 0 && !sortedDictionary.ContainsKey(current5.Ordinal)) { sortedDictionary.Add(current5.Ordinal, current5); } else { list2.Add(current5); } } int num3 = 0; using (SortedDictionary <int, TrackGroupWrapper> .ValueCollection.Enumerator enumerator4 = sortedDictionary.Values.GetEnumerator()) { while (enumerator4.MoveNext()) { enumerator4.Current.Ordinal = num3; num3++; } } using (List <TrackGroupWrapper> .Enumerator enumerator3 = list2.GetEnumerator()) { while (enumerator3.MoveNext()) { enumerator3.Current.Ordinal = num3; num3++; } } cutscene.HasChanged = false; } foreach (var current6 in trackGroupBinding.Keys) { trackGroupBinding[current6].BindTrackControls(current6, newSidebarControls, removedSidebarControls, newTimelineControls, removedTimelineControls); } }
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; }