items拖拽到底部的时候,自动从顶部再次开始!!!!
下面方法直接就实现了。 还有左右btn切也可以实现。
private Vector3 lastScrollTargetpos = Vector3.zero;
private UIScrollView scrollRole;
private void OnBtnLeft()
{
if (lastScrollTargetpos == Vector3.zero)
lastScrollTargetpos = scrollRole.panel.cachedTransform.localPosition;
Vector3 targetPos = lastScrollTargetpos + new Vector3(-260f, 0, 0);
SpringPanel.Begin(scrollRole.panel.cachedGameObject, targetPos, 6f);
lastScrollTargetpos = targetPos;
}
private void OnBtnRight()
{
if (lastScrollTargetpos == Vector3.zero)
lastScrollTargetpos = scrollRole.panel.cachedTransform.localPosition;
Vector3 targetPos = lastScrollTargetpos + new Vector3(260f, 0, 0);
SpringPanel.Begin(scrollRole.panel.cachedGameObject, targetPos, 6f);
lastScrollTargetpos = targetPos;
}