예제 #1
0
    // 発言の分類が完了したときに呼ばれる
    public void onCompleteClassification(
        string utterance,                                          // 発言文字列
        string commandName,                                        // 発言が何らかの指令だったとき,指令のおおまかな分類
        Dictionary <string, SentenceUnderstanding.SlotValue> slots // 指令のパラメータ
        )
    {
        if (commandName == "天気")    // 天気を教えてという指令だったとき
        {
            if (slots["searchArea"].slotValue != "none" ||
                slots["hereArround"].slotValue != "none")
            {
                synth.speak("ごめんなさい、特定の場所の天気はわからないんです。");
                int act = 1;
                if (act == 1)
                {
                    this.animator.SetBool("noweather", true);                           //lose00を動かす
                    act = 0;
                }
                if (act != 1)
                {
                    this.animator.SetBool("noweather", false);
                }
            }
            else
            {
                day = 0;
                string date = slots["date"].slotValue;
                if (date == "今日")
                {
                    day = 1;
                }
                else if (date == "明日")
                {
                    day = 2;
                }
                else if (date == "明後日")
                {
                    day = 3;
                }

                context.Call("startSearchWeather", day);
            }
        }
        else if (followPattern.Contains(utterance))
        {
            followingScript.follow();
        }
        else if (askTimePattern.Contains(utterance))
        {
            synth.speak(context.Call <string>("getNowTime"));
            //what time
            int act = 1;
            if (act == 1)
            {
                this.animator.SetBool("nowtime", true);
                act = 0;
            }
            if (act != 1)
            {
                this.animator.SetBool("nowtime", false);
            }
        }
        else if (askDatePattern.Contains(utterance))
        {
            synth.speak(context.Call <string>("getNowDate"));
            //what day
            int act = 1;
            if (act == 1)
            {
                this.animator.SetBool("nowdate", true);
                act = 0;
            }
            if (act != 1)
            {
                this.animator.SetBool("nowdate", false);
            }
        }
        else
        {
            dc.Talk(utterance, onReply);
        }
    }