예제 #1
0
    // For each contact call the contact creation method
    // Temporary function for hard coded values
    public LContact CreateContact(LDataController data, LStoryController story, LContact contact, float scale = 1f)
    {
        this.data  = data;
        this.story = story;
        if (this.story.TryLoadConversation(contact.Name, out conversation) || (conversation != null && !conversation.HasBegun))
        {
            checkToDisplayMostRecentMessageSnippet();
        }
        else
        {
            conversation = new LConversation(contact.Name, contact, story.Player);
            this.story.TrackConversation(conversation);
        }
        checkToRunInit();
        instanceOfContact.ContactID   = contact.ContactID;
        instanceOfContact.ContactName = contact.ContactName;
        instanceOfContact.NumberOfMessagesRecieved = contact.NumberOfMessagesRecieved;
        instanceOfContact.NumberOfMessagesSent     = contact.NumberOfMessagesSent;
        instanceOfContact.SpriteContactImage       = contact.SpriteContactImage;
        instanceOfContact.BoolIsMessageUnread      = contact.BoolIsMessageUnread;
        instanceOfContact.BoolIsContact            = contact.BoolIsContact;
        AssignNameAndImage();
        transform.localScale = new Vector3(scale, scale, scale);
        Vector3 inverseScale = new Vector3(1f / scale, 1f / scale, 1f / scale);

        ContactImage.transform.localScale       = inverseScale;
        ContactName.transform.localScale        = inverseScale;
        UnreadMessageCount.transform.localScale = inverseScale;
        messageSnippet.transform.localScale     = inverseScale;


        //sets the size of the contact boxes
        RectTransform canvasSize = transform.parent.parent.parent.parent.GetComponent <RectTransform> ();        //haha this gets the Phone Screen Panel
        float         h          = canvasSize.rect.height;
        float         w          = canvasSize.rect.width;
        LayoutElement layout     = GetComponent <LayoutElement> ();

        layout.minHeight       = h / (scale * 7);
        layout.preferredHeight = h / (scale * 7);
        layout.minWidth        = w / scale;
        layout.preferredWidth  = w / scale;

        RectTransform maskRect = contactImageMask.GetComponent <RectTransform> ();

        maskRect.anchorMin = new Vector2(0.15f, 0.5f);
        maskRect.anchorMax = new Vector2(0.15f, 0.5f);
        maskRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 150 * (h / 1323));
        maskRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 150 * (h / 1323));

        RectTransform snipRect = messageSnippet.gameObject.GetComponent <RectTransform> ();

        snipRect.anchorMin = new Vector2(0.65f, 0.35f);
        snipRect.anchorMax = new Vector2(0.65f, 0.35f);


        GetComponentInParent <VerticalLayoutGroup> ().spacing = h / (scale * 3);

        return(instanceOfContact);
    }
예제 #2
0
    void untrackConversation(LConversation conversation)
    {
        LConversation tracked = activeConversations.Find(convo => convo.ID.Equals(conversation.ID));

        if (tracked != null)
        {
            activeConversations.Remove(tracked);
        }
    }
예제 #3
0
 public void TrackConversation(LConversation conversation)
 {
     // Remove any previous iterations of the conversation
     untrackConversation(conversation);
     activeConversations.Add(conversation);
     if (data)
     {
         data.Save();
     }
 }
예제 #4
0
 // Checks for whether all the conversations for the day have been complete
 public bool ReadyToAdvanceDayPhase()
 {
     foreach (LContact contact in characters.IContacts.Elements)
     {
         // Some contacts do not have any messages during certain day phases
         if (messaging.HasConversationForContactAtTime(contact))
         {
             LConversation conversation = activeConversations.Find(convo => convo.ID.Equals(contact.Name));
             // Case: Conversation not yet begun or not yet complete
             if (conversation == null || !conversation.CheckIsComplete())
             {
                 return(false);
             }
         }
     }
     return(true);
 }
    IEnumerator NPCRespondDelayed(LConversation conversation, LText response)
    {
        yield return(new WaitForSeconds(NPCResponseDelay));

        EventController.Event(LEvent.Message);
        if (isContactsOpen)
        {
            conversation.AddMessage(response);
        }
        else
        {
            AddText(response);
            DisplayResponses(mostRecentMessage);
        }
        // Refreshes the display for the current contact:
        currentContact.Refresh();
        data.Save();
    }
    public new void LoadHome()
    {
        bool contacts = LMessengerScreenController.isContactsOpen;

        Contact[]       list  = GetComponentsInChildren <Contact> (true);
        bool[]          notes = new bool[list.Length];
        LConversation[] convs = new LConversation[list.Length];
        int             i     = 0;

        foreach (Contact c in list)
        {
            LContact lc = c.getContact();
            notes [i] = lc.BoolIsMessageUnread;
            convs [i] = c.conversation;
            i++;
        }
        LMessenger.set(contacts, notes, convs, currentContact);
        //LMessenger.first = false;
        base.LoadHome();
    }
예제 #7
0
 public bool IsTrackingConversation(LConversation conversation)
 {
     return(activeConversations.Find(convo => convo.ID.Equals(conversation.ID)) != null);
 }
예제 #8
0
 public bool TryLoadConversation(string conversationID, out LConversation convo)
 {
     convo = activeConversations.Find(conversation => conversation.ID.Equals(conversationID));
     return(convo != null);
 }