void OnGUI() { if (_owner != null && _owner.SourceData != null) { if (_firstDrawAfterDataSet) { GUIUtility.keyboardControl = 0; _firstDrawAfterDataSet = false; } OnGUIBegin(); _owner.Color = EditorGUILayout.ColorField(new GUIContent("Color: "), _owner.Color); if (_startTimeField == null) { _startTimeField = new TimeTextField(); } if (_endTimeField == null) { _endTimeField = new TimeTextField(); } Rect lastRect = GUILayoutUtility.GetLastRect(); Rect startFieldRect = GUILayoutUtility.GetRect(lastRect.width, EditorGUIUtility.singleLineHeight); TimeSpan newStart = _startTimeField.Draw(startFieldRect, _owner.SourceData.Start, new GUIContent("Start time:"), ArrowsLayout.Horizontal); lastRect = GUILayoutUtility.GetLastRect(); Rect endFieldRect = GUILayoutUtility.GetRect(lastRect.width, EditorGUIUtility.singleLineHeight); TimeSpan newEnd = _endTimeField.Draw(endFieldRect, _owner.SourceData.End, new GUIContent("End time:"), ArrowsLayout.Horizontal); _owner.SetStartAndEnd(newStart, newEnd, _owner.SourceData.Duration); OnGUIEnd(); } }
void Update() { if (_isGamePlaying && !EditorApplication.isPlaying) { _timeLineVar = null; _scenesLineVar = null; _soundLineVar = null; _timeTextFieldVar = null; LoadData(_baseData); _isGamePlaying = false; } if (!_isGamePlaying && EditorApplication.isPlaying) { if (_baseData != null) { CutsceneEngine[] engines = FindObjectsOfType <CutsceneEngine>(); foreach (CutsceneEngine engine in engines) { if (engine.Cutscene.GetInstanceID() == _baseData.GetInstanceID()) { _timeLine.AssignExternalTimeFlowEngine(engine.TimeEngine); break; } } _isGamePlaying = true; } } float currentTime = Time.realtimeSinceStartup; float deltaTime = currentTime - _lastTime; if (!_timeLine.TimeLineEngineIsExternal) { _timeLine.TimeLineEngine.HandleTime(deltaTime); } _lastTime = currentTime; if (_mousePressedOnHorizontal) { _timelinePanelHeightP = 1 - _mousePosNormalized.y; if (_timelinePanelHeightP < _timelinePanelHeightPMin) { _timelinePanelHeightP = _timelinePanelHeightPMin; } if (_timelinePanelHeightP > _timelinePanelHeightPMax) { _timelinePanelHeightP = _timelinePanelHeightPMax; } } if (_mousePressedOnVertical) { _scenesPanelWidthP = 1 - _mousePosNormalized.x; if (position.width * _scenesPanelWidthP < 83) { _scenesPanelWidthP = 83 / position.width; } } bool allowDrag = (!_mousePressedOnHorizontal && !_mousePressedOnVertical) && !_mouseWasReleased; _timeLine.Update(allowDrag); _scenesLine.Update(allowDrag); _soundLine.Update(allowDrag); if (_mouseWasReleased) { _mouseWasReleased = false; } }