示例#1
0
        ///<summary>
        ///Call all cells to take action when the viewport scroll slow enough
        ///Useful for example for loading texture in cells which is slow
        ///</summary>
        protected void LoadCellsFully()
        {
            if (activeCells == null)
            {
                return;
            }
            foreach (RectTransform cell in activeCells)
            {
                HierarchyCellData cellData = cell.GetComponent <CellBase>().hierarchyData;
                if (cellData.isFullyLoaded)
                {
                    continue;
                }

                CellDataBase data = dataSource[cellData.indexFlat];
                cell.GetComponent <CellBase>().SetCellDataFully(data);
                cellData.isFullyLoaded = true;
            }
        }
示例#2
0
        ///<summary>
        ///Add cell to cells list along with their children
        ///</summary>
        private void AddCell(CellDataBase cellData, int parent = -1, int indent = 0)
        {
            int index = dataSource.Count;

            dataSource.Add(cellData);
            hierarchy.Add(new HierarchyCellData {
                prefabName    = cellData.prefab.name,
                isCollapsed   = false,
                parentIndex   = parent,
                indentDepth   = indent,
                indexFlat     = index,
                isFullyLoaded = false
            });

            resourceManager.InitPool(cellData.prefab, CellPoolSize);

            if (cellData.children != null)
            {
                foreach (CellDataBase child in cellData.children)
                {
                    AddCell(child, index, indent + 1);
                }
            }
        }
示例#3
0
 protected abstract IEnumerator LoadCellFullyCoroutine(CellDataBase cellData);
示例#4
0
 ///<summary>
 ///Finalize cell loading. Called when player scrolls slower than a set threshold for a set duration of time
 ///Intended for costly processes such as loading image texture
 ///</summary>
 public void SetCellDataFully(CellDataBase cellData)
 {
     StartCoroutine(LoadCellFullyCoroutine(cellData));
 }
示例#5
0
 ///<summary>
 ///Add data to cell. Called whenever cell goes into viewport
 ///</summary>
 public abstract void SetCellData(CellDataBase cellData);