protected override DragAndDropVisualMode HandleDragAndDrop(DragAndDropArgs args) { if (args.dragAndDropPosition == DragAndDropPosition.UponItem) { if (args.performDrop) { var targetBundle = (args.parentItem as AssetBundleState.BundleInfo.TreeItem).bundle; if (targetBundle != null) { AssetBundleState.MoveAssetsToBundle(DragAndDrop.paths.Select(a => AssetBundleState.GetAsset(a)), targetBundle.m_name); SelectionChanged(GetSelection()); } } return(DragAndDropVisualMode.Move); } else { if (args.performDrop) { AssetBundleState.StartABMoveBatch(); foreach (var a in DragAndDrop.paths) { if (AssetDatabase.GetMainAssetTypeAtPath(a) == typeof(SceneAsset)) { var bundle = AssetBundleState.GetBundle(System.IO.Path.GetFileNameWithoutExtension(a).ToLower()); AssetBundleState.MoveAssetsToBundle(new AssetBundleState.AssetInfo[] { AssetBundleState.GetAsset(a) }, bundle.m_name); } } AssetBundleState.EndABMoveBatch(); return(DragAndDropVisualMode.Move); } } return(DragAndDropVisualMode.Move); }
protected override DragAndDropVisualMode HandleDragAndDrop(DragAndDropArgs args) { if (m_data == null) { return(DragAndDropVisualMode.Rejected); } if (args.performDrop) { AssetBundleState.StartABMoveBatch(); foreach (var b in m_data.m_bundles) { AssetBundleState.MoveAssetsToBundle(DragAndDrop.paths.Select(a => AssetBundleState.GetAsset(a)), b.m_name); } AssetBundleState.EndABMoveBatch(); SetSelectedBundles(m_data.m_bundles); } return(DragAndDropVisualMode.Move); }