Esempio n. 1
0
 public void LoadConversationFile(ConversationJSON convo)
 {
     m_currentConversation = convo;
     if (m_currentConversation != null)
     {
         Debug.Log("Loaded Conversation: " + m_currentConversation.conversationId);
     }
 }
Esempio n. 2
0
 public void LoadConversationById(string convoId)
 {
     m_currentConversation = ConversationManager.instance.GetConversationById(convoId);
     if (m_currentConversation != null)
     {
         Debug.Log("Loaded Conversation: " + m_currentConversation.conversationId);
     }
 }
Esempio n. 3
0
    public static ConversationJSON CreateFromJSON(string conversationStr)
    {
        // Debug.Log("Convo Str: " + conversationStr);
        JSONNode         node             = JSON.Parse(conversationStr);
        ConversationJSON conversationJSON = JsonUtility.FromJson <ConversationJSON>(node.ToString());

        conversationJSON.conversationTree = ConversationTreeJSON.CreateFromJSON(node["conversationTree"].ToString());
        return(conversationJSON);
    }
Esempio n. 4
0
    public void LoadConversationResources()
    {
        conversationFilesById = new Dictionary <string, ConversationJSON>();

        TextAsset[] conversationFileAssets = Resources.LoadAll <TextAsset>(conversationFilePath);
        // Debug.Log("Number of Conversation Assets: " + conversationFileAssets.Length);
        foreach (TextAsset conversationAsset in conversationFileAssets)
        {
            // Debug.Log("Conversation text asset: " + conversationAsset.text);
            ConversationJSON conversation = ConversationJSON.CreateFromJSON(conversationAsset.text);
            if (conversation != null)
            {
                // Debug.Log("Conversation: " + conversation.GetFieldValues());
                conversationFilesById.Add(conversation.conversationId, conversation);
            }
        }
        Debug.Log("Loaded: " + conversationFilesById.Keys.Count + " Conversations");
    }