예제 #1
0
        protected override bool CanDropObjects(InAudioBankLink node, Object[] objects)
        {
            if (node == null || objects == null)
            {
                return(false);
            }

            if (objects.Length > 0 && objects[0] as InAudioBankLink != null && node._type != AudioBankTypes.Bank)
            {
                return(!NodeWorker.IsChildOf(objects[0] as InAudioBankLink, node));
            }
            return(false);
        }
        public static bool CanDropObjects(InAudioEventNode audioEvent, Object[] objects)
        {
            if (objects.Length == 0 || audioEvent == null)
            {
                return(false);
            }

            if (audioEvent._type == EventNodeType.Event)
            {
                var nonEventDrop = CanDropNonEvent(objects);

                return(nonEventDrop);
            }
            else if (audioEvent._type == EventNodeType.Folder || audioEvent._type == EventNodeType.Root)
            {
                var draggingEvent = objects[0] as InAudioEventNode;
                if (draggingEvent != null)
                {
                    if (draggingEvent._type == EventNodeType.Event)
                    {
                        return(true);
                    }
                    if ((draggingEvent._type == EventNodeType.Folder && !NodeWorker.IsChildOf(draggingEvent, audioEvent)) ||
                        draggingEvent._type == EventNodeType.EventGroup)
                    {
                        return(true);
                    }
                }
                else
                {
                    var nonEventDrop = CanDropNonEvent(objects) && !audioEvent.IsRootOrFolder;

                    return(nonEventDrop);
                }
            }
            else if (audioEvent._type == EventNodeType.EventGroup)
            {
                var draggingEvent = objects[0] as InAudioEventNode;
                if (draggingEvent == null)
                {
                    return(false);
                }
                if (draggingEvent._type == EventNodeType.Event)
                {
                    return(true);
                }
            }


            return(false);
        }
예제 #3
0
        protected override bool CanDropObjects(InAudioNode node, UnityEngine.Object[] objects)
        {
            if (node == null || objects == null)
            {
                return(false);
            }

            int clipCount = DragAndDrop.objectReferences.Count(p => p is AudioClip);
            int nodeCount = DragAndDrop.objectReferences.Count(p => p is InAudioNode);

            if (DragAndDrop.objectReferences.Length == 0)
            {
                return(false);
            }

            if (clipCount == objects.Length) //Handle clip count
            {
                //clipCount == 1 means it overrides the current clip
                if (node.Type == AudioNodeType.Audio && clipCount != 1)
                {
                    return(false);
                }
                return(true);
            }
            else if (nodeCount == objects.Length)     //Handle audio node drag n drop
            {
                if (node.Type == AudioNodeType.Audio) //Can't drop on an audionode as it can't have children
                {
                    return(false);
                }

                var draggingNode = objects[0] as InAudioNode;

                if (!node.IsRootOrFolder && draggingNode.IsRootOrFolder)
                {
                    return(false);
                }

                if (node == draggingNode)
                {
                    return(false);
                }

                return(!NodeWorker.IsChildOf(objects[0] as InAudioNode, node));
            }
            return(false);
        }