Example #1
0
        private void UpdateCells(int startIndex, int endIndex)
        {
            int length = _showGo.Count;

            for (int i = length - 1; i >= 0; i--)
            {
                ScrollCellItem item  = _showGo[i];
                int            index = item.GetIndex();
                if (index >= startIndex && index <= endIndex)
                {
                    continue;
                }

                _contains.Remove(index);
                Push(item);
                //Debug.Log("移除:" + index);
            }

            for (int i = startIndex; i <= endIndex; i++)
            {
                if (_contains.Contains(i))
                {
                    continue;
                }
                ScrollCellItem item = Pop();
                System.Object  data = _datas[i];
                item.SetPos(GetPos(i));
                item.SetData(data, i);
                _contains.Add(i);
                //Debug.Log("添加:" + i);
            }
        }
Example #2
0
        public void UpdateItemAt(int index, System.Object data)
        {
            _datas[index] = data;
            int length = _showGo.Count;

            for (int i = length - 1; i >= 0; i--)
            {
                ScrollCellItem item      = _showGo[i];
                int            showIndex = item.GetIndex();
                if (showIndex != index)
                {
                    continue;
                }
                item.SetData(data, index);
            }
        }