public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EditorGUI.BeginProperty(position, GUIContent.none, property);

            SerializedProperty propPath     = property.FindPropertyRelative("_path");
            SerializedProperty propPathType = property.FindPropertyRelative("_pathType");

            EditorGUILayout.PropertyField(propPathType, GUIContent.none);

            //GUI.color = HttpHeader.IsValid(valueProp.stringValue)?Color.white:Color.red;
            string newUrl = EditorGUILayout.TextArea(propPath.stringValue, EditorHelper.IMGUI.GetWordWrappedTextAreaStyle());

            //GUI.color = Color.white;
            newUrl = newUrl.Trim();
            if (EditorHelper.SafeSetPathProperty(newUrl, propPath))
            {
                // TODO: shouldn't we set all targets?
                EditorUtility.SetDirty(property.serializedObject.targetObject);
            }
            MediaPlayerEditor.ShowFileWarningMessages(propPath.stringValue, (MediaPathType)propPathType.enumValueIndex, null, MediaSource.Path, false, Platform.Unknown);
            GUI.color = Color.white;

            EditorGUI.EndProperty();
        }
示例#2
0
        public override void OnInspectorGUI()
        {
            //MediaPlayer media = (this.target) as MediaPlayer;

            //this.DrawDefaultInspector();

            serializedObject.Update();

            GUILayout.Label("Media Reference");
            EditorGUILayout.Space();
            //EditorGUILayout.PropertyField(_propAlias);
            //EditorGUILayout.Space();

            {
                string mediaName = _propMediaPath.FindPropertyRelative("_path").stringValue;
                GUILayout.BeginVertical(GUI.skin.box);
                MediaPlayerEditor.OnInspectorGUI_CopyableFilename(mediaName);
                GUILayout.EndVertical();
            }

            EditorGUILayout.PropertyField(_propMediaPath);

            MediaPathDrawer.ShowBrowseButton(_propMediaPath);

            EditorGUILayout.Space();

            //GUILayout.Label("Media Hints", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(_propHints);

            EditorGUILayout.PropertyField(_propPlatformMacOS, new GUIContent("macOS"));
            EditorGUILayout.PropertyField(_propPlatformWindows, new GUIContent("Windows"));
            EditorGUILayout.PropertyField(_propPlatformAndroid, new GUIContent("Android"));
            EditorGUILayout.PropertyField(_propPlatformIOS, new GUIContent("iOS"));
            EditorGUILayout.PropertyField(_propPlatformTvOS, new GUIContent("tvOS"));
            EditorGUILayout.PropertyField(_propPlatformWindowsUWP, new GUIContent("UWP"));
            EditorGUILayout.PropertyField(_propPlatformWebGL, new GUIContent("WebGL"));
            EditorGUILayout.Space();
            EditorGUILayout.Space();

            serializedObject.ApplyModifiedProperties();

            bool beginGenerateThumbnails = false;

            GUILayout.FlexibleSpace();
            EditorGUI.BeginDisabledGroup(IsGeneratingThumbnails());

            GUILayout.BeginHorizontal();
            _thumbnailTime = GUILayout.HorizontalSlider(_thumbnailTime, 0f, 1f, GUILayout.ExpandWidth(true));
            _zoomToFill    = GUILayout.Toggle(_zoomToFill, "Zoom And Crop", GUI.skin.button, GUILayout.ExpandWidth(false));
            GUILayout.EndHorizontal();
            if (GUILayout.Button("Generate Thumbnail"))
            {
                beginGenerateThumbnails = true;
            }
            EditorGUI.EndDisabledGroup();

            if (beginGenerateThumbnails)
            {
                BeginGenerateThumbnails();
            }

            if (IsGeneratingThumbnails())
            {
                ShowProgress();
            }
            if (!IsGeneratingThumbnails())
            {
                RemoveProgress();
            }
        }