Beispiel #1
0
        public void updateCellAtIndex(int idx, int row)
        {
            if (cellsCount == 0)
            {
                return;
            }

            LGridViewCell cell = _onDataSourceAdapterHandler(dequeueCell(), idx);

            cell.idx = idx;
            cell.row = row;
            RectTransform rtran = cell.node.GetComponent <RectTransform>();

            rtran.pivot     = new Vector2(0, 1);
            rtran.sizeDelta = cellsSize;
            cell.node.SetActive(true);
            cell.node.transform.SetParent(container.transform);
            cell.node.transform.localPosition = cellPositionFromIndex(idx);
            cell.node.transform.localScale    = new Vector3(1, 1, 1);
            insertSortableCell(cell, idx);

            //新抽象出来的Item接口
            IListItem item = rtran.GetComponent <IListItem>();

            if (item != null)
            {
                item.Init(idx);
                item.OnRefresh();
            }

            _indices.Add(idx, 1);
        }