/// <inheritdoc />
        public override DragDropEffect OnDragEnter(ref Vector2 location, DragData data)
        {
            var result = base.OnDragEnter(ref location, data);

            if (result != DragDropEffect.None)
            {
                return(result);
            }

            // Check if drop file(s)
            if (data is DragDataFiles)
            {
                _validDragOver = true;
                return(DragDropEffect.Copy);
            }

            // Check if drop actor(s)
            if (_dragActors == null)
            {
                _dragActors = new DragActors(ValidateDragActors);
            }
            if (_dragActors.OnDragEnter(data))
            {
                _validDragOver = true;
                return(DragDropEffect.Move);
            }

            return(DragDropEffect.None);
        }
示例#2
0
        /// <inheritdoc />
        protected override DragDropEffect OnDragEnterHeader(DragData data)
        {
            // Check if cannot edit scene or there is no scene loaded (handle case for actors in prefab editor)
            if (_actorNode?.ParentScene != null)
            {
                if (!Editor.Instance.StateMachine.CurrentState.CanEditScene || !Level.IsAnySceneLoaded)
                {
                    return(DragDropEffect.None);
                }
            }
            else
            {
                if (!Editor.Instance.StateMachine.CurrentState.CanEditContent)
                {
                    return(DragDropEffect.None);
                }
            }

            if (_dragHandlers == null)
            {
                _dragHandlers = new DragHandlers();
            }

            // Check if drop actors
            if (_dragActors == null)
            {
                _dragActors = new DragActors(ValidateDragActor);
                _dragHandlers.Add(_dragActors);
            }
            if (_dragActors.OnDragEnter(data))
            {
                return(_dragActors.Effect);
            }

            // Check if drag assets
            if (_dragAssets == null)
            {
                _dragAssets = new DragAssets(ValidateDragAsset);
                _dragHandlers.Add(_dragAssets);
            }
            if (_dragAssets.OnDragEnter(data))
            {
                return(_dragAssets.Effect);
            }

            // Check if drag actor type
            if (_dragActorType == null)
            {
                _dragActorType = new DragActorType(ValidateDragActorType);
                _dragHandlers.Add(_dragActorType);
            }
            if (_dragActorType.OnDragEnter(data))
            {
                return(_dragActorType.Effect);
            }

            return(DragDropEffect.None);
        }
示例#3
0
        /// <inheritdoc />
        protected override DragDropEffect OnDragEnterHeader(DragData data)
        {
            // Check if cannot edit scene or there is no scene loaded
            if (!Editor.Instance.StateMachine.CurrentState.CanEditScene || !SceneManager.IsAnySceneLoaded)
            {
                return(DragDropEffect.None);
            }

            // Check if drop actors
            if (_dragActors == null)
            {
                _dragActors = new DragActors();
            }
            if (_dragActors.OnDragEnter(data, ValidateDragActor))
            {
                return(_dragActors.Effect);
            }

            // Check if drag assets
            if (_dragAssets == null)
            {
                _dragAssets = new DragAssets();
            }
            if (_dragAssets.OnDragEnter(data, ValidateDragAsset))
            {
                return(_dragAssets.Effect);
            }

            // Check if drag actor type
            if (_dragActorType == null)
            {
                _dragActorType = new DragActorType();
            }
            if (_dragActorType.OnDragEnter(data, ValidateDragActorType))
            {
                return(_dragActorType.Effect);
            }

            return(DragDropEffect.None);
        }