コード例 #1
0
        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();
        }
コード例 #2
0
        public UIImage GetImage(string str)
        {
            UIImageGrid ug = GetImageGrid(DataUtility.GetPathName(str));

            if (ug != null)
            {
                return(ug.GetImage(str));
            }
            return(null);
        }
コード例 #3
0
 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);
 }
コード例 #4
0
        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);
        }
コード例 #5
0
 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();
 }
コード例 #6
0
        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);
        }
コード例 #7
0
        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();
        }
コード例 #8
0
 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);
     }
 }