示例#1
0
    /// <summary>
    /// 尝试补足拖拽
    /// </summary>
    private void TrySupplementDrag(Vector2 pDragPosOffset, float pDragTimeOffset)
    {
        if (mEnalbDragSupplement == false)
        {
            return;
        }

        SupplementType tSupplementType         = GetDragSupplementType(pDragPosOffset, pDragTimeOffset);
        int            tMaxDragSupplementIndex = mGridArrangeBase.GetMaxDragSupplementIndex();

        int tDragSupplementIndex = mDragSupplementIndex;

        switch (tSupplementType)
        {
        case SupplementType.Ceil:
            tDragSupplementIndex = Mathf.Min(tMaxDragSupplementIndex, tDragSupplementIndex + 1);
            break;

        case SupplementType.Floor:
            tDragSupplementIndex = Mathf.Max(0, tDragSupplementIndex - 1);
            break;
        }

        mDragSupplementIndex = tDragSupplementIndex;

        Vector2 tTargetPos = mGridArrangeBase.GetDragSupplemnetAnchorPos(mDragSupplementIndex);

        StartScrollToTargetPos(tTargetPos, mDrageSupplementVelocity);
    }