// 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); }
void InstantiateContact(LContact contact) { // Create a contact with the above information GameObject aContact = Instantiate(Contact, new Vector3(0f, 0f, 0f), Quaternion.identity) as GameObject; aContact.transform.SetParent(gameObject.transform); aContact.GetComponent <Contact>().AssignNameAndImage(); aContact.GetComponent <Contact>().CreateContact(this.data, this.story, contact, ContactSize); }
public LConversationGraph GetConversation(LContact contact) { LTextGroup group; if (allConversations.TryGetValue(getConversationName(contact), out group)) { return(group.Conversation); } else { return(null); } }
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(); }
// Checks against the current time public bool HasConversationForContactAtTime(LContact contact) { return(GetConversation(contact) != null); }
string getConversationName(LContact contact) { LTime time = story.CurrentTime; return(string.Format("{0}{4}{1}{2}{4}{3}", contact.ContactName, LTime.DAY, time.Day, time.Phase, JOIN_CHAR)); }