Beispiel #1
0
        public static InAudioEventNode CreateNode(InAudioEventNode parent, EventNodeType type)
        {
            var child = CreateEvent(parent.gameObject, parent, GUIDCreator.Create(), type);

            child.FoldedOut = true;

            return(child);
        }
Beispiel #2
0
        public static T AddEventAction <T>(InAudioEventNode audioevent, EventActionTypes enumType) where T : AudioEventAction
        {
            var eventAction = audioevent.gameObject.AddComponentUndo <T>();

            audioevent.ActionList.Add(eventAction);
            eventAction.EventActionType = enumType;
            return(eventAction);
        }
Beispiel #3
0
 public static void DeleteNode(InAudioEventNode node)
 {
     UndoHelper.DoInGroup(() =>
     {
         UndoHelper.RegisterUndo(node.Parent, "Event Deletion");
         node.Parent.Children.Remove(node);
         DeleteNodeRec(node);
     });
 }
Beispiel #4
0
        private static InAudioEventNode CreateEvent(GameObject go, InAudioEventNode parent, int guid, EventNodeType type)
        {
            var node = go.AddComponentUndo <InAudioEventNode>();

            node.Type = type;
            node.GUID = guid;
            node.Name = parent.Name + " Child";
            node.AssignParent(parent);
            return(node);
        }
Beispiel #5
0
        public static InAudioEventNode DeleteActionAtIndex(InAudioEventNode audioevent, int index)
        {
            UndoHelper.RecordObject(audioevent, "Event Action Creation");
            UndoHelper.Destroy(audioevent.ActionList[index]);


            audioevent.ActionList.RemoveAt(index);

            return(audioevent);
        }
Beispiel #6
0
        public static AudioEventAction AddEventAction(InAudioEventNode audioevent, Type eventActionType, EventActionTypes enumType)
        {
            UndoHelper.RecordObject(audioevent, "Event Action Creation");
            var eventAction = audioevent.gameObject.AddComponentUndo(eventActionType) as AudioEventAction;

            audioevent.ActionList.Add(eventAction);
            eventAction.EventActionType = enumType;

            return(eventAction);
        }
Beispiel #7
0
        public static bool CanDropObjects(InAudioEventNode audioEvent, Object[] objects)
        {
            if (objects.Length == 0 || audioEvent == null)
            {
                return(false);
            }

            if (audioEvent.Type == EventNodeType.Event)
            {
                bool bankLinkDrop;
                bool audioBusDrop;
                var  audioNodeDrop = CanDropNonEvent(objects, out bankLinkDrop, out audioBusDrop);

                return(audioNodeDrop | bankLinkDrop | audioBusDrop);
            }
            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
                {
                    bool bankLinkDrop;
                    bool audioBusDrop;
                    var  audioNodeDrop = CanDropNonEvent(objects, out bankLinkDrop, out audioBusDrop);

                    return(audioNodeDrop | bankLinkDrop | audioBusDrop);
                }
            }
            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);
        }
Beispiel #8
0
 public static InAudioEventNode Duplicate(InAudioEventNode audioEvent)
 {
     return(NodeWorker.DuplicateHierarchy(audioEvent, (@oldNode, newNode) =>
     {
         newNode.ActionList.Clear();
         for (int i = 0; i < oldNode.ActionList.Count; i++)
         {
             newNode.ActionList.Add(NodeWorker.CopyComponent(oldNode.ActionList[i]));
         }
     }));
 }
 private void BuildEventSet(InAudioEventNode audioevent, Dictionary <int, InAudioEventNode> events)
 {
     if (audioevent.IsRootOrFolder)
     {
         events[audioevent._guid] = audioevent;
     }
     for (int i = 0; i < audioevent._children.Count; ++i)
     {
         BuildEventSet(audioevent._children[i], events);
     }
 }
Beispiel #10
0
        private static void DeleteNodeRec(InAudioEventNode node)
        {
            for (int i = 0; i < node.ActionList.Count; i++)
            {
                UndoHelper.Destroy(node.ActionList[i]);
            }
            for (int i = 0; i < node.Children.Count; ++i)
            {
                DeleteNodeRec(node.Children[i]);
            }

            UndoHelper.Destroy(node);
        }
Beispiel #11
0
        public static bool OnDrop(InAudioEventNode audioevent, Object[] objects)
        {
            UndoHelper.DoInGroup(() =>
            {
                //if (audioevent.Type == EventNodeType.Folder)
                //{
                //    UndoHelper.RecordObjectInOld(audioevent, "Created event");
                //    audioevent = CreateNode(audioevent, EventNodeType.Event);
                //}

                if (objects[0] as InAudioEventNode)
                {
                    var movingEvent = objects[0] as InAudioEventNode;

                    UndoHelper.RecordObjectFull(new Object[] { audioevent, movingEvent, movingEvent.Parent }, "Event Move");
                    NodeWorker.ReasignNodeParent((InAudioEventNode)objects[0], audioevent);
                    audioevent.IsFoldedOut = true;
                }

                var audioNode = objects[0] as InAudioNode;
                if (audioNode != null && audioNode.IsPlayable)
                {
                    UndoHelper.RecordObjectFull(audioevent, "Adding of Audio Action");
                    var action = AddEventAction <InEventAudioAction>(audioevent,
                                                                     EventActionTypes.Play);
                    action.Node = audioNode;
                }

                var audioBank = objects[0] as InAudioBankLink;
                if (audioBank != null)
                {
                    UndoHelper.RecordObjectFull(audioevent, "Adding of Bank Load Action");
                    var action = AddEventAction <InEventBankLoadingAction>(audioevent,
                                                                           EventActionTypes.BankLoading);
                    action.BankLink = audioBank;
                }

                var audioBus = objects[0] as InAudioBus;
                if (audioBus != null)
                {
                    UndoHelper.RecordObjectFull(audioevent, "Adding of Bus Volume");
                    var action = AddEventAction <InEventBusAction>(audioevent, EventActionTypes.SetBusVolume);
                    action.Bus = audioBus;
                }
                Event.current.Use();
            });
            return(true);
        }
Beispiel #12
0
        public static void ReplaceActionDestructiveAt(InAudioEventNode audioEvent, EventActionTypes enumType, int toRemoveAndInsertAt)
        {
            //A reel mess this function.
            //It adds a new component of the specied type, replaces the current at the toRemoveAndInsertAt index, and then deletes the old one
            float  delay         = audioEvent.ActionList[toRemoveAndInsertAt].Delay;
            Object target        = audioEvent.ActionList[toRemoveAndInsertAt].Target;
            var    newActionType = ActionEnumToType(enumType);

            UndoHelper.Destroy(audioEvent.ActionList[toRemoveAndInsertAt]);
            //UndoHelper.RecordObject(audioEvent, "Event Action Creation");

            audioEvent.ActionList.RemoveAt(toRemoveAndInsertAt);
            var added = AddEventAction(audioEvent, newActionType, enumType);

            added.Delay  = delay;
            added.Target = target; //Attempt to set the new value, will only work if it is the same type

            audioEvent.ActionList.Insert(toRemoveAndInsertAt, added);
            audioEvent.ActionList.RemoveLast();
        }
Beispiel #13
0
 public EventHookListData(InAudioEventNode audioEvent)
 {
     Event = audioEvent;
 }
 public void UpdateEvents(InAudioEventNode root)
 {
     Events = new Dictionary <int, InAudioEventNode>();
     BuildEventSet(root, Events);
 }