private static TopRecordRow[] CreateAllRows <T>(TopRecordRow baseRow, ISortedRecords <T> records) where T : IComparable <T> { TopRecordRow[] returnList = new TopRecordRow[records.MaxCapacity]; returnList[0] = baseRow; GameObject clone = null; for (int i = 1; i < returnList.Length; ++i) { clone = Instantiate(baseRow.gameObject, baseRow.transform.parent); clone.transform.localPosition = Vector3.zero; clone.transform.localRotation = Quaternion.identity; clone.transform.localScale = Vector3.one; clone.transform.SetAsLastSibling(); returnList[i] = clone.GetComponent <TopRecordRow>(); } return(returnList); }
private void SetupRecordsVisibility() { // Go through all records ISortedRecords <int> allScores = Singleton.Get <GameSettings>().HighScores; for (int index = 0; index < AllBestScoreEntries.Length; ++index) { if (index < allScores.Count) { AllBestScoreEntries[index].gameObject.SetActive(true); AllBestScoreEntries[index].UpdateRecord((index + 1), allScores[index]); } else { AllBestScoreEntries[index].gameObject.SetActive(false); } } // Determine whether to show no-records label noRecordsRow.gameObject.SetActive(allScores.Count <= 0); }