private void ShowGrid() { Vector2 tempVec = new Vector2(0, 0); if (_curTab == selectTab.noRecord) { return; } int dateCount = 0; float y = -836; foreach (string date in _actionsDict.Keys) { AntBillDateItem dateItem = GetBillDate(); dateItem.SetData(date); y = y - dateCount * 145; tempVec.y = y; dateItem.cachedRectTransform.anchoredPosition = tempVec; for (int i = 0; i < _actionsDict[date].Count; i++) { AntBillDetailItem detailItem = GetBillDetail(); detailItem.SetData(_actionsDict[date][i]); y = y - i * 210; tempVec.y = y; detailItem.cachedRectTransform.anchoredPosition = tempVec; tempVec.x = 993.2f; tempVec.y = 145 + (i + 1) * 210; dateItem.cachedRectTransform.sizeDelta = tempVec; } y += 40; } _content.sizeDelta = new Vector2(1080, -y); }
AntBillDateItem GetBillDate() { AntBillDateItem item = null; if (_dateList.Count > _dateCount) { item = _dateList[_dateCount]; } else { item = Instantiate(_datePrefab); item.cachedRectTransform.SetParent(_content); item.cachedRectTransform.localScale = Vector3.one; item.cachedRectTransform.anchoredPosition = Vector2.zero; _dateList.Add(item); } _dateCount++; return(item); }