public void InitRowsCache(int cacheSize, List <ScoreTableRowIndicator> rowIndicators) { for (int i = 0; i < cacheSize; i++) { ScoreTableRowComponent item = Instantiate <ScoreTableRowComponent>(this.rowPrefab); item.AddIndicators(rowIndicators); item.gameObject.SetActive(false); this.rowsCache.Enqueue(item); } this.rowIndicators = rowIndicators; this.useRowsCache = true; }
public ScoreTableRowComponent AddRow() { if (!this.useRowsCache || (this.rowsCache.Count == 0)) { ScoreTableRowComponent component2 = Instantiate <ScoreTableRowComponent>(this.rowPrefab); component2.AddIndicators(this.rowIndicators); component2.transform.SetParent(base.transform, false); this.SetDirty(); return(component2); } ScoreTableRowComponent component = this.rowsCache.Dequeue(); component.gameObject.SetActive(true); component.transform.SetParent(base.transform, false); component.transform.localScale = Vector3.one; this.SetDirty(); return(component); }