Пример #1
0
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            EditorHelper.SeparatorUI();

            if (script.isActiveAndEnabled)
            {
                if (script.TextFiles != null && script.TextFiles.Length > 0)
                {
                    if (Speaker.isTTSAvailable && EditorHelper.isRTVoiceInScene)
                    {
                        GUILayout.Label("Test-Drive", EditorStyles.boldLabel);

                        if (Util.Helper.isEditorMode)
                        {
                            if (Speaker.isMaryMode)
                            {
                                EditorGUILayout.HelpBox("Test-Drive is not supported for MaryTTS.", MessageType.Info);
                            }
                            else
                            {
                                GUILayout.BeginHorizontal();
                                {
                                    if (GUILayout.Button(new GUIContent(" Speak", EditorHelper.Icon_Speak, "Speaks a random text file with the selected voice and settings.")))
                                    {
                                        script.Speak();
                                    }

                                    GUI.enabled = Speaker.isSpeaking;
                                    if (GUILayout.Button(new GUIContent(" Silence", EditorHelper.Icon_Silence, "Silence the active speaker.")))
                                    {
                                        script.Silence();
                                    }
                                    GUI.enabled = true;
                                }
                                GUILayout.EndHorizontal();
                            }
                        }
                        else
                        {
                            EditorGUILayout.HelpBox("Disabled in Play-mode!", MessageType.Info);
                        }
                    }
                    else
                    {
                        EditorHelper.NoVoicesUI();
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("Please add an entry to 'Text Files'!", MessageType.Warning);
                }
            }
            else
            {
                EditorGUILayout.HelpBox("Script is disabled!", MessageType.Info);
            }
        }
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            EditorHelper.SeparatorUI();

            if (script.isActiveAndEnabled)
            {
                if (Speaker.isTTSAvailable)
                {
                    GUILayout.Label("Test-Drive", EditorStyles.boldLabel);

                    if (Util.Helper.isEditorMode)
                    {
                        GUILayout.BeginHorizontal();
                        {
                            if (GUILayout.Button(new GUIContent("Speak", EditorHelper.Icon_Speak, "Speaks a random text file with the selected voice and settings.")))
                            {
                                script.Speak();
                            }

                            if (GUILayout.Button(new GUIContent("Silence", EditorHelper.Icon_Silence, "Silence the active speaker.")))
                            {
                                script.Silence();
                            }
                        }
                        GUILayout.EndHorizontal();
                    }
                    else
                    {
                        GUILayout.Label("Disabled in Play-mode!");
                    }
                }
                else
                {
                    EditorHelper.NoVoicesUI();
                }
            }
            else
            {
                GUILayout.Label("Script is disabled!", EditorStyles.boldLabel);
            }
        }
Пример #3
0
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            EditorHelper.SeparatorUI();

            if (script.isActiveAndEnabled)
            {
                if (script.TextFiles != null && script.TextFiles.Length > 0)
                {
                    if (script.PlayOnStart && script.PlayAllOnStart)
                    {
                        EditorGUILayout.HelpBox("Can't use 'Play On Start' and 'Play All On Start' in combination. Please decide for one approach!", MessageType.Warning);
                    }
                    else
                    {
                        if (Speaker.isTTSAvailable && EditorHelper.isRTVoiceInScene)
                        {
                            GUILayout.Label("Test-Drive", EditorStyles.boldLabel);

                            if (Util.Helper.isEditorMode)
                            {
                                if (Speaker.isWorkingInEditor)
                                {
                                    GUILayout.BeginHorizontal();
                                    {
                                        /*
                                         * if (GUILayout.Button(new GUIContent(" Previous", EditorHelper.Icon_Previous, "Plays the previous radio station.")))
                                         * {
                                         *  script.Previous();
                                         * }
                                         */

                                        if (Speaker.isSpeaking)
                                        {
                                            if (GUILayout.Button(new GUIContent(" Silence", EditorHelper.Icon_Silence, "Silence the active speaker.")))
                                            {
                                                script.Silence();
                                            }
                                        }
                                        else
                                        {
                                            if (GUILayout.Button(new GUIContent(" Speak", EditorHelper.Icon_Speak, "Speaks a random text file with the selected voice and settings.")))
                                            {
                                                script.Speak();
                                            }
                                        }

                                        /*
                                         * if (GUILayout.Button(new GUIContent(" Next", EditorHelper.Icon_Next, "Speaks the next text file.")))
                                         * {
                                         *  script.Next();
                                         * }
                                         */
                                    }
                                    GUILayout.EndHorizontal();
                                }
                                else
                                {
                                    EditorGUILayout.HelpBox("Test-Drive is not supported for current TTS-system inside the Unity Editor.", MessageType.Info);
                                }
                            }
                            else
                            {
                                EditorGUILayout.HelpBox("Disabled in Play-mode!", MessageType.Info);
                            }
                        }
                        else
                        {
                            EditorHelper.NoVoicesUI();
                        }
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("Please add an entry to 'Text Files'!", MessageType.Warning);
                }
            }
            else
            {
                EditorGUILayout.HelpBox("Script is disabled!", MessageType.Info);
            }
        }