Exemplo n.º 1
0
        protected override void OnDataExpand(GridViewData data)
        {
            DSData dsData = data.GetData <DSData>();

            if (dsData.isDir)
            {
                string[] files = Directory.GetFiles(dsData.path, "*.*", SearchOption.TopDirectoryOnly);
                string[] dirs  = Directory.GetDirectories(dsData.path, "*", SearchOption.TopDirectoryOnly);
                if (dirs != null && dirs.Length > 0)
                {
                    foreach (var dir in dirs)
                    {
                        AddChildData(data, new GridViewData(dir, new DSData()
                        {
                            path  = dir,
                            isDir = true,
                        }));
                    }
                }

                if (files != null && files.Length > 0)
                {
                    foreach (var file in files)
                    {
                        AddChildData(data, new GridViewData(file, new DSData()
                        {
                            path  = file,
                            isDir = false,
                        }));
                    }
                }
            }
        }
Exemplo n.º 2
0
        public override bool HasChild(GridViewData data)
        {
            DSData dsData = data.GetData <DSData>();

            if (dsData.isDir)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        protected override void OnDrawRowItem(Rect rect, GridViewData itemData)
        {
            DSData data = itemData.GetData <DSData>();

            if (data.isDir)
            {
                Texture2D texture  = EGUIResources.DefaultFolderIcon;
                Rect      iconRect = new Rect(rect.x, rect.y, rect.height, rect.height);
                EditorGUI.DrawPreviewTexture(iconRect, texture);
                rect.x     += rect.height;
                rect.width -= rect.height;
                EditorGUI.LabelField(rect, data.path);
            }
            else
            {
                EditorGUI.LabelField(rect, data.path);
            }
        }