Esempio n. 1
0
    void CreateSwitch(AkDragDropGroupData DDGroupData)
    {
        AkSwitch akSwitch = Undo.AddComponent <AkSwitch>(gameObject);

        if (akSwitch != null)
        {
            SetTypeValue(ref akSwitch.valueGuid, ref akSwitch.valueID, DDGroupData);
            SetGroupTypeValue(ref akSwitch.groupGuid, ref akSwitch.groupID, DDGroupData);
        }
    }
Esempio n. 2
0
    void CreateState(AkDragDropGroupData DDGroupData)
    {
        AkState akState = Undo.AddComponent <AkState>(gameObject);

        if (akState != null)
        {
            SetTypeValue(ref akState.valueGuid, ref akState.valueID, DDGroupData);
            SetGroupTypeValue(ref akState.groupGuid, ref akState.groupID, DDGroupData);
        }
    }
Esempio n. 3
0
        private void HandleDragAndDrop(UnityEngine.Event currentEvent, Rect dropArea)
        {
            if (currentEvent.type == EventType.DragExited)
            {
                // clear dragged data
                DragAndDrop.PrepareStartDrag();
            }
            else if (currentEvent.type == EventType.DragUpdated || currentEvent.type == EventType.DragPerform)
            {
                if (dropArea.Contains(currentEvent.mousePosition))
                {
                    var DDData = GetAkDragDropData();

                    if (currentEvent.type == EventType.DragUpdated)
                    {
                        DragAndDrop.visualMode = DDData != null ? DragAndDropVisualMode.Link : DragAndDropVisualMode.Rejected;
                    }
                    else
                    {
                        DragAndDrop.AcceptDrag();

                        if (DDData != null)
                        {
                            AkUtilities.SetByteArrayProperty(m_guidProperty[0], DDData.guid.ToByteArray());
                            m_IDProperty[0].intValue = DDData.ID;

                            AkDragDropGroupData DDGroupData = DDData as AkDragDropGroupData;
                            if (DDGroupData != null)
                            {
                                if (m_guidProperty.Length > 1)
                                {
                                    AkUtilities.SetByteArrayProperty(m_guidProperty[1], DDGroupData.groupGuid.ToByteArray());
                                }
                                if (m_IDProperty.Length > 1)
                                {
                                    m_IDProperty[1].intValue = DDGroupData.groupID;
                                }
                            }

                            //needed for the undo operation to work
                            GUIUtility.hotControl = 0;
                        }
                    }
                    currentEvent.Use();
                }
            }
        }
Esempio n. 4
0
    private void PrepareDragDrop(object sender, System.EventArgs args)
    {
        var item = (AK.Wwise.TreeView.TreeViewItem)sender;

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

            var objectReferences = new UnityEngine.Object[1];
            var treeInfo         = (AkTreeInfo)item.DataContext;

            AkDragDropData DDData = null;

            var objType = GetObjectType(treeInfo.ObjectType);
            if (objType == "State" || objType == "Switch")
            {
                var DDGroupData    = new AkDragDropGroupData();
                var ParentTreeInfo = (AkTreeInfo)item.Parent.DataContext;
                DDGroupData.groupGuid = new System.Guid(ParentTreeInfo.Guid);
                DDGroupData.groupID   = ParentTreeInfo.ID;
                DDData = DDGroupData;
            }
            else
            {
                DDData = new AkDragDropData();
            }

            DDData.name     = item.Header;
            DDData.guid     = new System.Guid(treeInfo.Guid);
            DDData.ID       = treeInfo.ID;
            DDData.typeName = objType;

            objectReferences[0] = DragDropHelperMonoScript;
            UnityEngine.GUIUtility.hotControl        = 0;
            UnityEditor.DragAndDrop.objectReferences = objectReferences;
            UnityEditor.DragAndDrop.SetGenericData(AkDragDropHelper.DragDropIdentifier, DDData);
            UnityEditor.DragAndDrop.StartDrag("Dragging an AkObject");
        }
        catch (System.Exception e)
        {
            UnityEngine.Debug.Log(e.ToString());
        }
    }
Esempio n. 5
0
    void PrepareDragDrop(object sender, System.EventArgs args)
    {
        TreeViewItem item = (TreeViewItem)sender;

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

            UnityEngine.Object[] objectReferences = new UnityEngine.Object[1];
            AkTreeInfo           treeInfo         = (AkTreeInfo)item.DataContext;

            AkDragDropData DDData = null;

            string objType = GetObjectType(treeInfo.ObjectType);
            if (objType == "State" || objType == "Switch")
            {
                AkDragDropGroupData DDGroupData    = new AkDragDropGroupData();
                AkTreeInfo          ParentTreeInfo = (AkTreeInfo)item.Parent.DataContext;
                DDGroupData.groupGuid = new Guid(ParentTreeInfo.Guid);
                DDGroupData.groupID   = ParentTreeInfo.ID;
                DDData = DDGroupData;
            }
            else
            {
                DDData = new AkDragDropData();
            }

            DDData.name     = item.Header;
            DDData.guid     = new Guid(treeInfo.Guid);
            DDData.ID       = treeInfo.ID;
            DDData.typeName = objType;

            objectReferences[0]          = DragDropHelperMonoScript;
            DragAndDrop.objectReferences = objectReferences;
            DragAndDrop.SetGenericData(AkDragDropHelper.DragDropIdentifier, DDData);
            DragAndDrop.StartDrag("Dragging an AkObject");
        }
        catch (Exception e)
        {
            Debug.Log(e.ToString());
        }
    }
Esempio n. 6
0
 void SetGroupTypeValue(ref byte[] groupGuid, ref int groupID, AkDragDropGroupData DDGroupData)
 {
     DDGroupData.groupGuid.ToByteArray().CopyTo(groupGuid, 0);
     groupID = DDGroupData.groupID;
 }