Exemplo n.º 1
0
        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 the text 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();

                        EditorHelper.SeparatorUI();

                        GUILayout.Label("Editor", EditorStyles.boldLabel);

                        if (GUILayout.Button(new GUIContent("Refresh AssetDatabase", EditorHelper.Icon_Refresh, "Refresh the AssetDatabase from the Editor.")))
                        {
                            refreshAssetDatabase();
                        }
                    }
                    else
                    {
                        GUILayout.Label("Disabled in Play-mode!");
                    }
                }
                else
                {
                    EditorHelper.NoVoicesUI();
                }
            }
            else
            {
                GUILayout.Label("Script is disabled!", EditorStyles.boldLabel);
            }
        }
Exemplo n.º 2
0
        private void showTestDrive()
        {
            if (Util.Helper.isEditorMode)
            {
                if (Speaker.Voices.Count > 0)
                {
                    scrollPosTD = EditorGUILayout.BeginScrollView(scrollPosTD, false, false);
                    {
                        GUILayout.Label("Test-Drive", EditorStyles.boldLabel);

                        text = EditorGUILayout.TextField("Text: ", text);

                        voiceIndex = EditorGUILayout.Popup("Voice", voiceIndex, Speaker.Voices.CTToString().ToArray());
                        rate       = EditorGUILayout.Slider("Rate", rate, 0f, 3f);

                        if (Util.Helper.isWindowsPlatform)
                        {
                            volume = EditorGUILayout.Slider("Volume", volume, 0f, 1f);
                        }
                    }
                    EditorGUILayout.EndScrollView();

                    EditorHelper.SeparatorUI();

                    GUILayout.BeginHorizontal();
                    {
                        if (GUILayout.Button(new GUIContent("Speak", EditorHelper.Icon_Speak, "Speaks the text with the selected voice and settings.")))
                        {
                            Speaker.SpeakNativeInEditor(text, Speaker.Voices[voiceIndex], rate, volume);
                            silenced = false;
                        }

                        if (GUILayout.Button(new GUIContent("Silence", EditorHelper.Icon_Silence, "Silence all active speakers.")))
                        {
                            silence();
                        }
                    }
                    GUILayout.EndHorizontal();

                    GUILayout.Space(6);
                }
                else
                {
                    EditorHelper.NoVoicesUI();
                }
            }
            else
            {
                GUILayout.Label("Disabled in Play-mode!");
            }
        }
Exemplo n.º 3
0
        private void showTestDrive()
        {
            if (Helper.isEditorMode)
            {
                voices.Clear();
                for (int voiceNumber = 0; voiceNumber < Speaker.Voices.Count; voiceNumber++)
                {
                    voices.Add(voiceNumber + ": " + Speaker.Voices[voiceNumber].Name);
                }

                if (voices.Count > 0)
                {
                    GUILayout.Label("Setup", EditorStyles.boldLabel);

                    text = EditorGUILayout.TextField("Text: ", text);

                    voiceIndex = EditorGUILayout.Popup("Voice", voiceIndex, voices.ToArray());
                    rate       = EditorGUILayout.Slider("Rate", rate, 0f, 3f);

                    if (Helper.isWindowsPlatform)
                    {
                        volume = EditorGUILayout.Slider("Volume", volume, 0f, 1f);
                    }

                    EditorHelper.SeparatorUI();

                    if (GUILayout.Button(new GUIContent("Speak", "Speaks the text with the selected voice and settings.")))
                    {
                        Speaker.SpeakNativeInEditor(text, Speaker.Voices[voiceIndex], rate, volume);
                        silenced = false;
                    }

                    if (GUILayout.Button(new GUIContent("Silence", "Silence all active speakers.")))
                    {
                        silence();
                    }
                }
                else
                {
                    EditorHelper.NoVoicesUI();
                }
            }
            else
            {
                GUILayout.Label("Disabled in Play-mode!");
            }
        }
Exemplo n.º 4
0
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            if (script.isActiveAndEnabled)
            {
                if (!Speaker.isTTSAvailable)
                {
                    EditorHelper.SeparatorUI();

                    EditorHelper.NoVoicesUI();
                }
            }
            else
            {
                EditorHelper.SeparatorUI();

                GUILayout.Label("Script is disabled!", EditorStyles.boldLabel);
            }
        }
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            EditorHelper.SeparatorUI();

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

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

                        if (GUILayout.Button(new GUIContent("Silence", "Silence the active speaker.")))
                        {
                            script.Silence();
                        }
                    }
                    else
                    {
                        GUILayout.Label("Disabled in Play-mode!");
                    }
                }
                else
                {
                    EditorHelper.NoVoicesUI();
                }
            }
            else
            {
                GUILayout.Label("Script is disabled!", EditorStyles.boldLabel);
            }
        }