Esempio n. 1
0
    private void GUI_RecordingStatus()
    {
        GUILayout.Space(8.0f);
        GUILayout.Label("Output", "box");
        GUILayout.BeginVertical("box");

        DrawGuiField("Recording to", System.IO.Path.GetFileName(_movieCapture.LastFilePath));
        GUILayout.Space(8.0f);

        GUILayout.Label("Video", "box");
        DrawGuiField("Dimensions", _movieCapture.GetRecordingWidth() + "x" + _movieCapture.GetRecordingHeight() + " @ " + ((int)_movieCapture._frameRate).ToString() + "hz");
        DrawGuiField("Codec", _movieCapture._codecName);

        if (!_movieCapture._noAudio && _movieCapture._isRealTime)
        {
            GUILayout.Label("Audio", "box");
            DrawGuiField("Source", _movieCapture._audioDeviceName);
            DrawGuiField("Codec", _movieCapture._audioCodecName);
            if (_movieCapture._audioDeviceName == "Unity")
            {
                DrawGuiField("Sample Rate", _movieCapture._unityAudioSampleRate.ToString() + "hz");
                DrawGuiField("Channels", _movieCapture._unityAudioChannelCount.ToString());
            }
        }

        GUILayout.EndVertical();

        GUILayout.Space(8.0f);

        GUILayout.Label("Stats", "box");
        GUILayout.BeginVertical("box");

        if (_movieCapture._frameTotal >= (int)_movieCapture._frameRate * 2)
        {
            Color originalColor = GUI.color;
            float fpsDelta      = (_movieCapture._fps - (int)_movieCapture._frameRate);
            GUI.color = Color.red;
            if (fpsDelta > -10)
            {
                GUI.color = Color.yellow;
            }
            if (fpsDelta > -2)
            {
                GUI.color = Color.green;
            }

            DrawGuiField("Capture Rate", _movieCapture._fps.ToString("F1") + " FPS");

            GUI.color = originalColor;
        }
        else
        {
            DrawGuiField("Capture Rate:", ".. FPS");
        }

        DrawGuiField("File Size", (int)(_lastFileSize / (1024 * 1024)) + "MB");
        DrawGuiField("Video Length", _lastEncodedMinutes + ":" + _lastEncodedSeconds + "s");
        DrawGuiField("Encoded Frames", _movieCapture.NumEncodedFrames.ToString());

        GUILayout.Label("Dropped Frames", "box");
        DrawGuiField("In Unity", _movieCapture.NumDroppedFrames.ToString());
        DrawGuiField("In Encoder ", _movieCapture.NumDroppedEncoderFrames.ToString());

        GUILayout.EndVertical();

        GUILayout.BeginHorizontal();

        if (!_movieCapture.IsPaused())
        {
            if (GUILayout.Button("Pause Capture"))
            {
                PauseCapture();
            }
        }
        else
        {
            if (GUILayout.Button("Resume Capture"))
            {
                ResumeCapture();
            }
        }

        if (GUILayout.Button("Stop Capture"))
        {
            StopCapture();
        }

        GUILayout.EndHorizontal();
    }
    private void DrawCapturingGUI()
    {
        GUILayout.Space(8.0f);
        GUILayout.Label("Output", EditorStyles.boldLabel);
        EditorGUILayout.BeginVertical("box");
        EditorGUI.indentLevel++;

        GUILayout.Label("Recording to: " + System.IO.Path.GetFileName(_capture.LastFilePath));
        GUILayout.Space(8.0f);

        GUILayout.Label("Video");
        EditorGUILayout.LabelField("Dimensions", _capture.GetRecordingWidth() + "x" + _capture.GetRecordingHeight() + " @ " + ((int)_capture._frameRate).ToString() + "hz");
        EditorGUILayout.LabelField("Codec", _capture._codecName);

        if (!_capture._noAudio && _captureModeIndex == 0)
        {
            GUILayout.Label("Audio");
            EditorGUILayout.LabelField("Source", _capture._audioDeviceName);
            EditorGUILayout.LabelField("Codec", _capture._audioCodecName);
            if (_capture._audioDeviceName == "Unity")
            {
                EditorGUILayout.LabelField("Sample Rate", _capture._unityAudioSampleRate.ToString() + "hz");
                EditorGUILayout.LabelField("Channels", _capture._unityAudioChannelCount.ToString());
            }
        }

        EditorGUI.indentLevel--;
        EditorGUILayout.EndVertical();

        GUILayout.Space(8.0f);

        GUILayout.Label("Stats", EditorStyles.boldLabel);
        EditorGUILayout.BeginVertical("box");
        EditorGUI.indentLevel++;

        if (_capture._frameTotal >= (int)_capture._frameRate * 2)
        {
            Color originalColor = GUI.color;
            float fpsDelta      = (_capture._fps - (int)_capture._frameRate);
            GUI.color = Color.red;
            if (fpsDelta > -10)
            {
                GUI.color = Color.yellow;
            }
            if (fpsDelta > -2)
            {
                GUI.color = Color.green;
            }

            EditorGUILayout.LabelField("Capture Rate", _capture._fps.ToString("F1") + " FPS");

            GUI.color = originalColor;
        }
        else
        {
            EditorGUILayout.LabelField("Capture Rate", ".. FPS");
        }

        EditorGUILayout.LabelField("File Size", (int)(_lastFileSize / (1024 * 1024)) + "MB");
        EditorGUILayout.LabelField("Video Length", _lastEncodedMinutes + ":" + _lastEncodedSeconds + "s");
        EditorGUILayout.LabelField("Encoded Frames", _capture.NumEncodedFrames.ToString());

        GUILayout.Label("Dropped Frames");
        EditorGUILayout.LabelField("In Unity", _capture.NumDroppedFrames.ToString());
        EditorGUILayout.LabelField("In Encoder", _capture.NumDroppedEncoderFrames.ToString());

        EditorGUI.indentLevel--;
        EditorGUILayout.EndVertical();
    }