//首页左右滑动按钮
//点击按钮右移
public void Content_RR()
{
if (Content2.transform.localPosition.x <= 0 && Content2.transform.localPosition.x > -1047)
{
Content2.transform.DOLocalMove(new Vector3(Content2.transform.localPosition.x - 300, 0, 0), 0.5f).OnComplete(() =>
{
});
}
else if (Content2.transform.localPosition.x <= -1047)
{
Content2.transform.DOLocalMove(new Vector3(-1047, 0, 0), 0.5f).OnComplete(() =>
{
});
}
StartCoroutine(DelayReleaseButtons());
}
//点击按钮左移
public void Content_LL()
{
if (Content2.transform.localPosition.x >= -1047 && Content2.transform.localPosition.x < -300)
{
Content2.transform.DOLocalMove(new Vector3(Content2.transform.localPosition.x + 300, 0, 0), 0.5f).OnComplete(() =>
{
});
}
else if (Content2.transform.localPosition.x >= -300)
{
Content2.transform.DOLocalMove(new Vector3(0, 0, 0), 0.5f).OnComplete(() =>
{
});
}
StartCoroutine(DelayReleaseButtons());
}
通过左右按钮实现滑动
最新推荐文章于 2024-09-03 13:59:40 发布