private void togglEditItemControl(CinemaCurveClipItemControl control) { IEnumerator <TrackItemControl> enumerator; if (!control.IsEditing) { using (enumerator = base.Controls.GetEnumerator()) { while (enumerator.MoveNext()) { ((CinemaCurveClipItemControl)enumerator.Current).IsEditing = false; } } control.IsEditing = true; this.focusedControl = control; this.MINIMUM_ROWS_SHOWING = 10; this.rowsShowing = 10; } else { using (enumerator = base.Controls.GetEnumerator()) { while (enumerator.MoveNext()) { ((CinemaCurveClipItemControl)enumerator.Current).IsEditing = false; } } this.focusedControl = null; this.editItemControl(-1); this.MINIMUM_ROWS_SHOWING = 3; this.rowsShowing = 5; } }
private void editItemControl(int controlSelection) { int num = 0; foreach (CinemaCurveClipItemControl control in base.Controls) { control.IsEditing = num++ == controlSelection; if (control.IsEditing) { this.focusedControl = control; this.MINIMUM_ROWS_SHOWING = 10; this.rowsShowing = 10; } } }
private void editItemControl(int controlSelection) { int num = 0; using (IEnumerator <TrackItemControl> enumerator = Controls.GetEnumerator()) { while (enumerator.MoveNext()) { CinemaCurveClipItemControl cinemaCurveClipItemControl = (CinemaCurveClipItemControl)enumerator.Current; cinemaCurveClipItemControl.IsEditing = (num++ == controlSelection); if (cinemaCurveClipItemControl.IsEditing) { focusedControl = cinemaCurveClipItemControl; MINIMUM_ROWS_SHOWING = 10; rowsShowing = 10; } } } }
public override void UpdateHeaderContents(DirectorControlState state, Rect position, Rect headerBackground) { Rect rect = new Rect(position.x + 14f, position.y, 14f, position.height); float introduced10 = rect.x; Rect rect2 = new Rect(introduced10 + rect.width, position.y, ((position.width - 14f) - 96f) - 14f, 17f); string str = base.TargetTrack.Behaviour.name; bool flag = EditorGUI.Foldout(rect, base.isExpanded, GUIContent.none, false); if (flag != base.isExpanded) { base.isExpanded = flag; EditorPrefs.SetBool(base.IsExpandedKey, base.isExpanded); } this.updateHeaderControl1(new Rect(position.width - 64f, position.y, 16f, 16f)); this.updateHeaderControl2(new Rect(position.width - 48f, position.y, 16f, 16f)); this.updateHeaderControl3(new Rect(position.width - 32f, position.y, 16f, 16f)); this.updateHeaderControl4(new Rect(position.width - 16f, position.y, 16f, 16f)); this.updateHeaderControl6(new UnityEngine.Rect(position.width - 96, position.y, 16f, 16f)); if (base.isExpanded) { Rect rect3 = new Rect(rect2.x + 28f, position.y + 17f, (headerBackground.width - rect2.x) - 28f, 17f); if (((this.focusedControl != null) && (this.focusedControl.Wrapper != null)) && (this.focusedControl.Wrapper.Behaviour != null)) { float introduced11 = rect3.x; float introduced12 = rect3.y; new Rect(introduced11, introduced12, rect3.width / 2f, rect3.height); float introduced13 = rect3.x; float introduced14 = rect3.y; float introduced15 = rect3.x; float introduced16 = rect3.y; Rect controlHeaderArea = new Rect(introduced15, introduced16 + rect3.height, rect3.width, position.height - 34f); this.focusedControl.UpdateHeaderArea(state, controlHeaderArea); if (GUI.Button(new Rect(introduced13 + (rect3.width / 2f), introduced14, rect3.width / 2f, rect3.height), new GUIContent("Done"))) { this.focusedControl = null; this.editItemControl(-1); this.MINIMUM_ROWS_SHOWING = 3; this.rowsShowing = 5; } } else { this.updateEditPanel(rect3); } } if (base.isRenaming) { GUI.SetNextControlName("CurveTrackRename"); str = EditorGUI.TextField(rect2, GUIContent.none, str); if (base.renameRequested) { EditorGUI.FocusTextInControl("CurveTrackRename"); base.renameRequested = false; } if ((Event.current.keyCode == (KeyCode)13) || ((Event.current.type == EventType.MouseUp) && !rect2.Contains(Event.current.mousePosition))) { base.isRenaming = false; GUIUtility.hotControl = (0); GUIUtility.keyboardControl = (0); } } if (base.TargetTrack.Behaviour.name != str) { Undo.RecordObject(base.TargetTrack.Behaviour.gameObject, string.Format("Renamed {0}", base.TargetTrack.Behaviour.name)); base.TargetTrack.Behaviour.name = (str); } if (!base.isRenaming) { string str2 = str; for (Vector2 vector = GUI.skin.label.CalcSize(new GUIContent(str2)); (vector.x > rect2.width) && (str2.Length > 5); vector = GUI.skin.label.CalcSize(new GUIContent(str2))) { str2 = str2.Substring(0, str2.Length - 4) + "..."; } if (Selection.Contains(base.TargetTrack.Behaviour.gameObject)) { GUI.Label(rect2, str2, EditorStyles.whiteLabel); } else { GUI.Label(rect2, str2); } int num = GUIUtility.GetControlID(base.TargetTrack.Behaviour.GetInstanceID(), (FocusType)2, position); if (Event.current.GetTypeForControl(num) == EventType.MouseDown) { if (position.Contains(Event.current.mousePosition) && (Event.current.button == 1)) { if (!base.IsSelected) { base.RequestSelect(); } base.showHeaderContextMenu(); Event.current.Use(); } else if (position.Contains(Event.current.mousePosition) && (Event.current.button == 0)) { base.RequestSelect(); Event.current.Use(); } } } }
public override void UpdateHeaderContents(DirectorControlState state, Rect position, Rect headerBackground) { Rect rect = new Rect(position.x + 14f, position.y, 14f, position.height); Rect rect2 = new Rect(rect.x + rect.width, position.y, position.width - 14f - 96f - 14f, 17f); string text = base.TargetTrack.Behaviour.name; bool flag = EditorGUI.Foldout(rect, isExpanded, GUIContent.none, false); if (flag != this.isExpanded) { this.isExpanded = flag; EditorPrefs.SetBool(base.IsExpandedKey, this.isExpanded); } updateHeaderControl1(new Rect(position.width - 64f, position.y, 16f, 16f)); this.updateHeaderControl2(new Rect(position.width - 48f, position.y, 16f, 16f)); this.updateHeaderControl3(new Rect(position.width - 32f, position.y, 16f, 16f)); this.updateHeaderControl4(new Rect(position.width - 16f, position.y, 16f, 16f)); if (isExpanded) { Rect row = new Rect(rect2.x + 28f, position.y + 17f, headerBackground.width - rect2.x - 28f, 17f); if (focusedControl != null && focusedControl.Wrapper != null && focusedControl.Wrapper.Behaviour != null) { new Rect(row.x, row.y, row.width / 2f, row.height); Rect arg_26D_0 = new Rect(row.x + row.width / 2f, row.y, row.width / 2f, row.height); Rect controlHeaderArea = new Rect(row.x, row.y + row.height, row.width, position.height - 34f); focusedControl.UpdateHeaderArea(state, controlHeaderArea); if (GUI.Button(arg_26D_0, new GUIContent("Done"))) { focusedControl = null; editItemControl(-1); MINIMUM_ROWS_SHOWING = 3; rowsShowing = 5; } } else { updateEditPanel(row); } } if (isRenaming) { GUI.SetNextControlName("CurveTrackRename"); text = EditorGUI.TextField(rect2, GUIContent.none, text); if (renameRequested) { EditorGUI.FocusTextInControl("CurveTrackRename"); renameRequested = false; } if ((int)Event.current.keyCode == 13 || (Event.current.type == EventType.MouseDown && !rect2.Contains(Event.current.mousePosition))) { isRenaming = false; GUIUtility.hotControl = (0); GUIUtility.keyboardControl = (0); } } if (base.TargetTrack.Behaviour.name != text) { Undo.RecordObject(base.TargetTrack.Behaviour.gameObject, string.Format("Renamed {0}", base.TargetTrack.Behaviour.name)); base.TargetTrack.Behaviour.name = (text); } if (!this.isRenaming) { string text2 = text; Vector2 vector = GUI.skin.label.CalcSize(new GUIContent(text2)); while (vector.x > rect2.width && text2.Length > 5) { text2 = text2.Substring(0, text2.Length - 4) + "..."; vector = GUI.skin.label.CalcSize(new GUIContent(text2)); } if (Selection.Contains(base.TargetTrack.Behaviour.gameObject)) { GUI.Label(rect2, text2, EditorStyles.whiteLabel); } else { GUI.Label(rect2, text2); } int controlID = GUIUtility.GetControlID(base.TargetTrack.Behaviour.GetInstanceID(), (FocusType)2, position); if (Event.current.GetTypeForControl(controlID) == EventType.MouseDown) { if (position.Contains(Event.current.mousePosition) && (int)Event.current.button == 1) { if (!base.IsSelected) { base.RequestSelect(); } base.showHeaderContextMenu(); Event.current.Use(); return; } if (position.Contains(Event.current.mousePosition) && (int)Event.current.button == 0) { base.RequestSelect(); Event.current.Use(); } } } }