private void OnContextFindDependenciesActiveItem(object userdata)
        {
            var item = userdata as AssetTreeViewItem <AssetTreeModel.AssetInfo>;

            if (item != null)
            {
                if (AssetDanshariHandler.onDependenciesFindItem != null)
                {
                    AssetDanshariHandler.onDependenciesFindItem(item.data.fileRelativePath);
                }
            }
        }
        public override void SetDataPaths(string refPathStr, string pathStr, string commonPathStr)
        {
            base.SetDataPaths(refPathStr, pathStr, commonPathStr);

            var resFileList   = GetResFileList();
            var guidList      = GetGuidFromFileList(resFileList);
            var fileList      = GetRefFileList();
            var searchRetList = GetSearchResultList(fileList.Count, guidList.Count);

            ThreadDoFilesTextSearchReplace(fileList, guidList, String.Empty, searchRetList);
            var rootInfo = DirToAssetInfoTree(resPaths);
            var resInfos = FileListToAssetInfos(resFileList);

            // 根据搜索结果来挂载额外信息
            for (int i = 0; i < fileList.Count; i++)
            {
                for (int j = 0; j < guidList.Count; j++)
                {
                    if (searchRetList[i][j])
                    {
                        AssetInfo info = GenAssetInfo(fileList[i]);
                        info.isExtra = true;
                        resInfos[j].AddChild(info);
                    }
                }
            }

            if (AssetDanshariHandler.onDependenciesLoadDataMore != null)
            {
                AssetDanshariHandler.onDependenciesLoadDataMore(pathStr, resInfos, this);
            }

            MergeAssetInfo(rootInfo, resInfos);

            if (rootInfo.hasChildren)
            {
                data = rootInfo;
            }
            EditorUtility.ClearProgressBar();
        }
示例#3
0
        protected override void ContextClickedItem(int id)
        {
            var item      = FindItem(id, rootItem);
            var assetInfo = GetItemAssetInfo(item);

            if (item == null || assetInfo == null || assetInfo.deleted)
            {
                return;
            }

            GenericMenu menu = new GenericMenu();

            if (!IsSelectionMulti())
            {
                menu.AddItem(AssetDanshariStyle.Get().locationContext, false, OnContextSetActiveItem, id);
                menu.AddItem(AssetDanshariStyle.Get().explorerContext, false, OnContextExplorerActiveItem, item);
            }

            if (!IsSelectionContainsReverseItem())
            {
                menu.AddSeparator(String.Empty);
                AddContextMoveComm(menu);
                menu.AddSeparator(String.Empty);
                menu.AddItem(AssetDanshariStyle.Get().dependenciesDelete, false, OnContextDeleteThisItem);

                if (AssetDanshariHandler.onDependenciesContextDraw != null)
                {
                    AssetDanshariHandler.onDependenciesContextDraw(menu);
                }
            }

            if (menu.GetItemCount() > 0)
            {
                menu.ShowAsContext();
            }
        }