Esempio n. 1
0
        void Refresh()
        {
            requestRedPoint.SetActive(ChatManager.Instance.HasRequestToHandle());
            spellCount    = 0;
            contactsCount = 0;
            for (int i = 0; i < spellLst.Count; i++)
            {
                spellLst[i].gameObject.SetActive(false);
            }
            for (int i = 0; i < contactsLst.Count; i++)
            {
                contactsLst[i].gameObject.SetActive(false);
            }
            Dictionary <char, List <int> > nameDic = ChatManager.Instance.init2NameDic;
            float y = -158.0f;

            for (int i = 0; i < 27; i++)
            {
                List <int> friends;
                if (i == 26)
                {
                    friends = nameDic['#'];
                }
                else
                {
                    friends = nameDic[(char)(65 + i)];
                }
                if (friends.Count == 0)
                {
                    continue;
                }
                SpellItem item = GetSpell();
                item.SetData(((char)(65 + i)).ToString());
                item.cachedRectTransform.anchoredPosition = new Vector2(0.0f, y);
                item.gameObject.SetActive(true);
                y -= item.height;
                for (int m = 0; m < friends.Count; m++)
                {
                    ContactsItem itemc = GetContacts();
                    itemc.SetData(XMLSaver.saveData.GetAccountData(friends[m]));
                    itemc.cachedRectTransform.anchoredPosition = new Vector2(0.0f, y);
                    itemc.gameObject.SetActive(true);
                    y -= itemc.height;
                }
            }
        }
Esempio n. 2
0
        ContactsItem GetContacts()
        {
            ContactsItem item = null;

            if (contactsLst.Count > contactsCount)
            {
                item = contactsLst[contactsCount];
            }
            else
            {
                item = Instantiate(contactsPrefab);
                item.cachedRectTransform.SetParent(content);
                item.cachedRectTransform.localScale       = Vector3.one;
                item.cachedRectTransform.anchoredPosition = Vector2.zero;
                contactsLst.Add(item);
            }
            contactsCount++;
            return(item);
        }