///<summary> ///Force a cell to be visible by expanding all parent cells ///</summary> protected void ForceVisible(int index) { HierarchyCellData cell = hierarchy[index]; if (cell.parentIndex == -1) { return; } HierarchyCellData parent = hierarchy[cell.parentIndex]; parent.isCollapsed = false; ForceVisible(cell.parentIndex); }
///<summary> ///Check if a cell is visible in the hierarchy ///A cell can only be visible if any of its parent is collapsed ///</summary> protected bool IsVisible(int index) { HierarchyCellData cell = hierarchy[index]; if (cell.parentIndex == -1) { return(true); } HierarchyCellData parent = hierarchy[cell.parentIndex]; if (parent.isCollapsed) { return(false); } return(IsVisible(cell.parentIndex)); }
///<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; } }