Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions Assets/ReuseScroller/Scripts/BaseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ protected override void OnValidate() {
base.OnValidate();
if (cellObject && !cellObject.GetComponent<BaseCell<T>>()) {
cellObject = null;
Debug.LogWarning("指定的 cellTemplate 不包含BaseCell 的实现类!");
}
}

Expand Down Expand Up @@ -180,10 +181,14 @@ private void UpdateCells() {
}

private void FillCells() {
if (cells.Count == 0) CreateCell(0);

while (CellsTailEdge + spacing <= ActiveTailEdge) {
CreateCell(cells.Last.Value.dataIndex + 1);
if (cellData.Count > 0)
{
if (cells.Count == 0) CreateCell(0);
while (CellsTailEdge + spacing <= ActiveTailEdge)
{
if (cells.Last.Value.dataIndex == cellData.Count - 1) break; //数据量够了
CreateCell(cells.Last.Value.dataIndex + 1);
}
}
}

Expand Down