public void SnapToIndex(int newCellIndex, bool isToNext = true)
    {
        int maxIndex = CalculateMaxIndex();

        if (wrapAround && maxIndex > 0)
        {
            actualIndex += newCellIndex - cellIndex;
            cellIndex    = newCellIndex;
            onLerpComplete.AddListener(WrapElementAround);
        }
        else
        {
            newCellIndex = Mathf.Clamp(newCellIndex, 0, maxIndex);
            actualIndex += newCellIndex - cellIndex;
            cellIndex    = newCellIndex;
        }

        onRelease.Invoke(cellIndex);
        StartLerping();

        if (controllerDelegate != null)
        {
            this.controllerDelegate.UpdatePieChart(cellIndex, true, isToNext);
        }
    }
Example #2
0
    /// <summary>
    /// 해당 인덱스로 Content 포지션을 Snap 이동시킨다.
    /// </summary>
    public void SnapToIndex(int newCellIndex)
    {
        int maxIndex = CalculateMaxIndex();

        if (m_WarpAround && maxIndex > 0)
        {
            m_ActualCellIndex += newCellIndex - m_CellIndex;
            m_CellIndex        = newCellIndex;
            onLerpComplete.AddListener(WrapElementAround);
        }
        else
        {
            // when it's the same it means it tried to go out of bounds
            if (newCellIndex >= 0 && newCellIndex <= maxIndex)
            {
                m_ActualCellIndex += newCellIndex - m_CellIndex;
                m_CellIndex        = newCellIndex;
            }
        }

        // 사용하지 않는 이벤트
        //onRelease.Invoke(m_CellIndex);

        StartLerping();
    }
Example #3
0
    public void SnapToIndex(int newCellIndex)
    {
        int maxIndex = CalculateMaxIndex();

        if (wrapAround && maxIndex > 0)
        {
            actualIndex += newCellIndex - cellIndex;
            cellIndex    = newCellIndex;
            onLerpComplete.AddListener(WrapElementAround);
        }
        else
        {
            newCellIndex = Mathf.Clamp(newCellIndex, 0, maxIndex);
            actualIndex += newCellIndex - cellIndex;
            cellIndex    = newCellIndex;
        }
        onRelease.Invoke(cellIndex);
        StartLerping();
    }