Пример #1
0
        bool NeedPull(FTNodeBase cell)
        {
            if (activeCells.IndexOf(cell) == 0)
            {
                var d1 = direction == FTDirection.Vertical ?
                         cell.AnchoredPosition.y - cell.Height - spacing + ContentTrans.anchoredPosition.y :
                         cell.AnchoredPosition.x - cell.Width - spacing + ContentTrans.anchoredPosition.x;
                if (d1 > 0.01f)
                {
                    return(true);
                }
            }

            var d2 = direction == FTDirection.Vertical ?
                     cell.AnchoredPosition.y + ContentTrans.anchoredPosition.y :
                     cell.AnchoredPosition.x + ContentTrans.anchoredPosition.x;
            var d3 = direction == FTDirection.Vertical ? -ViewPortTrans.sizeDelta.y : -ViewPortTrans.sizeDelta.x;

            if (d2 < d3 - 0.01f)
            {
                return(true);
            }

            if (cell.dataIndex >= cellCount)
            {
                return(true);
            }

            return(false);
        }
Пример #2
0
 protected void OnInstantiateCell(FTNodeBase cell)
 {
     InitAction?.Invoke(cell);
     cells.Add(cell);
 }
Пример #3
0
 void Pool(FTNodeBase cell)
 {
     activeCells.Remove(cell);
     cell.gameObject.SetActive(false);
     cellPool.Push(cell);
 }