Ejemplo n.º 1
0
        private void Refresh()
        {
            _titleCount = 0;
            _cardsCount = 0;
            int i = 0;

            for (; i < _cardsList.Count; i++)
            {
                _cardsList[i].gameObject.SetActive(false);
            }
            i = 0;
            for (; i < _titleList.Count; i++)
            {
                _titleList[i].gameObject.SetActive(false);
            }
            float y = 0f;
            List <BankCardSaveData> cardList = AssetsManager.Instance.GetRecentTransCardList();

            if (cardList.Count > 0)
            {
                RecentCardTitleItem titleItem = GetTitle();
                titleItem.SetData(ContentHelper.Read(ContentHelper.HistoryCard));
                titleItem.cachedRectTransform.anchoredPosition = new Vector2(0.0f, y);
                titleItem.gameObject.SetActive(true);
                y -= titleItem.height;
                for (i = 0; i < cardList.Count; i++)
                {
                    RecentCardItem cardItem = GetCard();
                    cardItem.SetData(cardList[i]);
                    cardItem.cachedRectTransform.anchoredPosition = new Vector2(0.0f, y);
                    cardItem.gameObject.SetActive(true);
                    y -= cardItem.height;
                }
            }
            cardList = AssetsManager.Instance.bankCardsData;
            if (cardList.Count > 0)
            {
                RecentCardTitleItem titleItem = GetTitle();
                titleItem.SetData(ContentHelper.Read(ContentHelper.SelfText));
                titleItem.cachedRectTransform.anchoredPosition = new Vector2(0.0f, y);
                titleItem.gameObject.SetActive(true);
                y -= titleItem.height;
                for (i = 0; i < cardList.Count; i++)
                {
                    RecentCardItem cardItem = GetCard();
                    cardItem.SetData(cardList[i]);
                    cardItem.cachedRectTransform.anchoredPosition = new Vector2(0.0f, y);
                    cardItem.gameObject.SetActive(true);
                    y -= cardItem.height;
                }
            }
        }
Ejemplo n.º 2
0
        private RecentCardTitleItem GetTitle()
        {
            RecentCardTitleItem item = null;

            if (_titleList.Count > _titleCount)
            {
                item = _titleList[_titleCount];
            }
            else
            {
                item = Instantiate(_titlePerfab);
                item.cachedRectTransform.SetParent(_content);
                item.cachedRectTransform.localScale       = Vector3.one;
                item.cachedRectTransform.anchoredPosition = Vector2.zero;
                _titleList.Add(item);
            }
            _titleCount++;
            return(item);
        }