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; } }
private void sidebarControl_Duplicate(object sender, SidebarControlEventArgs e) { foreach (TrackGroupWrapper wrapper in this.trackGroupBinding.Keys) { TrackGroupControl control = this.trackGroupBinding[wrapper]; control.DuplicateSelectedChildren(); if (control.IsSelected) { control.Duplicate(); } } }
private void control_DeleteRequest(object sender, DirectorBehaviourControlEventArgs e) { foreach (TrackGroupWrapper wrapper in this.trackGroupBinding.Keys) { TrackGroupControl control = this.trackGroupBinding[wrapper]; control.DeleteSelectedChildren(); if (control.IsSelected) { control.Delete(); } } }
private void sidebarControl_Duplicate(object sender, SidebarControlEventArgs e) { foreach (var current in trackGroupBinding.Keys) { TrackGroupControl trackGroupControl = trackGroupBinding[current]; trackGroupControl.DuplicateSelectedChildren(); if (trackGroupControl.IsSelected) { trackGroupControl.Duplicate(); } } }
private float getTrackGroupsHeight(CutsceneWrapper cutscene) { float num = 0f; foreach (TrackGroupWrapper wrapper in cutscene.TrackGroups) { if (this.trackGroupBinding.ContainsKey(wrapper)) { TrackGroupControl control = this.trackGroupBinding[wrapper]; num += control.GetHeight(); } } return(num); }
private float getTrackGroupsHeight(CutsceneWrapper cutscene) { float num = 0f; foreach (TrackGroupWrapper current in cutscene.TrackGroups) { if (trackGroupBinding.ContainsKey(current)) { TrackGroupControl trackGroupControl = trackGroupBinding[current]; num += trackGroupControl.GetHeight(); } } return(num); }
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); } }
private void sidebarControl_SelectRequest(object sender, SidebarControlEventArgs e) { Behaviour behaviour = e.Behaviour; if (behaviour != null) { if (Event.current.control) { if (Selection.Contains(behaviour.gameObject)) { GameObject[] objArray = Selection.gameObjects; ArrayUtility.Remove <GameObject>(ref objArray, behaviour.gameObject); Selection.objects = (objArray); } else { GameObject[] objArray2 = Selection.gameObjects; ArrayUtility.Add <GameObject>(ref objArray2, behaviour.gameObject); Selection.objects = (objArray2); } } else if (Event.current.shift) { List <SidebarControl> list = new List <SidebarControl>(); foreach (TrackGroupWrapper wrapper in this.trackGroupBinding.Keys) { TrackGroupControl item = this.trackGroupBinding[wrapper]; list.Add(item); list.AddRange(item.GetSidebarControlChildren(true)); } SidebarControl sidebarControl = e.SidebarControl; SidebarControl control2 = e.SidebarControl; foreach (SidebarControl control4 in list) { if (control4.IsSelected) { if (sidebarControl.CompareTo(control4) > 0) { sidebarControl = control4; } if (control2.CompareTo(control4) < 0) { control2 = control4; } } } foreach (SidebarControl control5 in list) { if ((!control5.IsSelected && (sidebarControl.CompareTo(control5) <= 0)) && (control2.CompareTo(control5) >= 0)) { control5.Select(); } } } else { Selection.activeObject = (behaviour); } Event.current.Use(); } }
public void OnLoad(GUISkin skin) { this.customSkin = skin; string str = "Cinema Suite/Cinema Director/"; string str2 = ".png"; float min = 0f; float @float = 60f; if (EditorPrefs.HasKey("DirectorControl.areaX")) { min = EditorPrefs.GetFloat("DirectorControl.areaX"); } if (EditorPrefs.HasKey("DirectorControl.areaWidth")) { @float = EditorPrefs.GetFloat("DirectorControl.areaWidth"); } if (EditorPrefs.HasKey("DirectorControl.isSnappingEnabled")) { this.directorState.IsSnapEnabled = EditorPrefs.GetBool("DirectorControl.isSnappingEnabled"); } base.SetShownHRangeInsideMargins(min, min + @float); if (EditorPrefs.HasKey("DirectorControl.SidebarWidth")) { this.track_header_area_width = EditorPrefs.GetFloat("DirectorControl.SidebarWidth"); } if (this.playButton == null) { this.playButton = EditorGUIUtility.Load(str + "Director_PlayIcon" + str2) as Texture; } if (this.playButton == null) { Debug.Log("Play button icon missing from Resources folder."); } if (this.pauseButton == null) { this.pauseButton = EditorGUIUtility.Load(str + "Director_PauseIcon" + str2) as Texture; } if (this.pauseButton == null) { Debug.Log("Pause button missing from Resources folder."); } if (this.stopButton == null) { this.stopButton = EditorGUIUtility.Load(str + "Director_StopIcon" + str2) as Texture; } if (this.stopButton == null) { Debug.Log("Stop button icon missing from Resources folder."); } if (this.frameForwardButton == null) { this.frameForwardButton = EditorGUIUtility.Load(str + "Director_FrameForwardIcon" + str2) as Texture; } if (this.frameForwardButton == null) { Debug.Log("Director_FrameForwardIcon.png missing from Resources folder."); } if (this.frameBackwardButton == null) { this.frameBackwardButton = EditorGUIUtility.Load(str + "Director_FrameBackwardIcon" + str2) as Texture; } if (this.frameBackwardButton == null) { Debug.Log("Director_FrameBackwardIcon.png missing from Resources folder."); } if (this.scrubHead == null) { this.scrubHead = EditorGUIUtility.Load(str + "Director_Playhead" + str2) as Texture; } if (this.scrubHead == null) { Debug.Log("Director_Playhead missing from Resources folder."); } if (this.scrubDurationHead == null) { this.scrubDurationHead = EditorGUIUtility.Load(str + "Director_Duration_Playhead" + str2) as Texture; } if (this.scrubDurationHead == null) { Debug.Log("Director_Duration_Playhead missing from Resources folder."); } if (this.customSkin != null) { DirectorControlStyles.BoxSelect = this.customSkin.FindStyle("BoxSelect"); DirectorControlStyles.UpArrowIcon = this.customSkin.FindStyle("UpArrowIcon"); DirectorControlStyles.DownArrowIcon = this.customSkin.FindStyle("DownArrowIcon"); } else { DirectorControlStyles.BoxSelect = "box"; DirectorControlStyles.UpArrowIcon = "box"; DirectorControlStyles.DownArrowIcon = "box"; } TrackGroupControl.InitStyles(this.customSkin); TimelineTrackControl.InitStyles(this.customSkin); }
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 sidebarControl_SelectRequest(object sender, SidebarControlEventArgs e) { Behaviour behaviour = e.Behaviour; if (behaviour == null) { return; } if (Event.current.control) { if (Selection.Contains(behaviour.gameObject)) { GameObject[] gameObjects = Selection.gameObjects; ArrayUtility.Remove(ref gameObjects, behaviour.gameObject); Selection.objects = (gameObjects); } else { GameObject[] gameObjects2 = Selection.gameObjects; ArrayUtility.Add(ref gameObjects2, behaviour.gameObject); Selection.objects = (gameObjects2); } } else { if (Event.current.shift) { List <SidebarControl> list = new List <SidebarControl>(); foreach (TrackGroupWrapper current in trackGroupBinding.Keys) { TrackGroupControl trackGroupControl = this.trackGroupBinding[current]; list.Add(trackGroupControl); list.AddRange(trackGroupControl.GetSidebarControlChildren(true)); } SidebarControl sidebarControl = e.SidebarControl; SidebarControl sidebarControl2 = e.SidebarControl; foreach (SidebarControl current2 in list) { if (current2.IsSelected) { if (sidebarControl.CompareTo(current2) > 0) { sidebarControl = current2; } if (sidebarControl2.CompareTo(current2) < 0) { sidebarControl2 = current2; } } } using (List <SidebarControl> .Enumerator enumerator2 = list.GetEnumerator()) { while (enumerator2.MoveNext()) { SidebarControl current3 = enumerator2.Current; if (!current3.IsSelected && sidebarControl.CompareTo(current3) <= 0 && sidebarControl2.CompareTo(current3) >= 0) { current3.Select(); } } goto IL_195; } } Selection.activeObject = (behaviour); } IL_195: Event.current.Use(); }
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); } }
public void OnLoad(GUISkin skin) { customSkin = skin; float num = 0f; float num2 = 60f; if (EditorPrefs.HasKey("DirectorControl.areaX")) { num = EditorPrefs.GetFloat("DirectorControl.areaX"); } if (EditorPrefs.HasKey("DirectorControl.areaWidth")) { num2 = EditorPrefs.GetFloat("DirectorControl.areaWidth"); } if (EditorPrefs.HasKey("DirectorControl.isSnappingEnabled")) { directorState.IsSnapEnabled = EditorPrefs.GetBool("DirectorControl.isSnappingEnabled"); } float expr_64 = num; SetShownHRangeInsideMargins(expr_64, expr_64 + num2); if (EditorPrefs.HasKey("DirectorControl.SidebarWidth")) { track_header_area_width = EditorPrefs.GetFloat("DirectorControl.SidebarWidth"); } if (this.playButton == null) { this.playButton = (Resources.Load("Director_PlayIcon", typeof(Texture)) as Texture); } if (this.playButton == null) { Debug.Log("Play button icon missing from Resources folder."); } if (this.pauseButton == null) { this.pauseButton = (Resources.Load("Director_PauseIcon", typeof(Texture)) as Texture); } if (this.pauseButton == null) { Debug.Log("Pause button missing from Resources folder."); } if (this.stopButton == null) { this.stopButton = (Resources.Load("Director_StopIcon", typeof(Texture)) as Texture); } if (this.stopButton == null) { Debug.Log("Stop button icon missing from Resources folder."); } if (this.frameForwardButton == null) { this.frameForwardButton = (Resources.Load("Director_FrameForwardIcon", typeof(Texture)) as Texture); } if (this.frameForwardButton == null) { Debug.Log("Director_FrameForwardIcon.png missing from Resources folder."); } if (this.frameBackwardButton == null) { this.frameBackwardButton = (Resources.Load("Director_FrameBackwardIcon", typeof(Texture)) as Texture); } if (frameBackwardButton == null) { Debug.Log("Director_FrameBackwardIcon.png missing from Resources folder."); } if (scrubHead == null) { scrubHead = Resources.Load("Director_Playhead", typeof(Texture)) as Texture; } if (scrubHead == null) { Debug.Log("Director_Playhead missing from Resources folder."); } if (scrubDurationHead == null) { scrubDurationHead = (Resources.Load("Director_Duration_Playhead", typeof(Texture)) as Texture); } if (scrubDurationHead == null) { Debug.Log("Director_Duration_Playhead missing from Resources folder."); } DirectorControlStyles.BoxSelect = customSkin.FindStyle("BoxSelect"); DirectorControlStyles.UpArrowIcon = customSkin.FindStyle("UpArrowIcon"); DirectorControlStyles.DownArrowIcon = customSkin.FindStyle("DownArrowIcon"); TrackGroupControl.InitStyles(customSkin); TimelineTrackControl.InitStyles(customSkin); }