同步操作将从 烟雨迷离半世殇/LoopScrollRect 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
This project works for Unity 5.2 or newer. I havn't tested older versions and any Pull Requests are welcomed.
These scripts help make your ScrollRect Reusable
, because it will only build cells when needed. If you have a large number of cells in a scroll rect, you absolutely need it! It will save a lot of time loading and draw call, along with memory in use, while still working smoothly.
中文说明请看这里。
Demo for Loop Scroll Rect. Each cell knows its own index, and it is able to modify its content/size/color easily.
Also ScrollBar is supported now! It supports both vertical & horizontal directions, back and forth.
Demo without mask. As you can see, the cells are only instantiated when needed and recycled.
New: Scroll to Index
The original idea comes from @ivomarel's InfinityScroll. After serveral refactorisations, I almost rewrite all the codes:
sizeDelta
directly since it doesn't always mean sizeAlso, I modified Easy Object Pool for recycling the cells.
My scripts copies ScrollRect
from UGUI rather than inherit ScrollRect
like InfinityScroll. I need to modify some private variants to make dragging smooth. All my codes is wrapped with comments like ==========LoopScrollRect==========
, making maintaining a little easier.
If you need scroll infinitely, you can simply set totalCount
to a negative number.
I've implemented a simple version with Coroutine
. You can use the following API:
public void SrollToCell(int index, float speed)
Here is a corner case unsolved yet: You can't jump to the last cells which cannot be pulled to the start.
These steps may be confusing, so you can just open the demo scene and copy & paste :D
You can also remove EasyObjPool and use your pool instead.
Layout Element
attached and preferred width/heightvoid ScrollCellIndex (int idx)
If you need scroll from top or left, setting content's pivot to 1 and disable ReverseDirection. Otherwise, you should set 0 to pivot and enable ReverseDirection (I have made VerticalScroll_Reverse
in the demo scene as reference).
I highly suggests you trying these parameters by hand. More details can be found in the demo scene.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。