Esempio n. 1
0
            protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
            {
                IList <TreeViewItem> items = FindRows(args.draggedItemIDs);

                if (items[0] is LeafItem)
                {
                    LeafItem item = items[0] as LeafItem;

                    DragAndDrop.PrepareStartDrag();
                    DragAndDrop.objectReferences = new UnityEngine.Object[] { Instantiate(item.Data) };

                    string title = string.Empty;

                    if (item.Data is EditorEventRef)
                    {
                        title = "New FMOD Studio Emitter";
                    }
                    else if (item.Data is EditorBankRef)
                    {
                        title = "New FMOD Studio Bank Loader";
                    }
                    else if (item.Data is EditorParamRef)
                    {
                        title = "New FMOD Studio Global Parameter Trigger";
                    }

                    DragAndDrop.StartDrag(title);
                }
            }
Esempio n. 2
0
        protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
        {
            base.SetupDragAndDrop(args);

            List <Object> objReferences = new List <Object>();

            foreach (int id in args.draggedItemIDs)
            {
                SpriteAtlasData            atlas;
                SpriteAtlasData.SpriteInfo sprite;
                Sprite origin;
                Get(id, out atlas, out sprite, out origin);
                if (sprite != null && origin == null)
                {
                    if (sprite.packed != null)
                    {
                        objReferences.Add(sprite.packed);
                    }
                    else if (sprite.origin != null)
                    {
                        objReferences.Add(sprite.origin);
                    }
                }
            }

            if (objReferences.Count <= 0)
            {
                return;
            }

            DragAndDrop.StartDrag("aaaaa");
            DragAndDrop.objectReferences = objReferences.ToArray();
        }
Esempio n. 3
0
        protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
        {
            if (args.draggedItemIDs.Count > 1000)
            {
                G.Module.DisplayDialog("拖动的项太多了!请尽量折叠文件夹后拖拽");
                return;
            }
            DragAndDrop.PrepareStartDrag();
            var items = new List <TreeViewItem>(args.draggedItemIDs.Count);

            foreach (var id in args.draggedItemIDs)
            {
                var item = FindItem(id, rootItem);
                items.Add(item);
            }
            DragAndDrop.SetGenericData("BundleTreeItemList", items);

            #region 添加在Unity编辑器中全局可用的path属性
            //string[] paths = new string[args.draggedItemIDs.Count];
            //for (int i = 0; i < paths.Length; i++)
            //{
            //  paths[i] = item.path;
            //}
            //DragAndDrop.paths = paths;
            #endregion
            DragAndDrop.StartDrag("Bundle Drag");
        }
        protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
        {
            DragAndDrop.PrepareStartDrag();
            IList <int> sortedDraggedIDs = SortItemIDsInRowOrder(args.draggedItemIDs);

            List <Object> objList = new List <Object>(sortedDraggedIDs.Count);
            List <string> paths   = new List <string>(sortedDraggedIDs.Count);

            for (int i = 0; i < sortedDraggedIDs.Count; i++)
            {
                int instanceID = sortedDraggedIDs[i];

                Object obj = EditorUtility.InstanceIDToObject(instanceID);
                if (obj != null)
                {
                    objList.Add(obj);

                    string path = AssetDatabase.GetAssetPath(obj);
                    if (!string.IsNullOrEmpty(path) && paths.IndexOf(path) < 0)
                    {
                        paths.Add(path);
                    }
                }
            }

            DragAndDrop.objectReferences = objList.ToArray();
            DragAndDrop.paths            = paths.ToArray();
            DragAndDrop.StartDrag(objList.Count > 1 ? "<Multiple>" : objList[0].name);
        }
        protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
        {
            DragAndDrop.PrepareStartDrag();

            if (args.draggedItemIDs.Count > 0)
            {
                var nodes = new List <BuildTargetTreeItem>();

                foreach (var id in args.draggedItemIDs)
                {
                    var item = FindItem(id, rootItem) as BuildTargetTreeItem;
                    if (item != null)
                    {
                        nodes.Add(item);
                    }
                }

                DragAndDrop.SetGenericData("BuildTargetTreeItem.DraggedItems", nodes);
            }

            DragAndDrop.paths            = null;
            DragAndDrop.objectReferences = m_EmptyObjectList.ToArray();
            DragAndDrop.visualMode       = DragAndDropVisualMode.Move;
            DragAndDrop.StartDrag("BuildTargetTreeItem");
        }
 protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
 {
     DragAndDrop.PrepareStartDrag();
     DragAndDrop.SetGenericData("BuildPlayerSceneTreeViewItem", new List <int>(args.draggedItemIDs));
     DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
     DragAndDrop.StartDrag("BuildPlayerSceneTreeView");
 }
        protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
        {
            if (hasSearch)
            {
                return;
            }

            DragAndDrop.PrepareStartDrag();
            var rows = GetRows();
            List <TreeViewItem> draggedRows = new List <TreeViewItem>();

            for (int i = 0; i < rows.Count; i++)
            {
                if (args.draggedItemIDs.Contains(rows[i].id))
                {
                    draggedRows.Add(rows[i]);
                }
            }

            DragAndDrop.SetGenericData("AssetTreeViewDragging", draggedRows);
            DragAndDrop.objectReferences = new UnityEngine.Object[] { }; // this IS required for dragging to work
            string title = draggedRows.Count == 1 ? draggedRows[0].displayName : "< Multiple >";

            DragAndDrop.StartDrag(title);
        }
 protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
 {
     var row = FindItem(args.draggedItemIDs.First(), rootItem);
     DragAndDrop.PrepareStartDrag();
     DragAndDrop.paths = args.draggedItemIDs.Select(i => "" + i).ToArray();
     DragAndDrop.StartDrag(row.displayName);
 }
Esempio n. 9
0
        protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
        {
            var item = FindItem(args.draggedItemIDs[0], rootItem);

            if (item != null)
            {
                DragAndDrop.PrepareStartDrag();
                if (item is TypeTreeView)
                {
                    DragAndDrop.SetGenericData("uNode", (item as TypeTreeView).type);
                }
                else if (item is MemberTreeView)
                {
                    DragAndDrop.SetGenericData("uNode", (item as MemberTreeView).member);
                }
                else if (item is NodeTreeView)
                {
                    DragAndDrop.SetGenericData("uNode", (item as NodeTreeView).data.menu as object ?? (item as NodeTreeView).data.command as object);
                }
                else
                {
                    throw null;
                }
                DragAndDrop.objectReferences = new UnityObject[0];
                DragAndDrop.StartDrag("Drag Node");
            }
        }
Esempio n. 10
0
 /////////////////////////////////////////
 sealed protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
 {
     if (args.draggedItemIDs == null)
     {
         return;
     }
     OnSetupDragAndDrop(ToItems(args.draggedItemIDs));
 }
Esempio n. 11
0
        protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
        {
            DragAndDrop.PrepareStartDrag();

            DragAndDrop.SetGenericData("GUID", args.draggedItemIDs[0]);

            DragAndDrop.StartDrag("EntityDefinition");
        }
        protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
        {
            DragAndDrop.PrepareStartDrag();
            var draggedRows = args.draggedItemIDs;

            DragAndDrop.SetGenericData(k_DragId, draggedRows);
            DragAndDrop.StartDrag("Move Positions");
        }
Esempio n. 13
0
 protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
 {
     DragAndDrop.PrepareStartDrag();
     DragAndDrop.paths            = null;
     DragAndDrop.objectReferences = new UnityEngine.Object[] { };
     DragAndDrop.SetGenericData("ResourceTreeViewDraggedIds", new List <int>(args.draggedItemIDs));
     DragAndDrop.visualMode = DragAndDropVisualMode.Move;
     DragAndDrop.StartDrag("ResourceTreeViewDraggedIds");
 }
 protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
 {
     DragAndDrop.PrepareStartDrag();
     DragAndDrop.paths            = null;
     DragAndDrop.objectReferences = new UnityEngine.Object[] {};
     DragAndDrop.SetGenericData("BuildPlayerSceneTreeViewItem", new List <int>(args.draggedItemIDs));
     DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
     DragAndDrop.StartDrag("BuildPlayerSceneTreeView");
 }
Esempio n. 15
0
        protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
        {
            DragAndDrop.PrepareStartDrag();
            var draggedRows = args.draggedItemIDs;

            DragAndDrop.SetGenericData(k_DragId, draggedRows);
            DragAndDrop.objectReferences = new UnityEngine.Object[] {};  // this is required for dragging to work
            DragAndDrop.StartDrag("Move Positions");
        }
        protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
        {
            var itemId = args.draggedItemIDs[0];
            var item   = FindItem(itemId, rootItem);

            DragAndDrop.PrepareStartDrag();
            DragAndDrop.SetGenericData(kPlayerlooplistviewItemId, itemId);
            DragAndDrop.StartDrag(item.displayName);
        }
        protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
        {
            DragAndDrop.PrepareStartDrag();
            List <AssetBundleModel.AssetTreeItem> items =
                new List <AssetBundleModel.AssetTreeItem>(args.draggedItemIDs.Select(id => FindItem(id, rootItem) as AssetBundleModel.AssetTreeItem));

            DragAndDrop.paths            = items.Select(a => a.asset.Name).ToArray();
            DragAndDrop.objectReferences = new UnityEngine.Object[] { };
            DragAndDrop.StartDrag("AssetListTree");
        }
Esempio n. 18
0
        protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
        {
            DragAndDrop.PrepareStartDrag();
            DragAndDrop.objectReferences = _currentGroup.Items.Select(asset => asset.AssetObject).ToArray();
            List <ABAssetTreeItem> items = new List <ABAssetTreeItem>(args.draggedItemIDs.Select(id => FindItem(id, rootItem) as ABAssetTreeItem));

            DragAndDrop.paths = items.Select(item => item.Asset.PathAsset).ToArray();
            DragAndDrop.SetGenericData("ABAssetListTreeSource", this);
            DragAndDrop.StartDrag("ABAssetListTree");
        }
        protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
        {
            DragAndDrop.PrepareStartDrag();
            var sortedDraggedIDs = SortItemIDsInRowOrder(args.draggedItemIDs);
            var objList          = new List <UnityEngine.GameObject>(sortedDraggedIDs.Count);


            DragAndDrop.paths            = new string[0];
            DragAndDrop.objectReferences = objList.Cast <UnityEngine.Object>().ToArray();
            DragAndDrop.StartDrag("Multiple");
        }
Esempio n. 20
0
        protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
        {
            PrefabsListElement itemClicked = treeModel.Find(args.draggedItemIDs[0]);

            if (itemClicked.rustID != 0)
            {
                DragAndDrop.PrepareStartDrag();
                DragAndDrop.StartDrag("Spawn Prefab");
                PrefabManager.PrefabToSpawn = PrefabManager.Load(itemClicked.rustID);
            }
        }
Esempio n. 21
0
            protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
            {
                DragAndDrop.PrepareStartDrag();

                var transitions = args.draggedItemIDs.Select(it => (UnityEngine.Object)profile.transitions[it]).ToArray();

                DragAndDrop.objectReferences = transitions;
                DragAndDrop.StartDrag("Transition");

                Event.current.Use();
            }
    protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
    {
        DragAndDrop.PrepareStartDrag();
        var draggedRows = GetRows().Where(item => args.draggedItemIDs.Contains(item.id)).ToList();

        DragAndDrop.SetGenericData(DatatableDragID, draggedRows);
        DragAndDrop.objectReferences = new UnityEngine.Object[] { }; // this IS required for dragging to work
        string title = draggedRows.Count == 1 ? draggedRows[0].displayName : "< Multiple >";

        DragAndDrop.StartDrag(title);
    }
Esempio n. 23
0
        protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
        {
            DragAndDrop.PrepareStartDrag();
            DragAndDrop.objectReferences = m_EmptyObjectList.ToArray();
            List <AssetBundleModel.AssetTreeItem> items =
                new List <AssetBundleModel.AssetTreeItem>(args.draggedItemIDs.Select(id => FindItem(id, rootItem) as AssetBundleModel.AssetTreeItem));

            DragAndDrop.paths = items.Select(a => a.AssetInfo.FullAssetName).ToArray();
            DragAndDrop.SetGenericData("AssetListTreeSource", this);
            DragAndDrop.StartDrag("AssetListTree");
        }
Esempio n. 24
0
        protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
        {
            DragAndDrop.PrepareStartDrag();
            string[] paths = FindRows(args.draggedItemIDs)
                             .Cast <BundleAssetTreeViewItem>()
                             .Select(x => x.path)
                             .ToArray();

            DragAndDrop.paths = paths;
            DragAndDrop.SetGenericData(INSIDE_DRAG_KEY, true);
            DragAndDrop.StartDrag("move");
        }
    protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
    {
        base.SetupDragAndDrop(args);

        m_Dragged.Clear();
        m_Dragged.AddRange(args.draggedItemIDs);

        DragAndDrop.objectReferences = new Object[0];
        DragAndDrop.PrepareStartDrag();
        DragAndDrop.StartDrag("Item view");
        //DragAndDrop.visualMode = DragAndDropVisualMode.Move;
    }
Esempio n. 26
0
        protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
        {
            var selectedObjects = args.draggedItemIDs.Select(i => GetObject(i)).Where(o => o).ToArray();

            if (selectedObjects.Length == 0)
            {
                return;
            }
            var paths = selectedObjects.Select(i => GetAssetPath(i)).ToArray();

            Utils.StartDrag(selectedObjects, paths, paths[0]);
        }
Esempio n. 27
0
 protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
 {
     Debug.LogFormat("Id's: \n {0}", args.draggedItemIDs);
     if (DragAndDrop.objectReferences != null && DragAndDrop.objectReferences.Length > 0)
     {
         DragAndDrop.SetGenericData(k_ObjectDragID, DragAndDrop.objectReferences);
     }
     else
     {
         base.SetupDragAndDrop(args);
     }
 }
        protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
        {
            DragAndDrop.PrepareStartDrag();
            var selectedBundles = new List <AssetBundleState.BundleInfo.TreeItem>();

            foreach (var i in args.draggedItemIDs.Select(b => Utilities.FindItem <AssetBundleState.BundleInfo.TreeItem>(rootItem, b)))
            {
                GatherAllNodes(i, selectedBundles);
            }
            DragAndDrop.SetGenericData("AssetBundleState.BundleInfo.TreeItem", selectedBundles);
            DragAndDrop.visualMode = DragAndDropVisualMode.Move;
            DragAndDrop.StartDrag("AssetBundleTree");
        }
Esempio n. 29
0
        protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
        {
            DragAndDrop.PrepareStartDrag();

            var ids   = SortItemIDsInRowOrder(args.draggedItemIDs);
            var items = new List <object>(ids.Count);

            items.AddRange(ids.Select(Model.FindByInstanceId).Where(obj => obj != null));

            var title = items.Count > 1 ? "<Multiple>" : (items[0] as INamed)?.Name ?? "<Item>";

            UTinyDragAndDrop.ObjectReferences = items.ToArray();
            UTinyDragAndDrop.StartDrag(title);
        }
Esempio n. 30
0
        protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
        {
            DragAndDrop.PrepareStartDrag();
            bool isMultiDrag = args.draggedItemIDs.Count > 1;

            if (isMultiDrag)
            {
            }
            else
            {
                DragAndDrop.SetGenericData("MissionEditor_Drag", SortItemIDsInRowOrder(args.draggedItemIDs)[0]);
            }
            DragAndDrop.StartDrag("MissionEditor");
        }