예제 #1
0
    public virtual void SetData(IEnumerable incomeDatas)
    {
        if (null == datas)
        {
            datas = new List <ScrollDataElement>();
        }
        else
        {
            datas.Clear();
        }
        IEnumerator enumerator = incomeDatas.GetEnumerator();

        while (enumerator.MoveNext())
        {
            ScrollDataElement elem = new ScrollDataElement()
            {
                data = enumerator.Current
            };
            datas.Add(elem);
        }

        CalculateSize();
        if (elemReuse)
        {
            ScrollListElemReuse reuse = gameObject.AddComponent <ScrollListElemReuse>();
            scroll.onValueChanged.AddListener(reuse.CalculateReuse);
        }
    }
예제 #2
0
    public void ScrollTo(Object data)
    {
        ScrollDataElement elem = datas.Find((e) => (Object)e.data == data);

        if (null != elem)
        {
            ScrollTo(datas.IndexOf(elem));
        }
    }
예제 #3
0
    /// <summary>
    /// 移除一条数据
    /// </summary>
    /// <param name="data">要移除的数据</param>
    public virtual void RemoveData(Object data)
    {
        ScrollDataElement elem = datas.Find((e) => (Object)e.data == data);

        if (null != elem)
        {
            RemoveDataAt(datas.IndexOf(elem));
        }
    }
    protected override bool CheckItemShow(ScrollDataElement dataElem)
    {
        ///TODO


        float parentY = container.anchoredPosition.y;

        return(Mathf.Abs(dataElem.pos.y + parentY) < viewPort.rect.height * 1.5f);
    }
예제 #5
0
 protected abstract bool CheckItemShow(ScrollDataElement dataElem);
예제 #6
0
 protected override bool CheckItemShow(ScrollDataElement dataElem)
 {
     return(false);
 }