public FolderImage MakeFolderImage() { GameObject ImageGO = Instantiate(ImagePrefab); FolderImage image = ImageGO.GetComponent <FolderImage>(); return(image); }
/* Build, builds carousel given a list of folders */ public async void Build(List <Folder> folders) { if (folders == null) { return; } Active = false; Clear(); int n = folders.Count; foreach (Folder folder in folders) { //Set texture. FolderImage image = MakeFolderImage(); image.LoadThumbnailAsync(folder, () => { n--; if (n == 0) { Active = true; RunEvent("onload"); } }); //Add element. AddElement(image); } }
void Awake() { if (ImageClickBox == null) { return; } ImageClickBox.AddEventListener("onclick", () => { if (FolderCarousel == null) { return; } GameObject obj = FolderCarousel.SelectedObject; if (obj == null) { return; } FolderImage image = obj.GetComponent <FolderImage>(); if (image == null) { return; } Folder folder = image.Folder; if (folder == null) { return; } if (folder.GetType() == typeof(Collection)) { SelectedCollection = (Collection)(object)folder; RunEvent("oncollection"); } }); }