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); } }
public void ScrollTo(Object data) { ScrollDataElement elem = datas.Find((e) => (Object)e.data == data); if (null != elem) { ScrollTo(datas.IndexOf(elem)); } }
/// <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); }
protected abstract bool CheckItemShow(ScrollDataElement dataElem);
protected override bool CheckItemShow(ScrollDataElement dataElem) { return(false); }