示例#1
0
        public override DragAndDropVisualMode DoDrag(TreeViewItem parentItem, TreeViewItem targetItem, bool perform, TreeViewDragging.DropPosition dropPos)
        {
            this.m_Window.isDragging = false;
            DragAndDropVisualMode dragAndDropVisualMode = 0;

            TimelineDragging.TimelineDragData timelineDragData = DragAndDrop.GetGenericData("TimelineDragging") as TimelineDragging.TimelineDragData;
            if (timelineDragData != null)
            {
                dragAndDropVisualMode = this.HandleTrackDrop(parentItem, targetItem, perform, dropPos);
            }
            else if (DragAndDrop.get_objectReferences().Any <Object>() || DragAndDrop.get_paths().Any <string>())
            {
                dragAndDropVisualMode = this.HandleGameObjectDrop(parentItem, targetItem, perform, dropPos);
                if (dragAndDropVisualMode == null)
                {
                    dragAndDropVisualMode = this.HandleAudioSourceDrop(parentItem, targetItem, perform, dropPos);
                }
                if (dragAndDropVisualMode == null)
                {
                    dragAndDropVisualMode = this.HandleObjectDrop(parentItem, targetItem, perform, dropPos);
                }
            }
            this.m_Window.isDragging = false;
            if (dragAndDropVisualMode == 1 && targetItem != null)
            {
                TimelineGroupGUI timelineGroupGUI = targetItem as TimelineGroupGUI;
                if (timelineGroupGUI != null)
                {
                    timelineGroupGUI.isDropTarget = true;
                }
            }
            return(dragAndDropVisualMode);
        }
示例#2
0
        public DragAndDropVisualMode HandleTrackDrop(TreeViewItem parentItem, TreeViewItem targetItem, bool perform, TreeViewDragging.DropPosition dropPos)
        {
            ((TimelineTreeView)this.m_Window.treeView.gui).showInsertionMarker = false;
            TimelineDragging.TimelineDragData timelineDragData = (TimelineDragging.TimelineDragData)DragAndDrop.GetGenericData("TimelineDragging");
            DragAndDropVisualMode             result;

            if (!TimelineDragging.ValidDrag(targetItem, timelineDragData.draggedItems))
            {
                result = 0;
            }
            else
            {
                TimelineGroupGUI timelineGroupGUI = targetItem as TimelineGroupGUI;
                if (timelineGroupGUI != null && timelineGroupGUI.track != null)
                {
                    ((TimelineTreeView)this.m_Window.treeView.gui).showInsertionMarker = true;
                }
                if (dropPos == null)
                {
                    TimelineGroupGUI timelineGroupGUI2 = targetItem as TimelineGroupGUI;
                    if (timelineGroupGUI2 != null)
                    {
                        timelineGroupGUI2.isDropTarget = true;
                    }
                }
                if (perform)
                {
                    List <TrackAsset> draggedActors = (from x in timelineDragData.draggedItems.OfType <TimelineGroupGUI>()
                                                       select x.track).ToList <TrackAsset>();
                    if (draggedActors.Count == 0)
                    {
                        result = 0;
                        return(result);
                    }
                    PlayableAsset    playableAsset     = this.m_Timeline;
                    TimelineGroupGUI timelineGroupGUI3 = parentItem as TimelineGroupGUI;
                    if (timelineGroupGUI3 != null && timelineGroupGUI3.track != null)
                    {
                        playableAsset = timelineGroupGUI3.track;
                    }
                    TrackAsset trackAsset = (timelineGroupGUI == null) ? null : timelineGroupGUI.track;
                    if (playableAsset == this.m_Timeline && dropPos == 1 && trackAsset == null)
                    {
                        trackAsset = this.m_Timeline.tracks.LastOrDefault((TrackAsset x) => !draggedActors.Contains(x));
                    }
                    if (TrackExtensions.ReparentTracks(draggedActors, playableAsset, trackAsset, dropPos == 2))
                    {
                        this.m_Window.state.Refresh(true);
                    }
                }
                result = 16;
            }
            return(result);
        }