void Awake() { this._resizableRects = new HorizontalResizableRects(() => new Rect(0, 0, this.position.width, this.position.height), new[] { 300f }); this._timelineRect = new TimelineRect(() => _resizableRects.rects[1]); this._timelineRect.onDrawTracksLeftSideCallback = () => TimelinableEditorWindowUtil.OnDrawTracksLeftSideCallback(_sequence, _timelineRect); this._timelineRect.onDrawTracksRightSideCallback = () => TimelinableEditorWindowUtil.OnDrawTracksRightSideCallback(_sequence, _timelineRect); this._timelineRect.isMouseDownOfSelectedItem = (mousePosition) => TimelinableEditorWindowUtil.IsMouseDownOfSelectedItem(mousePosition, _sequence); this._timelineRect.tryToSelectUnselectedItemCallback = (mousePosition) => TimelinableEditorWindowUtil.TryToSelectUnselectedItemCallback(mousePosition, _sequence); this._timelineRect.updateSelectedItemsCallback = (selectingRect) => TimelinableEditorWindowUtil.UpdateSelectedItemsCallback(selectingRect, _sequence); this._timelineRect.onDraggingSelectedCallback = (deltaDuration) => TimelinableEditorWindowUtil.OnDraggingSelectedCallback(deltaDuration, _sequence, _timelineRect.playTime); this._timelineRect.isHasSelectedItem = () => TimelinableEditorWindowUtil.IsHasSelectedItem(_sequence); this._timelineRect.onMouseRightButtonClickCallback = (positionRect) => TimelinableEditorWindowUtil.OnMouseRightButtonClickCallback(positionRect, _sequence.tracks); this._timelineRect.onDoEditorCommandCallback = (editorCommand) => TimelinableEditorWindowUtil.OnDoEditorCommandCallback(editorCommand, _sequence.tracks); this._timelineRect.onPlayTimeChangeCallback = (playTime) => TimelinableEditorWindowUtil.OnPlayTimeChangeCallback(_sequence, playTime); }
void Awake() { this._timelineRect = new TimelineRect(() => new Rect(0, 0, this.position.width, this.position.height)); }
public static void OnDrawTracksLeftSideCallback(TimelinableSequenceBase sequence, TimelineRect timelineRect) { if (sequence == null || sequence.tracks.IsNullOrEmpty()) { return; } for (int i = 0; i < sequence.tracks.Length; i++) { TimelinableTrackBase track = sequence.tracks[i]; var trackColor = i % 2 == 0 ? Color.gray.SetA(0.2f) : Color.gray.SetA(0.4f); var leftTrackRect = timelineRect.GetLeftTrackRect(i); using (new GUILayout.AreaScope(leftTrackRect)) { EditorGUI.DrawRect(new Rect(0, 0, leftTrackRect.width, leftTrackRect.height), trackColor); EditorGUILayout.LabelField(track.name, GUIStyleConst.LabelBoldMiddleCenterStyle); } } }
public static void OnDrawTracksRightSideCallback(TimelinableSequenceBase sequence, TimelineRect timelineRect) { if (sequence == null || sequence.tracks.IsNullOrEmpty()) { return; } for (int i = 0; i < sequence.tracks.Length; i++) { TimelinableTrackBase track = sequence.tracks[i]; var trackColor = i % 2 == 0 ? Color.gray.SetA(0.2f) : Color.gray.SetA(0.4f); var rightTrackRect = timelineRect.GetRightTrackRect(i); using (new GUILayout.AreaScope(rightTrackRect)) { EditorGUI.DrawRect(new Rect(0, 0, rightTrackRect.width, rightTrackRect.height), trackColor); //Draw ItemInfo for (int j = 0; j < track.itemInfoes.Length; j++) { var itemInfo = track.itemInfoes[j]; var itemInfoRect = timelineRect.GetRightTrackRect(itemInfo.time, itemInfo.duration, i); itemInfo.rect = itemInfoRect; itemInfoRect.y = 0; var style = new GUIStyle(GUIStyleConst.LabelBoldMiddleLeftStyle.SetName(GUI.skin.box)); if (itemInfo.isSelected || itemInfo.IsTimeInside(track.curTime)) { GUIUtil.Box(itemInfoRect, string.Format("{0}[{1}]<color=red>{2}</color>", itemInfo.name, j, itemInfo.isSelected ? "*" : ""), style, Color.blue.SetA(0.5f)); } else { GUIUtil.Box(itemInfoRect, string.Format("{0}[{1}]", itemInfo.name, j), style, Color.gray.SetA(0.5f)); } } } } }