public void SortListPokerInHand(bool isSortFromCurrentPos = false) { int pokerCount = _listPokerInHand.Count; Vector2 size = _pokerHandParent.GetComponent <BoxCollider2D> ().size; float startX = -size.x / 2f; float startY = 0f; float gapx = 0f; _deck.GetRule().SortPokerList(_listPokerInHand); for (int i = 0; i < pokerCount; i++) { BigTwoPoker poker = _listPokerInHand [i]; poker.transform.localScale = Vector3.one * size.y / poker.transform.GetComponent <BoxCollider2D> ().size.y; if (i == 0) { float width = poker.transform.GetComponent <BoxCollider2D> ().size.x *poker.transform.localScale.x; if (_isOverlap) { startX = 0; gapx = 0f; } else { startX += width / 2; gapx = (size.x - width) / (pokerCount - 1); if (gapx > width) { gapx = width; startX = startX + size.x / 2 - gapx * (pokerCount / 2 + 0.5f); } } } float toX = startX + gapx * i; if (false == isSortFromCurrentPos) { poker.transform.localPosition = new Vector3(toX, startY, pokerCount - i); if (_isShowFace && !_isOverlap) { poker.transform.DOLocalMoveX(0f, Math.Abs(toX / 1.3f)).From().SetEase(Ease.Linear); } } else { if (_isShowFace && !_isOverlap) { poker.transform.DOLocalMoveX(toX, 0.5f).SetEase(Ease.Linear); } } poker.SetBackVisible(!_isShowFace); } _listCountText.UpdateNumber(_listPokerInHand.Count); }