/// <summary> /// レコードのGameObjectを生成する /// </summary> /// <param name="prefab">コピー元オブジェクト</param> /// <param name="number">順位</param> /// <param name="entry">レコード情報</param> /// <returns></returns> public static RankingEntryPanel CreateRankingEntryPanel(RankingEntryPanel prefab, int number, RankingEntry entry) { RankingEntryPanel panel = Instantiate(prefab); panel.SetRankingEntry(number, entry); return(panel); }
/// <summary> /// ランキング表示を更新する /// </summary> /// <param name="ranking"></param> public void SetRanking(RankingBoard ranking) { RemoveAllContent(); foreach (var element in ranking.Entries.Select((entry, index) => new { entry, index })) { RankingEntryPanel panel = RankingEntryPanel.CreateRankingEntryPanel( prefab: entryPanelPrefab, number: element.index + 1, entry: element.entry); panel.transform.SetParent(content, worldPositionStays: false); } }