private void PrepareDragDrop(object sender, System.EventArgs args)
    {
        var item = (AK.Wwise.TreeView.TreeViewItem)sender;

        try
        {
            if (item == null || !item.IsDraggable)
            {
                return;
            }

            var treeInfo       = (AkTreeInfo)item.DataContext;
            var reference      = WwiseObjectReference.FindOrCreateWwiseObject(treeInfo.ObjectType, item.Header, treeInfo.Guid);
            var groupReference = reference as WwiseGroupValueObjectReference;
            if (groupReference)
            {
                var ParentTreeInfo = (AkTreeInfo)item.Parent.DataContext;
                groupReference.SetupGroupObjectReference(item.Parent.Header, ParentTreeInfo.Guid);
            }

            UnityEngine.GUIUtility.hotControl        = 0;
            UnityEditor.DragAndDrop.objectReferences = new UnityEngine.Object[] { DragDropHelperMonoScript, reference };
            UnityEditor.DragAndDrop.SetGenericData(AkDragDropHelper.DragDropIdentifier, reference);
            UnityEditor.DragAndDrop.StartDrag("Dragging an AkObject");
        }
        catch (System.Exception e)
        {
            UnityEngine.Debug.Log(e.ToString());
        }
    }
    protected override void SetupDragAndDrop(SetupDragAndDropArgs args)
    {
        UnityEditor.DragAndDrop.PrepareStartDrag();

        var draggedRows = GetRows().Where(item => args.draggedItemIDs.Contains(item.id)).ToList();
        var draggedItem = draggedRows[0] as AkWwiseTreeViewItem;

        if (draggedItem.objectGuid == System.Guid.Empty ||
            draggedItem.objectType == WwiseObjectType.Bus ||
            draggedItem.objectType == WwiseObjectType.PhysicalFolder ||
            draggedItem.objectType == WwiseObjectType.Folder ||
            draggedItem.objectType == WwiseObjectType.WorkUnit ||
            draggedItem.objectType == WwiseObjectType.Project ||
            draggedItem.objectType == WwiseObjectType.StateGroup ||
            draggedItem.objectType == WwiseObjectType.SwitchGroup)
        {
            return;
        }


        var reference = WwiseObjectReference.FindOrCreateWwiseObject(draggedItem.objectType, draggedItem.name, draggedItem.objectGuid);

        if (!reference)
        {
            return;
        }

        var groupReference = reference as WwiseGroupValueObjectReference;

        if (groupReference)
        {
            var parent = draggedItem.parent as AkWwiseTreeViewItem;
            groupReference.SetupGroupObjectReference(parent.name, parent.objectGuid);
        }

        UnityEditor.MonoScript script;
        if (DragDropMonoScriptMap.TryGetValue(reference.WwiseObjectType, out script))
        {
            UnityEngine.GUIUtility.hotControl = 0;
            UnityEditor.DragAndDrop.PrepareStartDrag();
            UnityEditor.DragAndDrop.objectReferences = new UnityEngine.Object[] { script };
            AkWwiseTypes.DragAndDropObjectReference  = reference;
            UnityEditor.DragAndDrop.StartDrag("Dragging an AkObject");
        }
    }
Exemple #3
0
    private void SetGuid(AK.Wwise.TreeView.TreeViewItem in_item)
    {
        m_serializedObject.Update();

        var obj            = in_item.DataContext as AkWwiseTreeView.AkTreeInfo;
        var reference      = WwiseObjectReference.FindOrCreateWwiseObject(m_type, in_item.Header, obj.Guid);
        var groupReference = reference as WwiseGroupValueObjectReference;

        if (groupReference)
        {
            obj = in_item.Parent.DataContext as AkWwiseTreeView.AkTreeInfo;
            groupReference.SetupGroupObjectReference(in_item.Parent.Header, obj.Guid);
        }

        m_WwiseObjectReference.objectReferenceValue = reference;

        m_serializedObject.ApplyModifiedProperties();
    }
    private void PrepareDragDrop(object sender, System.EventArgs args)
    {
        var item = (TreeViewItem)sender;

        try
        {
            if (item == null || !item.IsDraggable)
            {
                return;
            }

            var treeInfo  = (AkTreeInfo)item.DataContext;
            var reference = WwiseObjectReference.FindOrCreateWwiseObject(treeInfo.ObjectType, item.Header, treeInfo.Guid);
            if (!reference)
            {
                return;
            }

            var groupReference = reference as WwiseGroupValueObjectReference;
            if (groupReference)
            {
                var ParentTreeInfo = (AkTreeInfo)item.Parent.DataContext;
                groupReference.SetupGroupObjectReference(item.Parent.Header, ParentTreeInfo.Guid);
            }

            MonoScript script;
            if (DragDropMonoScriptMap.TryGetValue(reference.WwiseObjectType, out script))
            {
                GUIUtility.hotControl = 0;
                DragAndDrop.PrepareStartDrag();
                DragAndDrop.objectReferences           = new Object[] { script };
                AkUtilities.DragAndDropObjectReference = reference;
                DragAndDrop.StartDrag("Dragging an AkObject");
            }
        }
        catch (System.Exception e)
        {
            Debug.Log(e.ToString());
        }
    }
Exemple #5
0
 public void SetupReference(string name, System.Guid guid)
 {
     ObjectReference = WwiseObjectReference.FindOrCreateWwiseObject(WwiseObjectType, name, guid);
 }