protected void GUI_Controls() { if (_baseCapture == null) { return; } GUILayout.Space(8.0f); EditorGUI.BeginDisabledGroup(!Application.isPlaying); { if (!_baseCapture.IsCapturing()) { GUI.backgroundColor = Color.green; string startString = "Start Capture"; if (!_baseCapture._isRealTime) { startString = "Start Render"; } if (GUILayout.Button(startString, GUILayout.Height(32f))) { _baseCapture.SelectCodec(false); _baseCapture.SelectAudioDevice(false); // We have to queue the start capture otherwise Screen.width and height aren't correct _baseCapture.QueueStartCapture(); } GUI.backgroundColor = Color.white; } else { GUILayout.BeginHorizontal(); if (!_baseCapture.IsPaused()) { GUI.backgroundColor = Color.yellow; if (GUILayout.Button("Pause", GUILayout.Height(32f))) { _baseCapture.PauseCapture(); } } else { GUI.backgroundColor = Color.green; if (GUILayout.Button("Resume", GUILayout.Height(32f))) { _baseCapture.ResumeCapture(); } } GUI.backgroundColor = Color.cyan; if (GUILayout.Button("Cancel", GUILayout.Height(32f))) { _baseCapture.CancelCapture(); } GUI.backgroundColor = Color.red; if (GUILayout.Button("Stop", GUILayout.Height(32f))) { _baseCapture.StopCapture(); } GUI.backgroundColor = Color.white; GUILayout.EndHorizontal(); } } EditorGUI.EndDisabledGroup(); EditorGUILayout.Space(); EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(CaptureBase.LastFileSaved)); GUILayout.BeginHorizontal(); if (GUILayout.Button("Browse Last")) { if (!string.IsNullOrEmpty(CaptureBase.LastFileSaved)) { Utils.ShowInExplorer(CaptureBase.LastFileSaved); } } { Color prevColor = GUI.color; GUI.color = Color.cyan; if (GUILayout.Button("View Last Capture")) { if (!string.IsNullOrEmpty(CaptureBase.LastFileSaved)) { Utils.OpenInDefaultApp(CaptureBase.LastFileSaved); } } GUI.color = prevColor; } GUILayout.EndHorizontal(); EditorGUI.EndDisabledGroup(); }
public override bool RequiresConstantRepaint() { CaptureBase capture = (this.target) as CaptureBase; return(Application.isPlaying && capture.isActiveAndEnabled && capture.IsCapturing() && !capture.IsPaused()); }
/// <summary> /// 是否暂停 /// </summary> /// <returns></returns> public bool IsPaused() { return(movieCapture.IsPaused()); }