Пример #1
0
            /// <inheritdoc />
            public override DragDropEffect OnDragEnter(ref Vector2 location, DragData data)
            {
                var result = base.OnDragEnter(ref location, data);

                if (result == DragDropEffect.None)
                {
                    if (_dragHandlers == null)
                    {
                        _dragHandlers = new DragHandlers();
                    }
                    if (_dragAssets == null)
                    {
                        _dragAssets = new DragAssets(ValidateDragAsset);
                        _dragHandlers.Add(_dragAssets);
                    }
                    if (_dragAssets.OnDragEnter(data))
                    {
                        return(_dragAssets.Effect);
                    }
                    if (_dragActorType == null)
                    {
                        _dragActorType = new DragActorType(ValidateDragActorType);
                        _dragHandlers.Add(_dragActorType);
                    }
                    if (_dragActorType.OnDragEnter(data))
                    {
                        return(_dragActorType.Effect);
                    }
                }
                return(result);
            }
Пример #2
0
        /// <inheritdoc />
        public override DragDropEffect OnDragEnter(ref Float2 location, DragData data)
        {
            var result = base.OnDragEnter(ref location, data);

            if (Editor.StateMachine.CurrentState.CanEditScene)
            {
                if (_dragHandlers == null)
                {
                    _dragHandlers = new DragHandlers();
                }
                if (_dragAssets == null)
                {
                    _dragAssets = new DragAssets(ValidateDragAsset);
                    _dragHandlers.Add(_dragAssets);
                }
                if (_dragAssets.OnDragEnter(data) && result == DragDropEffect.None)
                {
                    return(_dragAssets.Effect);
                }
                if (_dragActorType == null)
                {
                    _dragActorType = new DragActorType(ValidateDragActorType);
                    _dragHandlers.Add(_dragActorType);
                }
                if (_dragActorType.OnDragEnter(data) && result == DragDropEffect.None)
                {
                    return(_dragActorType.Effect);
                }
            }
            return(result);
        }
Пример #3
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);
        }
Пример #4
0
            public override void OnDestroy()
            {
                _window        = null;
                _dragAssets    = null;
                _dragActorType = null;
                _dragHandlers?.Clear();
                _dragHandlers = null;

                base.OnDestroy();
            }
Пример #5
0
        /// <inheritdoc />
        public override void OnDestroy()
        {
            _dragAssets    = null;
            _dragActorType = null;
            _dragHandlers?.Clear();
            _dragHandlers = null;
            _tree         = null;
            _searchBox    = null;

            base.OnDestroy();
        }
Пример #6
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);
        }