Пример #1
0
    //void RecognizeResult(string content)
    //{
    //    voiceHint = false;

    //    content = content.TrimEnd('.');
    //    bool recognizeOK = false;

    //    for (int i = 0; i < dialog.answerIds.Count; i++)
    //    {
    //        Sentence sentence = Sentence.Get(dialog.answerIds[i]);
    //        if (sentence.en.ToUpper().Contains(content.ToUpper()))
    //        {
    //            Debug.Log(sentence.en + " contains " + content);
    //            triggerId = dialog.answerIds[i];
    //            answerIndex = i;

    //            iPlay.Select(dialog.answerIds[i]);

    //            if (dialog.transfer == 2)
    //            {
    //                index++;
    //                StartCoroutine(Evaluating(0, SUCCESS));
    //                recognizeOK = true;
    //                break;
    //            }
    //            else
    //            {
    //                DisplayAnswer(answerIndex);
    //                recognizeOK = true;
    //                break;
    //            }
    //        }
    //        else
    //        {
    //            Debug.Log(sentence.en + " not contains " + content);
    //        }
    //    }

    //    if (recognizeOK == false)
    //    {
    //        StartCoroutine(ShowPrompt());
    //    }
    //}

    //IEnumerator ShowPrompt()
    //{
    //    yield return new WaitForSeconds(1f);

    //    float time = Audio.GetInstance().Play(AudioType.INTRO, Prompt.Get().Audio);
    //    yield return new WaitForSeconds(time);

    //    agent.StartRecognize(RecognizeResult);
    //    voiceHint = true;
    //    deltaTime = 0f;
    //}

    void DisplayAnswer(int aIndex)
    {
        Debug.Log("DisplayAnswer:" + aIndex);
        iPlay.Display(Sentence.Get(dialog.answerIds[aIndex]).itemName);
        customer.Find("EN").GetComponent <Text>().text = Sentence.Get(dialog.answerIds[aIndex]).en;
        customer.Find("CN").GetComponent <Text>().text = Role.currentRole.isReview ? "" : Sentence.Get(dialog.answerIds[aIndex]).cn;
        agent.StartEvaluator(ReceiveEvaluatorResult, Sentence.Get(dialog.answerIds[aIndex]).en);

        ///测试
        //Hint.GetInstance().Show("棒极了!", "Perfect!");
        //ShowStar(5);
        //index++;
        //StartCoroutine(Evaluating(0.5f, SUCCESS));


        voiceHint = true;
        deltaTime = 0f;
        Role.AddToReviewByDialog(dialog.answerIds[aIndex]);
    }