예제 #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;
                }
            }
        }
예제 #2
0
        private RecentCardItem GetCard()
        {
            RecentCardItem item = null;

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