GetAssetsFolderInstanceID() 공개 정적인 메소드

public static GetAssetsFolderInstanceID ( ) : int
리턴 int
        public override void FetchData()
        {
            this.m_RootItem = new TreeViewItem(int.MaxValue, 0, (TreeViewItem)null, "Invisible Root Item");
            this.SetExpanded(this.m_RootItem, true);
            List <TreeViewItem> treeViewItemList = new List <TreeViewItem>();
            int          folderInstanceId        = ProjectBrowserColumnOneTreeViewDataSource.GetAssetsFolderInstanceID();
            int          depth       = 0;
            string       displayName = "Assets";
            TreeViewItem parent      = new TreeViewItem(folderInstanceId, depth, this.m_RootItem, displayName);

            this.ReadAssetDatabase(parent, depth + 1);
            TreeViewItem treeView = SavedSearchFilters.ConvertToTreeView();

            treeView.parent = this.m_RootItem;
            treeViewItemList.Add(treeView);
            treeViewItemList.Add(parent);
            this.m_RootItem.children = treeViewItemList;
            using (List <TreeViewItem> .Enumerator enumerator = this.m_RootItem.children.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    TreeViewItem current = enumerator.Current;
                    bool         expand  = EditorPrefs.GetBool(ProjectBrowserColumnOneTreeViewDataSource.kProjectBrowserString + current.displayName, true);
                    this.SetExpanded(current, expand);
                }
            }
            this.m_NeedRefreshVisibleFolders = true;
        }
        public override void FetchData()
        {
            this.m_RootItem = new TreeViewItem(2147483647, 0, null, "Invisible Root Item");
            this.SetExpanded(this.m_RootItem, true);
            List <TreeViewItem> list            = new List <TreeViewItem>();
            int          assetsFolderInstanceID = ProjectBrowserColumnOneTreeViewDataSource.GetAssetsFolderInstanceID();
            int          num          = 0;
            string       displayName  = "Assets";
            TreeViewItem treeViewItem = new TreeViewItem(assetsFolderInstanceID, num, this.m_RootItem, displayName);

            this.ReadAssetDatabase(HierarchyType.Assets, treeViewItem, num + 1);
            TreeViewItem treeViewItem2 = null;

            if (Unsupported.IsDeveloperMode() && EditorPrefs.GetBool("ShowPackagesFolder"))
            {
                int    mainAssetOrInProgressProxyInstanceID = AssetDatabase.GetMainAssetOrInProgressProxyInstanceID(AssetDatabase.GetPackagesMountPoint());
                string packagesMountPoint = AssetDatabase.GetPackagesMountPoint();
                treeViewItem2 = new TreeViewItem(mainAssetOrInProgressProxyInstanceID, num, this.m_RootItem, packagesMountPoint);
                this.ReadAssetDatabase(HierarchyType.Packages, treeViewItem2, num + 1);
            }
            TreeViewItem treeViewItem3 = SavedSearchFilters.ConvertToTreeView();

            treeViewItem3.parent = this.m_RootItem;
            list.Add(treeViewItem3);
            list.Add(treeViewItem);
            if (treeViewItem2 != null)
            {
                list.Add(treeViewItem2);
            }
            this.m_RootItem.children = list;
            foreach (TreeViewItem current in this.m_RootItem.children)
            {
                bool @bool = EditorPrefs.GetBool(ProjectBrowserColumnOneTreeViewDataSource.kProjectBrowserString + current.displayName, true);
                this.SetExpanded(current, @bool);
            }
            this.m_NeedRefreshRows = true;
        }
        public override void FetchData()
        {
            this.m_RootItem = new TreeViewItem(2147483647, 0, null, "Invisible Root Item");
            this.SetExpanded(this.m_RootItem, true);
            List <TreeViewItem> list            = new List <TreeViewItem>();
            int          assetsFolderInstanceID = ProjectBrowserColumnOneTreeViewDataSource.GetAssetsFolderInstanceID();
            int          num          = 0;
            string       displayName  = "Assets";
            TreeViewItem treeViewItem = new TreeViewItem(assetsFolderInstanceID, num, this.m_RootItem, displayName);

            this.ReadAssetDatabase(treeViewItem, num + 1);
            TreeViewItem treeViewItem2 = SavedSearchFilters.ConvertToTreeView();

            treeViewItem2.parent = this.m_RootItem;
            list.Add(treeViewItem2);
            list.Add(treeViewItem);
            this.m_RootItem.children = list;
            foreach (TreeViewItem current in this.m_RootItem.children)
            {
                bool @bool = EditorPrefs.GetBool(ProjectBrowserColumnOneTreeViewDataSource.kProjectBrowserString + current.displayName, true);
                this.SetExpanded(current, @bool);
            }
            this.m_NeedRefreshVisibleFolders = true;
        }
예제 #4
0
        // Deletes the assets of the instance IDs, with an optional user confirmation dialog.
        // Returns true if the delete operation was successfully performed on all assets.
        // Note: Zero input assets always returns true.
        // Also note that the operation cannot be undone even if some operations failed.
        internal static bool DeleteAssets(List <int> instanceIDs, bool askIfSure)
        {
            if (instanceIDs.Count == 0)
            {
                return(true);
            }

            bool foundAssetsFolder = instanceIDs.IndexOf(ProjectBrowserColumnOneTreeViewDataSource.GetAssetsFolderInstanceID()) >= 0;

            if (foundAssetsFolder)
            {
                string title = "Cannot Delete";
                EditorUtility.DisplayDialog(title, "Deleting the 'Assets' folder is not allowed", "Ok");
                return(false);
            }

            var paths = GetMainPathsOfAssets(instanceIDs).ToList();

            if (paths.Count == 0)
            {
                return(false);
            }

            if (askIfSure)
            {
                string title = "Delete selected asset";
                if (paths.Count > 1)
                {
                    title = title + "s";
                }
                title = title + "?";

                int    maxCount = 3;
                string infotext = "";
                for (int i = 0; i < paths.Count && i < maxCount; ++i)
                {
                    infotext += "   " + paths[i] + "\n";
                }
                if (paths.Count > maxCount)
                {
                    infotext += "   ...\n";
                }
                infotext += "\nYou cannot undo this action.";
                if (!EditorUtility.DisplayDialog(title, infotext, "Delete", "Cancel"))
                {
                    return(false);
                }
            }

            bool success = true;

            AssetDatabase.StartAssetEditing();
            foreach (string path in paths)
            {
                if (!AssetDatabase.MoveAssetToTrash(path))
                {
                    success = false;
                }
            }
            AssetDatabase.StopAssetEditing();

            return(success);
        }
예제 #5
0
        internal static bool DeleteAssets(List <int> instanceIDs, bool askIfSure)
        {
            bool result;

            if (instanceIDs.Count == 0)
            {
                result = true;
            }
            else
            {
                bool flag = instanceIDs.IndexOf(ProjectBrowserColumnOneTreeViewDataSource.GetAssetsFolderInstanceID()) >= 0;
                if (flag)
                {
                    string title = "Cannot Delete";
                    EditorUtility.DisplayDialog(title, "Deleting the 'Assets' folder is not allowed", "Ok");
                    result = false;
                }
                else
                {
                    List <string> list = ProjectWindowUtil.GetMainPathsOfAssets(instanceIDs).ToList <string>();
                    if (list.Count == 0)
                    {
                        result = false;
                    }
                    else
                    {
                        if (askIfSure)
                        {
                            string text = "Delete selected asset";
                            if (list.Count > 1)
                            {
                                text += "s";
                            }
                            text += "?";
                            int    num   = 3;
                            string text2 = "";
                            int    num2  = 0;
                            while (num2 < list.Count && num2 < num)
                            {
                                text2 = text2 + "   " + list[num2] + "\n";
                                num2++;
                            }
                            if (list.Count > num)
                            {
                                text2 += "   ...\n";
                            }
                            text2 += "\nYou cannot undo this action.";
                            if (!EditorUtility.DisplayDialog(text, text2, "Delete", "Cancel"))
                            {
                                result = false;
                                return(result);
                            }
                        }
                        bool flag2 = true;
                        AssetDatabase.StartAssetEditing();
                        foreach (string current in list)
                        {
                            if (!AssetDatabase.MoveAssetToTrash(current))
                            {
                                flag2 = false;
                            }
                        }
                        AssetDatabase.StopAssetEditing();
                        result = flag2;
                    }
                }
            }
            return(result);
        }