Example #1
0
        /// <summary>
        /// 流程过渡
        /// </summary>
        /// <param name="Mode">当前模式</param>
        /// <param name="txt">过渡文字</param>
        public static void PlayTransitVoice(int Mode, string txt)
        {
            animName = AnimationControl.GetAnimationClipName(CharacterAction.Looking);
            if (FlowManage.waveOutDevice != null)
            {
                FlowManage.waveOutDevice.Dispose();
                FlowManage.waveOutDevice = null;
            }
            if (FlowManage.audioFileReader != null)
            {
                FlowManage.audioFileReader.Close();
                FlowManage.audioFileReader = null;
            }
            if (Mode == 1) //播放进入沙勿略问我模式语音
            {
                content   = txt;
                voicename = "transit1";
            }
            else if (Mode == 2) //播放进入我问沙勿略模式语音
            {
                content   = txt;
                voicename = "transit2";
            }
            Thread thread_transit = new Thread(new ThreadStart(playVoice));

            thread_transit.IsBackground = true;
            thread_transit.Start();
            mt.isTransit = true;
        }
Example #2
0
        public static string voicename = ""; //语音合成音频名称

        /// <summary>
        /// 进入待机状态
        /// </summary>
        public static void EnterStandBy(GameObject go)
        {
            characterModel     = go;
            characterAnimation = go.GetComponent <Animation>();
            animName           = AnimationControl.GetAnimationClipName(CharacterAction.Introducing);
            PlayModeAnimation();
            AskQuestion aq = new AskQuestion();

            tempAnswer = aq.GetQuestions();
        }
Example #3
0
        /// <summary>
        /// 停止回答(沙勿略问我)
        /// </summary>
        public static void StopAnswer()
        {
            string retString = VoiceManage.rec_result;

            u.M2P_Answer_Panel.transform.GetChild(2).gameObject.GetComponent <UILabel>().text = retString;
            mt.AnswerAnalysis = true;
            if (retString != "")
            {
                string HayStack  = retString;
                Regex  r         = new Regex(@"[a-zA-Z]+");
                Match  m         = r.Match(HayStack);
                string answerStr = m.Value.ToUpper().Trim();
                string Needle    = tempAnswer[curNo - 1].CorrectAnswer;
                if (answerStr.Equals(Needle) || Needle.Contains(answerStr) && answerStr != "")
                {
                    animName  = AnimationControl.GetAnimationClipName(CharacterAction.Right);
                    content   = "恭喜你,回答正确";
                    voicename = "correct";
                    u.M2P_Answer_Panel.transform.GetChild(1).gameObject.GetComponent <UILabel>().text = "回答正确";
                }
                else
                {
                    if (KeywordMatch.GetResultByKeywordMatch(HayStack, mt.AnswerList))
                    {
                        animName  = AnimationControl.GetAnimationClipName(CharacterAction.Right);
                        content   = "恭喜你,回答正确";
                        voicename = "correct";
                        u.M2P_Answer_Panel.transform.GetChild(1).gameObject.GetComponent <UILabel>().text = "回答正确";
                    }
                    else
                    {
                        animName  = AnimationControl.GetAnimationClipName(CharacterAction.Wrong);
                        content   = "很遗憾,回答错误,正确答案是" + Needle;
                        voicename = "wrong";
                        u.M2P_Answer_Panel.transform.GetChild(1).gameObject.GetComponent <UILabel>().text = "回答错误";
                    }
                }
            }
            else
            {
                animName  = AnimationControl.GetAnimationClipName(CharacterAction.Thinking);
                content   = "抱歉,您说了什么,我没有听清";
                voicename = "sorry";
                u.M2P_Answer_Panel.transform.GetChild(1).gameObject.GetComponent <UILabel>().text = "抱歉,您说了什么,我没有听清";
            }
            Thread thread_analysis = new Thread(new ThreadStart(playVoice));

            thread_analysis.IsBackground = true;
            thread_analysis.Start();
        }
Example #4
0
 /// <summary>
 /// 沙勿略问我模式
 /// </summary>
 /// <param name="no">题号</param>
 public static void M2PMode(int no)
 {
     u.M2P_Answer_Panel.transform.GetChild(1).gameObject.GetComponent <UILabel>().text = "";
     u.M2P_Answer_Panel.transform.GetChild(2).gameObject.GetComponent <UILabel>().text = "";
     animName = AnimationControl.GetAnimationClipName(CharacterAction.Asking);
     curNo    = no;
     if (tempAnswer == null)
     {
         Debug.Log("题库读取数据失败..");
     }
     else//机器读出并在界面显示问题内容
     {
         content   = "第" + curNo + "题." + tempAnswer[curNo - 1].title;
         voicename = "subject" + curNo;
         Thread thread_question = new Thread(new ThreadStart(playVoice));
         thread_question.IsBackground = true;
         thread_question.Start();
         FlowManage.StartUserAnswer();
     }
 }