public void Awake(DateElement original, RectTransform tileRect, TextMeshProUGUI monthTitle) { DateElements[0] = original; TileRect = tileRect; StartingTileHeight = TileRect.sizeDelta.y; MonthTitle = monthTitle; }
private DateElement ConstructDateElement(int dateCount) { DateElement newDateElement = GameObject.Instantiate(original: DateElements[dateCount - 1], parent: DateElements[dateCount - 1].transform.parent.transform) as DateElement; RectTransform newRect = newDateElement.GetComponent <RectTransform>(); if (newRect.anchoredPosition.x + DateElementOffset <= TileRect.rect.width - (TileRect.offsetMin.x + -TileRect.offsetMax.x)) { newRect.anchoredPosition = new Vector3(newRect.anchoredPosition.x + DateElementOffset, newRect.anchoredPosition.y); } else { RectTransform originalRect = DateElements[0].GetComponent <RectTransform>(); newRect.anchoredPosition = new Vector3(originalRect.anchoredPosition.x, newRect.anchoredPosition.y - DateElementOffset); RowOffset += DateElementOffset; } newDateElement.UpdateView(dateCount + 1); return(newDateElement); }
private void ResetOriginalElement(DateElement original, int arrayLength) { DateElements = new DateElement[arrayLength]; DateElements[0] = original; DateElements[0].UpdateView(1); }