Esempio n. 1
0
    private void LogResponseText(DF2Response response)
    {
        string text = response.queryResult.fulfillmentText;
        string talkingSpeciesName = "";

        if (text.Contains("{TalkingSpecies_"))
        {
            foreach (KeyValuePair <string, GeoGroupInfo> kv in NatureController.Instance.AllGeoGroupInfo)
            {
                if (text.Contains("{TalkingSpecies_" + kv.Key + "}"))
                {
                    talkingSpeciesName = kv.Key;
                    text = text.Replace("{TalkingSpecies_" + kv.Key + "}", "");
                }
            }
        }

        if (!string.IsNullOrWhiteSpace(talkingSpeciesName))
        {
            GeoGroupInfo species = NatureController.Instance.AllGeoGroupInfo[talkingSpeciesName];

            text = text.Replace("@life", Mathf.RoundToInt(species.Life).ToString());
            text = text.Replace("@speed", Mathf.RoundToInt(species.Speed).ToString());
            text = text.Replace("@damage", Mathf.RoundToInt(species.Damage).ToString());
            text = text.Replace("@vision", Mathf.RoundToInt(species.Vision).ToString());
            text = text.Replace("@fertilityRate", Mathf.RoundToInt(species.FertilityRate) + "%");
            text = text.Replace("@matureSizePercent", Mathf.RoundToInt(species.MatureSizePercent) + "%");

            text = text.Replace("@diets", GetDescFromList(species.Diets.ToList()));
            text = text.Replace("@predators", GetDescFromList(species.Predators.ToList()));
        }

        QAPanel.GenerateText(text, TextBubble.Alignment.Left);
    }
Esempio n. 2
0
    private void LogResponseText(DF2Response response)
    {
        WaitingPanel.SetActive(false);

        Debug.Log(JsonConvert.SerializeObject(response, Formatting.Indented));
        Debug.Log(GetSessionName() + " said: \"" + response.queryResult.fulfillmentText + "\"");
        Debug.Log("Audio " + response.OutputAudio);

        chatbotText.text = response.queryResult.queryText + "\n";

        chatbotText.text += response.queryResult.fulfillmentText;


        byte[]    audioBytes = Convert.FromBase64String(response.OutputAudio);
        AudioClip clip       = WavUtility.ToAudioClip(audioBytes);

        audioPlayer.clip = clip;
        audioPlayer.Play();
    }
    private void LogResponseText(DF2Response response)
    {
        Debug.Log(JsonConvert.SerializeObject(response, Formatting.Indented));
        Debug.Log(name + " said: \"" + response.queryResult.fulfillmentText + "\"");
        chatbotText.text = response.queryResult.fulfillmentText;
        if (response.queryResult.intent["displayName"].Equals("fox-force-four"))
        {
            onFoxForceFour.Raise();
        }

        if (response.queryResult.intent["displayName"].Equals("horizontal-split"))
        {
            onHorizontalSplit.Raise();
        }

        if (response.queryResult.intent["displayName"].Equals("group-up"))
        {
            groupUp.Raise();
        }
    }
Esempio n. 4
0
 private void LogResponseText(DF2Response response)
 {
     Debug.Log(JsonConvert.SerializeObject(response, Formatting.Indented));
     Debug.Log(name + " said: \"" + response.queryResult.fulfillmentText + "\"");
     chatbotText.text = response.queryResult.fulfillmentText;
 }