public void AddCakeRaceReplayEntry(int index, CakeRaceReplayEntry entry) { if (this.replayEntries == null) { this.replayEntries = new Dictionary <int, CakeRaceReplayEntry>(); } if (!this.replayEntries.ContainsKey(index)) { this.replayEntries.Add(index, entry); } }
protected override void OnEnable() { base.OnEnable(); if (this.titleLabel == null) { Transform transform = this.dialogRoot.transform.Find("Title/Label"); if (transform != null) { this.titleLabel = transform.GetComponentsInChildren <TextMesh>(); } } Transform transform2 = this.dialogRoot.transform.Find("ListContainer"); this.leaderboardListScroller = transform2.GetComponent <VerticalScroller>(); Transform transform3 = this.dialogRoot.transform.Find("ListContainer/SingleRankGrid"); if (transform3 != null) { this.singleRanksGrid = transform3.GetComponent <GridLayout>(); } Transform transform4 = this.dialogRoot.transform.Find("ListContainer/Top50Grid"); if (transform4 != null) { this.top50Grid = transform4.GetComponent <GridLayout>(); } if (this.leaderboardEntries == null) { this.DecreaseLeaderboardScrollerHeight(this.top50Grid.VerticalGap); this.leaderboardEntries = new Dictionary <int, LeaderboardEntry>(); if (this.singleRanks != null) { int num = this.singleRanks.Length; } for (int i = 0; i < this.TotalEntryCount(); i++) { string name = string.Format("{0:0000}", i); GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>((i < 50) ? this.entryPrefab : this.singleEntryPrefab); gameObject.transform.parent = ((i < 50) ? this.top50Grid.transform : this.singleRanksGrid.transform); gameObject.transform.SetAsLastSibling(); gameObject.name = name; LeaderboardEntry component = gameObject.transform.GetComponent <LeaderboardEntry>(); component.Init(this); component.ParentGrid = ((i < 50) ? this.top50Grid : this.singleRanksGrid); this.leaderboardEntries.Add(i, component); if (transform4 != null) { VerticalScrollButton component2 = gameObject.transform.GetComponent <VerticalScrollButton>(); component2.SetScroller(this.leaderboardListScroller); } } } this.UpdateGridLayout(); if (this.playerInfo == null) { transform2 = this.dialogRoot.transform.Find("PlayerInfoContainer"); VerticalScroller component3 = transform2.GetComponent <VerticalScroller>(); transform4 = transform2.Find("ReplayGrid"); if (transform4 != null) { this.replayGrid = transform4.GetComponent <GridLayout>(); } this.playerInfo = transform2.gameObject.AddComponent <LeaderboardPlayerInfo>(); for (int j = 0; j < 7; j++) { string name2 = string.Format("{0:0000}", j); GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(this.cakeRaceReplayEntryPrefab); gameObject2.transform.parent = this.replayGrid.transform; gameObject2.transform.SetAsLastSibling(); gameObject2.name = name2; CakeRaceReplayEntry component4 = gameObject2.transform.GetComponent <CakeRaceReplayEntry>(); component4.SetDialog(this); this.playerInfo.AddCakeRaceReplayEntry(j, component4); if (this.replayGrid != null && j > 0) { component3.AddHeight(this.replayGrid.VerticalGap); } } } this.replayGrid.UpdateLayout(); if (this.cupInfo == null) { transform2 = this.dialogRoot.transform.Find("CupInfoContainer"); this.cupInfo = transform2.gameObject.AddComponent <LeaderboardCupInfo>(); this.cupInfo.Init(this); } base.StartCoroutine(this.FetchLeaderboard()); this.SetTitle(this.GetCupAndSeasonTitle()); this.UpdateDaysLeft(); EventManager.Connect(new EventManager.OnEvent <UIEvent>(this.OnReceivedUIEvent)); }