Пример #1
0
 public void Refresh()
 {
     m_DependentAssets.Clear();
     foreach (var itr in m_ConcreteAssets)
     {
         m_DependentAssets.AddRange(itr.GetDependencies());
     }
     BundleModel.Save();
 }
Пример #2
0
        protected void DeleteBundles(object context)
        {
            var selectedNodes = context as List <BundleTreeItem>;

            if (selectedNodes == null)
            {
                return;
            }
            BundleModel.HandleBundleDelete(selectedNodes.Select(x => x.BundleData));
            ReloadAndSelect(new List <int>());
        }
Пример #3
0
        protected void CreateNewAssetBundle(object context)
        {
            BundleDataInfo info          = null;
            var            selectedNodes = context as List <BundleTreeItem>;

            if (selectedNodes != null && selectedNodes.Count > 0)
            {
                info = selectedNodes[0].BundleData as BundleDataInfo;
            }
            var newBundle = BundleModel.CreateEmptyBundle(info);

            ReloadAndSelect(newBundle.nameHashCode, true);
        }
Пример #4
0
        protected override DragAndDropVisualMode HandleDragAndDrop(DragAndDropArgs args)
        {
            if (IsValidDragDrop(args))
            {
                if (args.performDrop)
                {
                    BundleModel.MoveAssetToBundle(DragAndDrop.paths, m_SourceBundles[0].m_Name);
                    foreach (var bundle in m_SourceBundles)
                    {
                        bundle.Refresh();
                    }
                    m_Controller.UpdateSelectedBundles(m_SourceBundles);
                }
                return(DragAndDropVisualMode.Copy);//Move;
            }

            return(DragAndDropVisualMode.Rejected);
        }
Пример #5
0
        private void RemoveAssets(object userdata)
        {
            var selectedNodes = userdata as List <AssetTreeItem>;
            var assets        = new List <AssetInfo>();

            foreach (var node in selectedNodes)
            {
                if (node.asset.bundleName != string.Empty)
                {
                    assets.Add(node.asset);
                }
            }
            BundleModel.MoveAssetToBundle(assets, string.Empty);
            foreach (var bundle in m_SourceBundles)
            {
                bundle.Refresh();
            }
            m_Controller.UpdateSelectedBundles(m_SourceBundles);
        }
Пример #6
0
        protected override void RenameEnded(RenameEndedArgs args)
        {
            base.RenameEnded(args);
            if (args.newName.Length > 0 && args.newName != args.originalName)
            {
                args.newName        = args.newName.ToLower();
                args.acceptedRename = true;

                var renamedItem = FindItem(args.itemID, rootItem) as BundleTreeItem;
                args.acceptedRename = BundleModel.HandleBundleRename(renamedItem, args.newName);
                if (renamedItem != null)
                {
                    ReloadAndSelect(renamedItem.BundleData.nameHashCode, false);
                }
            }
            else
            {
                args.acceptedRename = false;
            }
        }
Пример #7
0
 private void DragPathsToNewSpace(string[] paths, BundleDataInfo root, bool hasScene)
 {
     if (hasScene)
     {
         var hashCodes = new List <int>();
         foreach (var assetPath in paths)
         {
             var newBundle = BundleModel.CreateEmptyBundle(root, System.IO.Path.GetFileNameWithoutExtension(assetPath).ToLower());
             BundleModel.MoveAssetToBundle(assetPath, newBundle.m_Name);
             hashCodes.Add(newBundle.nameHashCode);
         }
         ReloadAndSelect(hashCodes);
     }
     else
     {
         var newBundle = BundleModel.CreateEmptyBundle(root);
         BundleModel.MoveAssetToBundle(paths, newBundle.m_Name);
         ReloadAndSelect(newBundle.nameHashCode, true);
     }
 }
Пример #8
0
        private DragAndDropVisualMode HandleDragAndDropUpon(DragAndDropData data)
        {
            var visualMode       = DragAndDropVisualMode.Copy;
            var targetDataBundle = data.targetNode.BundleData as BundleDataInfo;

            if (targetDataBundle != null)
            {
                if (targetDataBundle.isSceneBundle)
                {
                    visualMode = DragAndDropVisualMode.Rejected;
                }
                else
                {
                    if (data.hasScene && !targetDataBundle.IsEmpty())
                    {
                        visualMode = DragAndDropVisualMode.Rejected;
                    }
                    else
                    {
                        if (data.args.performDrop)
                        {
                            if (data.draggedNodes != null)
                            {
                                BundleModel.HandleBundleMerge(data.draggedNodes, targetDataBundle);
                                ReloadAndSelect(targetDataBundle.nameHashCode, false);
                            }
                            else if (data.paths != null)
                            {
                                BundleModel.MoveAssetToBundle(data.paths, targetDataBundle.m_Name);
                                ReloadAndSelect(targetDataBundle.nameHashCode, false);
                            }
                        }
                    }
                }
            }
            else
            {
                var root = data.targetNode.BundleData as BundleDataInfo;
            }
            return(visualMode);
        }
Пример #9
0
 protected override TreeViewItem BuildRoot()
 {
     return(BundleModel.CreateAssetBundleTreeView());
 }
Пример #10
0
 public BundleTreeView(TreeViewState state, BundleManagerControl ctrl) : base(state)
 {
     BundleModel.Reload();
     m_Controller = ctrl;
     showBorder   = true;
 }
Пример #11
0
        protected override TreeViewItem BuildRoot()
        {
            var root = BundleModel.CreateAssetListTreeView(m_SourceBundles);

            return(root);
        }