public void switchToMessages(Contact contact)
 {
     setAppTitle(contact);
     messageScrollView.SetActive(true);
     contactList.SetActive(false);
     messagePanel.SetActive(true);
     initializeMessagePanel(contact);
     currentContact      = contact;
     isContactsOpen      = false;
     currentConversation = messaging.GetConversation(contact.getContact());
     if (currentConversation != null)
     {
         ClearAllTexts();
         AddTexts(false, contact.conversation.messages.ToArray());
         if (!contact.conversation.HasBegun)
         {
             AddText(currentConversation.GetFirstMessage().Value);
             currentContact.Refresh();
         }
         if (mostRecentMessage != null && mostRecentMessage.Responses != null && mostRecentMessage.Responses.Length > 0)
         {
             DisplayResponses(mostRecentMessage);
         }
     }
 }
Пример #2
0
    public void CreateConversationGraph()
    {
        List <LText> allTexts = new List <LText>(this.Elements);
        Dictionary <LText, LText[]> responses = new Dictionary <LText, LText[]>();

        foreach (LText text in allTexts)
        {
            string[]     responseIds       = text.Responses;
            List <LText> matchingResponses = allTexts.FindAll(response => ArrayUtil.Contains <string>(responseIds, response.ID));
            responses.Add(text, matchingResponses.ToArray());
        }
        Dictionary <LText, LGraphNode <LText> > textNodes = new Dictionary <LText, LGraphNode <LText> >();

        foreach (LText text in responses.Keys)
        {
            textNodes.Add(text, new LGraphNode <LText>(text));
        }
        foreach (LText text in responses.Keys)
        {
            foreach (LText response in responses.Keys)
            {
                if (text.Responses.Contains(response.ID))
                {
                    textNodes[text].AddNeighbour(textNodes[response]);
                }
            }
        }
        Conversation = new LConversationGraph(textNodes.Values.ToArray());
    }