コード例 #1
0
    bool TTS_IsSpeaking()
    {
        if (UAP_CustomTTS.IsInitialized() == UAP_CustomTTS.TTSInitializationState.NotInitialized)
        {
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
            if (UAP_AccessibilityManager.UseWindowsTTS() && WindowsTTS.instance != null)
            {
                return(WindowsTTS.IsSpeaking());
            }
            else
            {
                return(false);
            }
#elif (UNITY_STANDALONE_OSX || UNITY_EDITOR) && !UNITY_WEBPLAYER
            if (UAP_AccessibilityManager.UseMacOSTTS())
            {
                return(MacOSTTS.instance.IsSpeaking());
            }
            else
            {
                return(false);
            }
#elif UNITY_ANDROID
            return(AndroidTTS.IsSpeaking());

            //bool isTTSSpeaking = AndroidTTS.IsSpeaking();
            //if (!isTTSSpeaking)
            //  return false;
            //return m_TTS_SpeakingTimer > 0.0f;
#elif UNITY_IOS
            // VoiceOver sometimes times out without notification
            if (!m_LastEntryUsedVoiceOver)
            {
                return(iOSTTS.IsSpeaking());
            }
            // VoiceOver is not 100% reliable unfortunately
            bool VOSpeaking = iOSTTS.IsSpeaking();
            if (!VOSpeaking)
            {
                return(false);
            }
            return(m_TTS_SpeakingTimer > 0.0f);
#else
            return(false);
#endif
        }
        else
        {
            return(UAP_CustomTTS.IsSpeaking());
        }
    }
コード例 #2
0
        IEnumerator WaitForUapToStopSpeaking()
        {
            while (AndroidTTS.IsSpeaking() == true)
            {
                yield return(null);
            }
#if UNITY_IOS
            while (iOSTTS.IsSpeaking() == true)
            {
                yield return(null);
            }
#endif
            Finish();
            if (finishEvent != null)
            {
                Fsm.Event(finishEvent);
            }
        }