Esempio n. 1
0
        void Refresh()
        {
            spellCount    = 0;
            contactsCount = 0;
            for (int i = 0; i < spellLst.Count; i++)
            {
                spellLst[i].gameObject.SetActive(false);
            }
            for (int i = 0; i < selectLst.Count; i++)
            {
                selectLst[i].gameObject.SetActive(false);
            }
            Dictionary <char, List <int> > nameDic = ChatManager.Instance.init2NameDic;
            float y = 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++)
                {
                    TransferSelectFriendItem 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
        TransferSelectFriendItem GetContacts()
        {
            TransferSelectFriendItem item = null;

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