Exemple #1
0
    public void CustomIconHandler(object sender, System.EventArgs args)
    {
        TreeViewItem item     = (TreeViewItem)sender;
        AkTreeInfo   treeInfo = (AkTreeInfo)item.DataContext;

        switch (treeInfo.ObjectType)
        {
        case AkWwiseProjectData.WwiseObjectType.AUXBUS:
            ShowButtonTextureInternal(m_textureWwiseAuxBusIcon);
            break;

        case AkWwiseProjectData.WwiseObjectType.BUS:
            ShowButtonTextureInternal(m_textureWwiseBusIcon);
            break;

        case AkWwiseProjectData.WwiseObjectType.EVENT:
        case AkWwiseProjectData.WwiseObjectType.GAMEPARAMETER:
            ShowButtonTextureInternal(m_textureWwiseEventIcon);
            break;

        case AkWwiseProjectData.WwiseObjectType.FOLDER:
            ShowButtonTextureInternal(m_textureWwiseFolderIcon);
            break;

        case AkWwiseProjectData.WwiseObjectType.PHYSICALFOLDER:
            ShowButtonTextureInternal(m_textureWwisePhysicalFolderIcon);
            break;

        case AkWwiseProjectData.WwiseObjectType.PROJECT:
            ShowButtonTextureInternal(m_textureWwiseProjectIcon);
            break;

        case AkWwiseProjectData.WwiseObjectType.SOUNDBANK:
            ShowButtonTextureInternal(m_textureWwiseSoundbankIcon);
            break;

        case AkWwiseProjectData.WwiseObjectType.STATE:
            ShowButtonTextureInternal(m_textureWwiseStateIcon);
            break;

        case AkWwiseProjectData.WwiseObjectType.STATEGROUP:
            ShowButtonTextureInternal(m_textureWwiseStateGroupIcon);
            break;

        case AkWwiseProjectData.WwiseObjectType.SWITCH:
            ShowButtonTextureInternal(m_textureWwiseSwitchIcon);
            break;

        case AkWwiseProjectData.WwiseObjectType.SWITCHGROUP:
            ShowButtonTextureInternal(m_textureWwiseSwitchGroupIcon);
            break;

        case AkWwiseProjectData.WwiseObjectType.WORKUNIT:
            ShowButtonTextureInternal(m_textureWwiseWorkUnitIcon);
            break;

        default:
            break;
        }
    }
Exemple #2
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;
            // GenericData[0] contains the component's name (string)
            // GenericData[1] contains the component's Guid (Guid)
            // GenericData[2] contains the component's AkGameObjID (int)
            // GenericData[3] contains the object's type (string)
            // We need two more fields for states and switches:
            // GenericData[4] contains the state or switch group Guid (Guid)
            // GenericData[5] contains the state or switch group AkGameObjID (int)
            object[] DDInfo = null;
            if (item != null)
            {
                string objType = GetObjectType(treeInfo.ObjectType);
                if (objType == "State" || objType == "Switch")
                {
                    AkTreeInfo ParentTreeInfo = (AkTreeInfo)item.Parent.DataContext;
                    DDInfo    = new object[6];
                    DDInfo[4] = new Guid(ParentTreeInfo.Guid);
                    DDInfo[5] = ParentTreeInfo.ID;
                }
                else
                {
                    DDInfo = new object[4];
                }
                DDInfo[1] = new Guid(treeInfo.Guid);
                DDInfo[2] = treeInfo.ID;
                DDInfo[3] = objType;
            }
            else
            {
                DDInfo = new object[1];
            }
            DDInfo[0]                    = item.Header;
            objectReferences[0]          = DragDropHelperMonoScript;
            DragAndDrop.objectReferences = objectReferences;
            DragAndDrop.SetGenericData("AKWwiseDDInfo", DDInfo);
            DragAndDrop.StartDrag("Dragging an AkObject");
        }
        catch (Exception e)
        {
            Debug.Log(e.ToString());
        }
    }
Exemple #3
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;
            GUIUtility.hotControl        = 0;
            DragAndDrop.objectReferences = objectReferences;
            DragAndDrop.SetGenericData(AkDragDropHelper.DragDropIdentifier, DDData);
            DragAndDrop.StartDrag("Dragging an AkObject");
        }
        catch (Exception e)
        {
            Debug.Log(e.ToString());
        }
    }
Exemple #4
0
    public void CustomIconHandler(object sender, System.EventArgs args)
    {
        TreeViewItem item     = (TreeViewItem)sender;
        AkTreeInfo   treeInfo = (AkTreeInfo)item.DataContext;

        switch (treeInfo.ObjectType)
        {
        case AkWwiseProjectData.WwiseObjectType.AUXBUS:
            if (null == m_textureWwiseAuxBusIcon ||
                m_forceButtonText)
            {
                GUILayout.Button("", GUILayout.MaxWidth(16));
            }
            else
            {
                ShowButtonTexture(m_textureWwiseAuxBusIcon);
            }
            break;

        case AkWwiseProjectData.WwiseObjectType.BUS:
            if (null == m_textureWwiseBusIcon ||
                m_forceButtonText)
            {
                GUILayout.Button("", GUILayout.MaxWidth(16));
            }
            else
            {
                ShowButtonTexture(m_textureWwiseBusIcon);
            }
            break;

        case AkWwiseProjectData.WwiseObjectType.EVENT:
            if (null == m_textureWwiseEventIcon ||
                m_forceButtonText)
            {
                GUILayout.Button("", GUILayout.MaxWidth(16));
            }
            else
            {
                ShowButtonTexture(m_textureWwiseEventIcon);
            }
            break;

        case AkWwiseProjectData.WwiseObjectType.FOLDER:
            if (null == m_textureWwiseFolderIcon ||
                m_forceButtonText)
            {
                GUILayout.Button("", GUILayout.MaxWidth(16));
            }
            else
            {
                ShowButtonTexture(m_textureWwiseFolderIcon);
            }
            break;

        case AkWwiseProjectData.WwiseObjectType.PHYSICALFOLDER:
            if (null == m_textureWwisePhysicalFolderIcon ||
                m_forceButtonText)
            {
                GUILayout.Button("", GUILayout.MaxWidth(16));
            }
            else
            {
                ShowButtonTexture(m_textureWwisePhysicalFolderIcon);
            }
            break;

        case AkWwiseProjectData.WwiseObjectType.PROJECT:
            if (null == m_textureWwiseProjectIcon ||
                m_forceButtonText)
            {
                GUILayout.Button("", GUILayout.MaxWidth(16));
            }
            else
            {
                ShowButtonTexture(m_textureWwiseProjectIcon);
            }
            break;

        case AkWwiseProjectData.WwiseObjectType.SOUNDBANK:
            if (null == m_textureWwiseSoundbankIcon ||
                m_forceButtonText)
            {
                GUILayout.Button("", GUILayout.MaxWidth(16));
            }
            else
            {
                ShowButtonTexture(m_textureWwiseSoundbankIcon);
            }
            break;

        case AkWwiseProjectData.WwiseObjectType.STATE:
            if (null == m_textureWwiseStateIcon ||
                m_forceButtonText)
            {
                GUILayout.Button("", GUILayout.MaxWidth(16));
            }
            else
            {
                ShowButtonTexture(m_textureWwiseStateIcon);
            }
            break;

        case AkWwiseProjectData.WwiseObjectType.STATEGROUP:
            if (null == m_textureWwiseStateGroupIcon ||
                m_forceButtonText)
            {
                GUILayout.Button("", GUILayout.MaxWidth(16));
            }
            else
            {
                ShowButtonTexture(m_textureWwiseStateGroupIcon);
            }
            break;

        case AkWwiseProjectData.WwiseObjectType.SWITCH:
            if (null == m_textureWwiseSwitchIcon ||
                m_forceButtonText)
            {
                GUILayout.Button("", GUILayout.MaxWidth(16));
            }
            else
            {
                ShowButtonTexture(m_textureWwiseSwitchIcon);
            }
            break;

        case AkWwiseProjectData.WwiseObjectType.SWITCHGROUP:
            if (null == m_textureWwiseSwitchGroupIcon ||
                m_forceButtonText)
            {
                GUILayout.Button("", GUILayout.MaxWidth(16));
            }
            else
            {
                ShowButtonTexture(m_textureWwiseSwitchGroupIcon);
            }
            break;

        case AkWwiseProjectData.WwiseObjectType.WORKUNIT:
            if (null == m_textureWwiseWorkUnitIcon ||
                m_forceButtonText)
            {
                GUILayout.Button("", GUILayout.MaxWidth(16));
            }
            else
            {
                ShowButtonTexture(m_textureWwiseWorkUnitIcon);
            }
            break;

        default:
            break;
        }
    }
Exemple #5
0
    void PrepareDragDrop(object sender, System.EventArgs args)
    {
        TreeViewItem     item    = (TreeViewItem)sender;
        AkDragDropHelper helper  = null;
        GameObject       tempObj = null;

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

            AkTreeInfo           treeInfo         = (AkTreeInfo)item.DataContext;
            UnityEngine.Object[] objectReferences = new UnityEngine.Object[1];
            MonoScript           componentScript  = null;
            // Instantiate a temp Game Object to attach the correct component to it
            tempObj         = new GameObject();
            helper          = tempObj.AddComponent <AkDragDropHelper>();
            componentScript = MonoScript.FromMonoBehaviour(helper);

            // We are using paths for passing our drag and drop information, because we couldn't get DragAndDrop.SetGenericData to work.
            // DragAndDrop.paths[0] contains the component's name
            // DragAndDrop.paths[1] contains the component's Guid
            // DragAndDrop.paths[2] contains the component's AkGameObjID
            // DragAndDrop.paths[3] contains the object's type
            // We need two more fields for states and switches:
            // DragAndDrop.paths[4] contains the state or switch group Guid
            // DragAndDrop.paths[5] contains the state or switch group AkGameObjID
            string[] paths = null;
            if (item != null)
            {
                string objType = GetObjectType(treeInfo.ObjectType);
                if (objType == "State" || objType == "Switch")
                {
                    AkTreeInfo ParentTreeInfo = (AkTreeInfo)item.Parent.DataContext;
                    paths    = new string[6];
                    paths[4] = new Guid(ParentTreeInfo.Guid).ToString();
                    paths[5] = ParentTreeInfo.ID.ToString();
                }
                else
                {
                    paths = new string[4];
                }
                paths[1] = new Guid(treeInfo.Guid).ToString();
                paths[2] = treeInfo.ID.ToString();
                paths[3] = objType;
            }
            else
            {
                paths = new string[1];
            }
            paths[0]                     = item.Header;
            objectReferences[0]          = componentScript;
            DragAndDrop.objectReferences = objectReferences;
            DragAndDrop.paths            = paths;
            DragAndDrop.StartDrag("Dragging an AkObject");
        }
        catch (Exception e)
        {
            Debug.Log(e.ToString());
        }

        if (helper != null)
        {
            Component.DestroyImmediate(helper);
        }

        if (tempObj != null)
        {
            UnityEngine.Object.DestroyImmediate(tempObj);
        }
    }