LoopScrollRect 是基于 UGUI 的一个用来代替 ScrollRect 的插件,其特点是:不同于原生的 ScrollRect,LoopScrollRect 会根据 Viewport 的大小来加载子元素,比如说我们的总数据条目是 500 条,但 Viewport 只显示得下十来个 cell,这时候 LoopScrollRect 就不会傻傻地生成全部 500 个
循环滑动组件可以认为是原有滑动组件的增强组件,需要把新增的 LoopHorizontalScrollRect,或者是 LoopVerticalScrollRect,添加到对应位置,代替原有的 ScrollRect。以我们上面的例子举例,先需要把原有 UI 进行下改造,把 Content 下的 Cell 节点保存成单独的预制体,并且删除原有的所有 Cell。
循环滑动组件可以认为是原有滑动组件的增强组件,需要把新增的 LoopHorizontalScrollRect,或者是 LoopVerticalScrollRect,添加到对应位置,代替原有的 ScrollRect。 以我们上面的例子举例,先需要把原有 UI 进行下改造,把 Content 下的 Cell 节点保存成单独的预制体,并且删除原有的所有 Cell。 我们这里是垂直方向,所以选...
一、在预制上挂LoopScrollRect组件 二、导出节点 三、lua层注册调用接口InitLoop,初始化组件,注册滑动事件 self.Scroll:InitLoop(childItems,0,giftNum,handler(self,self.OnRefreshGiftItem),toTop) 四、滑动事件回调会将现有item对象数据初始化, 并且在每次滑动的时候回调事件,初始化item, 回调传回的参数是对象索...
private ScrollRect m_ScrollRect; private RectTransform m_Rect; public int InstantiateCount { get { return (int)InstantiateSize.x * (int)InstantiateSize.y; } } protected override void Awake() { m_ScrollRect = GetComponentInParent<ScrollRect>(); m_ScrollRect.horizontal = direction == Direction...
+ Support Infinity Vertical Looping(Top To Down, Bottom To Up). + Support Infinity Horizontal Looping(Left to Right, Right To Left). Feel free to contact me if you have any problem. Report this asset UGUI Circle Loop Scroll Rect
优化支持横竖屏的ScrollRect吸附功能 using System.Collections.Generic; using DG.Tweening; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; namespace Mga { public enum DragDirection { Horizontal, Vertical, } public class CFixGridRectBase : MonoBehaviour, IEndDragHandler { public...
创建一个Scrobar,将建好的Scrobar拖入Image图片中ScrollRect组件中的HorizontalScrollbar也可把滚动条竖立起来。 选择男女,只选一个 创建一个空物体,给空物体添加ToggleGrounp组件,在空物体中创建两个Toggle,修改Lable可修改显示的内容,Background可修改按键背景颜色,Checkmark可把对勾修改成其他标识。
- Horizontal ListView (Left To Right, Right To Left) - Item padding - Scroll to an item with an offset - Item count changed at runtime - Item size (height/width) changed at runtime - Item snapped to any position in viewport - Item loop such as spinner ...
首先需要搭建ScrollView的UI用来测试。新建一个场景,如果场景中没有Canvas就新建一个,然后在Canvas下新建一个Scroll View。 接下来要对列表做一些重要设置: 1.选中ScrollRect组件所在的物体,取消勾选Horizontal以禁用水平滚动,将Scroll Sensitivity设为50使得鼠标滚轮滑动更灵敏。