Beispiel #1
0
        protected void UpdateCardPosition(UISwipeableCard <TData, TContext> card)
        {
            // move to the back
            card.transform.SetAsFirstSibling();
            card.UpdatePosition(Vector3.zero);
            card.UpdateRotation(Vector3.zero);
            card.UpdateScale(transform.childCount == 1 ? 1f : 0.92f);

            var swipeTarget = transform.childCount == 1 ? card.gameObject : transform.GetChild(1).gameObject;

            swiper.SetCard(swipeTarget);
            // When there are three or more data,
            // Replace card index with the seconde index from here.
            int index = cards.Count < 2 ? card.DataIndex : card.DataIndex + 2;

            UpdateCard(card, index);
        }
        void UpdateCardPosition(UISwipeableCard <TData, TContext> card)
        {
            // move to the back
            card.transform.SetAsFirstSibling();
            card.UpdatePosition(Vector3.zero);
            card.UpdateRotation(Vector3.zero);

            var childCount = transform.childCount;

            card.UpdateScale(childCount == 1 ? 1f : _viewData.BottomCardScale);

            var target = childCount == 1 ? card.gameObject : transform.GetChild(1).gameObject;

            _swiper.SetTarget(target, target.GetComponent <ISwipeable>());

            // When there are three or more data,
            // Replace card index with the seconde index from here.
            int index = _cards.Count < 2 ? card.DataIndex : card.DataIndex + 2;

            UpdateCard(card, index);
        }