示例#1
0
    /*public void LoadNew()
     * {
     *  BowlMove.transform.localEulerAngles = new Vector3(0, 0, 0);
     *  BowlMove.transform.localPosition = new Vector3(0, 0.997f, 0.363f);
     *  PlaneMove.transform.localPosition = new Vector3(14.3f, 0.43f, 30.15f);
     *  model.transform.localPosition = new Vector3(5, 0, 0);
     *  Cursor.gameObject.SetActive(true);
     * }*/
    /*   public void LoadNew1()
     * {
     *     planescript.leftcount = 0;
     *     planescript.rightcount = 0;
     *     planescript.upcount = 0;
     *     PlaneMove.transform.localEulerAngles = new Vector3(0, 180f, 0);
     *     PlaneMove.transform.localPosition = new Vector3(0, 0.43f, 30.15f);
     *     BowlMove.transform.localPosition = new Vector3(14.3f, 0.997f, 0.363f);
     *     model.transform.localPosition = new Vector3(5, 0, 0);
     *     Cursor.gameObject.SetActive(false);
     * }*/
    private void StartConversation()
    {
        //mark
        //Active = false;
        ConversationMark convermark = gameObject.GetComponent <ConversationMark>();


        print("startconversation");
        if (OutputText.text != "")
        {
            convermark.AskQuestion();
        }
        //OutputText.text = "";
    }
示例#2
0
    private IEnumerator listenbool(float length)
    {
        ConversationMark convermark = gameObject.GetComponent <ConversationMark>();

        yield return(new WaitForSeconds(length + 1f));

        if (!dancerot.danceon)
        {
            //   sttmark.Active = true;
        }

        //   googletest.StartRecordButtonOnClickHandler();

        //    makrtest.MoveOn1 = false;
        //   makrtest.MoveOn11 = false;
        //   makrtest.MoveOn2 = false;
        //   texttoread.text = "";
    }
示例#3
0
    private void startchatbot()
    {
        ConversationMark convermark = gameObject.GetComponent <ConversationMark>();

        convermark.chatbotanswer();
    }
示例#4
0
    private void OnRecognize(SpeechRecognitionEvent result)
    {
        ConversationMark convermark = gameObject.GetComponent <ConversationMark>();

        if (result != null && result.results.Length > 0)
        {
            foreach (var res in result.results)
            {
                foreach (var alt in res.alternatives)
                {
                    string text = alt.transcript;
                    Log.Debug("ExampleStreaming", string.Format("{0} ({1}, {2:0.00})\n", text, res.final ? "Final" : "Interim", alt.confidence));
                    if (res.final)
                    {
                        //Active = false;
                        OutputText.text = alt.transcript;
                        //  alt.transcript = alt.transcript.Replace(" ", "");
                        OutputText.text = OutputText.text.Replace(" ", "");
                        outputtest.text = alt.transcript;

                        /*     if (weatheron)
                         *   {
                         *       StartCoroutine(Marktest.GetWeather(alt.transcript));
                         *       weatheron = false;
                         *   }*/
                        /*mark    if (convermark.videoon)
                         *  {
                         *      if (alt.transcript.Contains("stop") || alt.transcript.Contains("quit") || alt.transcript.Contains("back"))
                         *      {
                         *          convermark.stopvideo();
                         *      }
                         *      else
                         *      {
                         *          Active = true;
                         *      }
                         *  }*/
                        //     else
                        //   {

                        // StartConversation();
                        //  startTuling(OutputText.text);
                        //  startchatbot();
                        //   }

                        if (OutputText.text.Contains("你叫什么") || OutputText.text.Contains("名字") || OutputText.text.Contains("叫什么") || OutputText.text.Contains("你是谁"))
                        {
                            string greeting = "你好,我是光子机器人,有什么可以为您服务?";
                            Marktest.speaktuling(greeting);


                            map.gameObject.SetActive(false);
                            //          webview.transform.localPosition = new Vector3(5f, 1.414f, -0.461f);
                        }
                        else if (OutputText.text.Contains("哪儿") || OutputText.text.Contains("哪") || OutputText.text.Contains("位置") || OutputText.text.Contains("在哪") || OutputText.text.Contains("在那") || OutputText.text.Contains("那"))
                        {
                            string greeting = "好的,麻烦您稍等";
                            Marktest.speaktuling(greeting);
                            StartCoroutine(baiduloc.GetToken(OutputText.text));
                            //     webview.transform.localPosition = new Vector3(5f, 1.414f, -0.461f);
                        }
                        else if (OutputText.text.Contains("公司信息") || OutputText.text.Contains("信息") || OutputText.text.Contains("公司") || OutputText.text.Contains("技术") || OutputText.text.Contains("介绍"))
                        {
                            string greeting = "深圳光子晶体是一家致力于全透明显示的科技公司。在过去,由于物理法则的限制,人们无法在透明的玻璃上实现成像。通过我们公司的纳米专利技术,可以将投影仪的光呈现在玻璃上并选择性的透过其他光源。这一技术可以广泛的应用在多个场合,比如商场橱窗,汽车抬头显示等。";
                            Marktest.speaktuling(greeting);

                            map.gameObject.SetActive(false);
                            //      webview.transform.localPosition = new Vector3(5f, 1.414f, -0.461f);
                        }
                        else if (OutputText.text.Contains("跳舞") || OutputText.text.Contains("跳支舞") || OutputText.text.Contains("跳个舞") || OutputText.text.Contains("舞蹈") || OutputText.text.Contains("舞"))
                        {
                            string greeting = "好的,请您稍等";
                            Marktest.speaktuling(greeting);
                            danceRob.StartCoroutine(danceRob.Losetime());
                            danceRob.StartCoroutine(danceRob.DanceTime());
                            //  company.gameObject.SetActive(false);
                            //    function.gameObject.SetActive(false);
                            videodemo.gameObject.SetActive(false);

                            map.gameObject.SetActive(false);
                            //     webview.transform.localPosition = new Vector3(5f, 1.414f, -0.461f);
                        }
                        else if (OutputText.text.Contains("视频") || OutputText.text.Contains("视频演示") || OutputText.text.Contains("演示") || OutputText.text.Contains("播放"))
                        {
                            string greeting = "好的,请您稍等";
                            Marktest.speaktuling(greeting);
                            videodemo.gameObject.SetActive(true);
                            //  company.gameObject.SetActive(false);
                            //   function.gameObject.SetActive(false);
                            StartCoroutine(videodemoshow());
                            map.gameObject.SetActive(false);
                            //        webview.transform.localPosition = new Vector3(5f, 1.414f, -0.461f);
                        }

                        /*     else if (OutputText.text.Contains("古董"))
                         *   {
                         *       string greeting = "好的,请您稍等";
                         *       Marktest.speaktuling(greeting);
                         *       LoadNew();
                         *       map.gameObject.SetActive(false);
                         *       webview.transform.localPosition = new Vector3(5f, 1.414f, -0.461f);
                         *   }*/
                        /*     else if (OutputText.text.Contains("飞机"))
                         *   {
                         *       string greeting = "好的,请您稍等";
                         *       Marktest.speaktuling(greeting);
                         *       LoadNew1();
                         *       map.gameObject.SetActive(false);
                         *       webview.transform.localPosition = new Vector3(5f, 1.414f, -0.461f);
                         *   }*/
                        else if (OutputText.text.Contains("停止") || OutputText.text.Contains("退出") || OutputText.text.Contains("取消") || OutputText.text.Contains("停") || OutputText.text.Contains("返回"))
                        {
                            string greeting = "好的";
                            Marktest.speaktuling(greeting);
                            stopvideo();
                            map.gameObject.SetActive(false);
                            //    webview.transform.localPosition = new Vector3(5f, 1.414f, -0.461f);
                            model.gameObject.SetActive(true);
                            //       PlaneMove.transform.localPosition = new Vector3(14.3f, 0.43f, 30.15f);
                            //      BowlMove.transform.localPosition = new Vector3(14.3f, 0.997f, 0.363f);
                            model.transform.localPosition = new Vector3(0, 0, 0);
                            //       Cursor.gameObject.SetActive(false);
                        }

                        else
                        {
                            map.gameObject.SetActive(false);
                            //    webview.transform.localPosition = new Vector3(5f, 1.414f, -0.461f);
                            startTuling(OutputText.text);
                            //     Cursor.gameObject.SetActive(false);
                        }



                        /*  if (alt.transcript.Contains("weather") || alt.transcript.Contains("temperature")|| alt.transcript.Contains("degree")|| alt.transcript.Contains("climate"))
                         * {
                         *    Startunderstand();
                         * }
                         * else
                         * {
                         *    //
                         * //   Startunderstand();
                         *    StartConversation();
                         * }*/
                    }
                    OutputText.text = "";
                }
            }
        }
    }