1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- using UnityEngine;
- using UnityEditor;
- namespace RenderHeads.Media.AVProVideo.Editor
- {
-
-
-
- public partial class MediaPlayerEditor : UnityEditor.Editor
- {
- #if UNITY_EDITOR_OSX
- internal const string SubtitleFileExtensions = "srt";
- #else
- internal const string SubtitleFileExtensions = "Subtitle Files;*.srt";
- #endif
- private SerializedProperty _propSubtitles;
- private SerializedProperty _propSubtitlePath;
- private void OnInspectorGUI_Subtitles()
- {
-
- MediaPlayer media = (this.target) as MediaPlayer;
-
- EditorGUILayout.PropertyField(_propSubtitles, new GUIContent("Sideload Subtitles"));
-
- EditorGUI.BeginDisabledGroup(!_propSubtitles.boolValue);
- EditorGUILayout.BeginVertical(GUI.skin.box);
- EditorGUILayout.PropertyField(_propSubtitlePath);
-
- {
- GUI.color = Color.white;
- GUILayout.BeginHorizontal();
- if (Application.isPlaying)
- {
- if (GUILayout.Button("Load"))
- {
- MediaPath mediaPath = new MediaPath(_propSubtitlePath.FindPropertyRelative("_path").stringValue, (MediaPathType)_propSubtitlePath.FindPropertyRelative("_pathType").enumValueIndex);
- media.EnableSubtitles(mediaPath);
- }
- if (GUILayout.Button("Clear"))
- {
- media.DisableSubtitles();
- }
- }
- else
- {
- GUILayout.FlexibleSpace();
- }
- MediaPathDrawer.ShowBrowseSubtitlesButtonIcon(_propSubtitlePath);
- GUILayout.EndHorizontal();
- if (_propSubtitles.boolValue)
- {
-
-
-
- }
- }
-
- EditorGUILayout.EndVertical();
- EditorGUI.EndDisabledGroup();
- }
- }
- }
|