Esempio n. 1
0
        public void reloadData()
        {
            if (_cellsUsed.Count > 0)
            {
                for (int i = 0; i < _cellsUsed.Count; i++)
                {
                    LGridViewCell cell = _cellsUsed[i];
                    _cellsFreed.Add(cell);
                    cell.reset();
                    cell.node.SetActive(false);
                }
                _cellsUsed.Clear();
            }

            Transform tran = transform.Find("container/cell_tpl");

            if (tran != null)
            {
                tran.gameObject.SetActive(false);
            }
            try {
                _indices.Clear();
                _positions.Clear();
                updatePositions();
                setContentOffsetToTop();
                onScrolling();
            }
            catch (Exception e) {
                Debug.Log(e);
            }

            relocateContainer();
        }
Esempio n. 2
0
        public void reloadData()
        {
            if (cellsUsed.Count > 0)
            {
                LGridViewCell cell = cellsUsed [0];
                while (cell != null)
                {
                    cellsFreed.Add(cell);
                    cellsUsed.Remove(cell);
                    cell.node.transform.SetParent(null);
                    cell.reset();
                }
            }
            indices.Clear();
            positions.Clear();
            updatePositions();
            setContentOffsetToTop();
            onScrolling();

            relocateContainer();
        }
Esempio n. 3
0
        public void reloadData()
        {
            if (_cellsUsed.Count > 0)
            {
                for (int i = 0; i < _cellsUsed.Count; i++)
                {
                    LGridViewCell cell = _cellsUsed[i];
                    _cellsFreed.Add(cell);
                    cell.reset();
                    cell.node.SetActive(false);
                }
                _cellsUsed.Clear();
            }
            _indices.Clear();
            _positions.Clear();
            updatePositions();
            setContentOffsetToTop();
            onScrolling();

            relocateContainer();
        }
Esempio n. 4
0
        protected override void onScrolling()
        {
            base.onScrolling();

            int beginRow = 0, endRow = 0;

            beginRow = cellBeginRowFromOffset(getContentOffset());
            endRow   = cellEndRowFromOffset(getContentOffset());

            while (_cellsUsed.Count > 0)
            {
                LGridViewCell cell = _cellsUsed[0];
                int           row  = cell.row;
                int           idx  = cell.idx;

                if (row < beginRow)
                {
                    _indices.Remove(idx);
                    _cellsUsed.Remove(cell);
                    _cellsFreed.Add(cell);
                    cell.reset();
                    //cell.node.transform.SetParent(null);
                    cell.node.SetActive(false);
                }
                else
                {
                    break;
                }
            }

            while (_cellsUsed.Count > 0)
            {
                LGridViewCell cell = _cellsUsed[_cellsUsed.Count - 1];
                int           row  = cell.row;
                int           idx  = cell.idx;

                if (row > endRow && row < _rows)
                {
                    _indices.Remove(idx);
                    _cellsUsed.Remove(cell);
                    _cellsFreed.Add(cell);
                    cell.reset();
                    //cell.node.transform.SetParent(null);
                    cell.node.SetActive(false);
                }
                else
                {
                    break;
                }
            }

            for (int row = beginRow; row <= endRow && row < _rows; ++row)
            {
                int cellBeginIndex = cellFirstIndexFromRow(row);
                int cellEndIndex   = cellBeginIndex + cols;

                for (int idx = cellBeginIndex; idx < cellEndIndex && idx < cellsCount; ++idx)
                {
                    if (_indices.ContainsKey(idx))
                    {
                        continue;
                    }
                    updateCellAtIndex(idx, row);
                }
            }
        }