IEnumerator LoadDirectory(DirectoryInfo dir) { if (dir.Exists) { DirectoryInfo[] dirs = dir.GetDirectories().OrderByDescending(d => d.LastWriteTime).ToArray(); for (int i = 0; i < items.Count; i++) { UIImageGrid ug = items[i] as UIImageGrid; if (!ug.EqualDirectory(dirs[i])) { ug.Load(dirs[i]); } } if (items.Count < dirs.Length) { for (int i = items.Count; i < dirs.Length; i++) { UIImageGrid grid = AddItem(dirs[i]); if (grid != null) { yield return(new WaitUntil(grid.IsLoaded)); topPos -= grid.GetHeight() + spaceY; } } } topPos -= bottomRect.sizeDelta.y; } yield return(new WaitForEndOfFrame()); Refresh(); }
public UIImage GetImage(string str) { UIImageGrid ug = GetImageGrid(DataUtility.GetPathName(str)); if (ug != null) { return(ug.GetImage(str)); } return(null); }
public UIImageGrid GetImageGrid(string str) { foreach (UIControl ic in items) { UIImageGrid ug = ic as UIImageGrid; if (ug != null && ug.gridName.text == str) { return(ug); } } return(null); }
public UIImageGrid GetItem(string path) { UIImageGrid grid = null; foreach (UIControl c in items) { grid = c as UIImageGrid; if (grid.EqualDirectory(path)) { return(grid); } } return(null); }
public override void Refresh() { topPos = -spaceY; for (int i = items.Count - 1; i > -1; i--) { ((UIImageGrid)items[i]).Refresh(); } for (int i = 0; i < items.Count; i++) { UIImageGrid _grid = items[i] as UIImageGrid; _grid.SetPosY(topPos); topPos -= _grid.GetHeight() + spaceY; } topPos -= bottomRect.sizeDelta.y; UpdateSize(); }
public UIImageGrid AddItem(DirectoryInfo dir, int index = -1) { GameObject obj = Instantiate(gridPrefab, contentRect); UIImageGrid grid = obj.GetComponent <UIImageGrid>(); grid.SetPosY(topPos); grid.Load(dir); grid.ItemClickedHandler = OnClickImage; if (index != -1) { Items.Insert(index, grid); obj.transform.SetSiblingIndex(index); } grid.Parent = this; return(grid); }
public void AddImage(string str) { FileInfo file = new FileInfo(str); if (file.Exists) { UIImageGrid grid = GetItem(file.DirectoryName); if (grid == null) { grid = AddItem(file.Directory, 0); } else { grid.AddItem(file, 0.4f, 0); } } DelayRefresh(); }
public void OnClickImage(UIImageGrid grid, UIImage im) { if (isSelectState) { im.Selected = !im.Selected; if (im.Selected) { selectedImages.Add(im); } else { selectedImages.Remove(im); } } else { string path = DataUtility.GetScreenShotPath() + im.ImageTag; Controller.MediaController.Singleton.ShowScreenShot(im.ImageTag); } }