Ejemplo n.º 1
0
        public static void CollectValidFiles(SelectedFolder sf, List <string> fileList)
        {
            var targetFiles = Directory.GetFiles(sf.fullPath, "*.*", SearchOption.AllDirectories);

            for (int i = 0; i < targetFiles.Length; i++)
            {
                var ex = Path.GetExtension(targetFiles[i]);
                if (CheckExtension(ex, sf.validExtensions))
                {
                    fileList.Add(targetFiles[i].Replace(Application.dataPath, "Assets").Replace("\\", "/"));
                }
            }
        }
Ejemplo n.º 2
0
        public void OnGUI(Rect pos)
        {
            _panelRange = pos;
            if (AssetFolderConfig.selectedFolders.Count > 0)
            {
                _folderTreeView.OnGUI(new Rect(_panelRange.x, _panelRange.y, _panelRange.width * 0.45f, _panelRange.height - 30));
            }

            var r = new Rect(_panelRange.x, _panelRange.y + _panelRange.height - 30, _panelRange.width * 0.225f, 30);

            if (GUI.Button(r, "-"))
            {
                _folderTreeView.RemoveSelectedItems();
                //FolderAnalyzer.BuildBundle();
            }

            r = new Rect(_panelRange.x + _panelRange.width * 0.225f, _panelRange.y + _panelRange.height - 30, _panelRange.width * 0.225f, 30);
            if (GUI.Button(r, "+"))
            {
                string dataPath     = Application.dataPath;
                string selectedPath = EditorUtility.OpenFolderPanel("path", dataPath, "");
                if (!string.IsNullOrEmpty(selectedPath))
                {
                    if (selectedPath.StartsWith(dataPath))
                    {
                        var folder = new SelectedFolder();
                        folder.path = selectedPath.Replace(dataPath, "");
                        AssetFolderConfig.selectedFolders.Add(folder);
                        _folderTreeView.Reload();
                    }
                    else
                    {
                        _parent.ShowNotification(new GUIContent("无法将工程之外的目录作为资源目录!"));
                    }
                }
            }

            r = new Rect(_panelRange.x + _panelRange.width * 0.45f, _panelRange.y + _panelRange.height - 30, _panelRange.width * 0.55f, 30f);

            if (GUI.Button(r, "Run Analys"))
            {
                FolderAnalyzer.Fire();
            }
            _afi.OnGUI(new Rect(_panelRange.width * 0.45f + 5f, _panelRange.y, _panelRange.width * 0.55f - 10f, _panelRange.height - 30f));
        }
Ejemplo n.º 3
0
        public void SetData(SelectedFolder sf)
        {
            _selectedFolder = sf;
            if (_selectedFolder == null)
            {
                scrollPos = Vector2.zero;
                return;
            }
            sa = ScriptableObject.CreateInstance <StringArray>();
            sa.validExtensions = _selectedFolder.validExtensions;
            sa.excludeFolders  = _selectedFolder.excludeFolders;
            sa.excludeKeywords = _selectedFolder.excludeKeywords;
            _agent             = new SerializedObject(sa);

            _validExtensions = _agent.FindProperty("validExtensions");
            _excludeFolders  = _agent.FindProperty("excludeFolders");
            _excludeKeywords = _agent.FindProperty("excludeKeywords");
        }
Ejemplo n.º 4
0
 public FolderTreeItem(SelectedFolder sf, AssetFolderTab folderTab) : base(sf.path.GetHashCode(), 0, sf.path)
 {
     this.sf = sf;
 }
Ejemplo n.º 5
0
 public void SetFolderData(SelectedFolder sf)
 {
     _afi.SetData(sf);
 }