private void CreateItems() { // Title. { GameObject go = new GameObject(); go.name = "Title"; UIScrollSection section = go.AddComponent <UIScrollSection>(); section.contentWidth = 420f; section.contentHeight = 60f; section.arrangement = UIScrollSection.Arrangement.Vertical; go.AddComponent <UIScrollBlinker>(); UIScrollContent content = new UIScrollContent(); content.id = "Items"; content.prefab = prefabTitle; content.onInitContent = InitalizeTitle; section.AddScrollContent(content); section.CalculateBounds(); scrollBuilder.AddScrollSection(section); } // Items. { GameObject go = new GameObject(); go.name = "Items"; UIScrollSection section = go.AddComponent <UIScrollSection>(); section.arrangement = UIScrollSection.Arrangement.Vertical; section.contentWidth = 420f; section.contentHeight = 60f; section.arrangement = UIScrollSection.Arrangement.Vertical; go.AddComponent <UIScrollBlinker>(); foreach (string item in items) { UIScrollContent content = new UIScrollContent(); content.id = item; content.prefab = prefabItem; content.onInitContent = InitalizeItem; section.AddScrollContent(content); } section.CalculateBounds(); scrollBuilder.AddScrollSection(section); } }
private void CreateChampions() { // Champions. { foreach (string champion in Champions) { UIScrollContent content = new UIScrollContent(); content.id = champion; content.prefab = prefabChampion; content.onInitContent = InitalizeChampion; scrollSection.AddScrollContent(content); } scrollSection.CalculateBounds(); } }