private void MoveFrontNextCard(UISwipeableCard <TData, TContext> card, float rate) { var nextCard = cards.FirstOrDefault(c => c.DataIndex != card.DataIndex); if (nextCard == null) { return; } nextCard.UpdateScale(Mathf.Lerp(0.92f, 1f, rate)); }
void MoveToFrontNextCard(UISwipeableCard <TData, TContext> card, float rate) { var nextCard = _cards.FirstOrDefault(c => c.DataIndex != card.DataIndex); if (nextCard == null) { return; } var t = _viewData.CardAnimationCurve.Evaluate(rate); nextCard.UpdateScale(Mathf.Lerp(_viewData.BottomCardScale, 1f, t)); }
private void UpdateCard(UISwipeableCard <TData, TContext> card, int dataIndex) { // if data doesn't exist hide card if (dataIndex < 0 || dataIndex > data.Count - 1) { card.SetVisible(false); return; } card.SetVisible(true); card.DataIndex = dataIndex; card.UpdateContent(data[dataIndex]); }
void UpdateCard(UISwipeableCard <TData, TContext> card, int dataIndex) { IsAutoSwiping = false; ExistsCard = dataIndex != _data.Count + 1; // if data doesn't exist hide card if (dataIndex < 0 || dataIndex > _data.Count - 1) { card.SetVisible(false); return; } card.SetVisible(true); card.DataIndex = dataIndex; card.UpdateContent(_data[dataIndex]); }
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); }