Exemplo n.º 1
0
    protected override void ContextClickedItem(int id)
    {
        UnityEditor.GenericMenu menu = new UnityEditor.GenericMenu();
        var item = Find(id);

        if (CheckWaapi())
        {
            if (CanPlay(item))
            {
                menu.AddItem(UnityEditor.EditorGUIUtility.TrTextContent("Play \u2215 Stop _SPACE"), false,
                             () => AkWaapiUtilities.TogglePlayEvent(item.objectType, item.objectGuid));
            }
            else
            {
                menu.AddDisabledItem(UnityEditor.EditorGUIUtility.TrTextContent("Play \u2215 Stop _Space"));
            }

            menu.AddItem(UnityEditor.EditorGUIUtility.TrTextContent("Stop All"), false,
                         () => AkWaapiUtilities.StopAllTransports());

            menu.AddSeparator("");

            if (CanRenameWithLog(item, false))
            {
                menu.AddItem(UnityEditor.EditorGUIUtility.TrTextContent("Rename _F2"), false,
                             () => BeginRename(item));
            }
            else
            {
                menu.AddDisabledItem(UnityEditor.EditorGUIUtility.TrTextContent("Rename"));
            }

            if (CanDelete(item, false))
            {
                menu.AddItem(UnityEditor.EditorGUIUtility.TrTextContent("Delete _Delete"), false,
                             () => AkWaapiUtilities.Delete(item.objectGuid));
            }
            else
            {
                menu.AddDisabledItem(UnityEditor.EditorGUIUtility.TrTextContent("Delete"));
            }

            menu.AddSeparator("");
            if (item.objectType == WwiseObjectType.Soundbank)
            {
                menu.AddItem(UnityEditor.EditorGUIUtility.TrTextContent("Open Folder/WorkUnit #O"), false,
                             () => AkWaapiUtilities.OpenWorkUnitInExplorer(item.objectGuid));
                menu.AddItem(UnityEditor.EditorGUIUtility.TrTextContent("Open Folder/SoundBank "), false,
                             () => AkWaapiUtilities.OpenSoundBankInExplorer(item.objectGuid));
            }
            else
            {
                menu.AddItem(UnityEditor.EditorGUIUtility.TrTextContent("Open Containing Folder #O"), false,
                             () => AkWaapiUtilities.OpenWorkUnitInExplorer(item.objectGuid));
            }

            menu.AddItem(UnityEditor.EditorGUIUtility.TrTextContent("Find in Project Explorer #F"), false,
                         () => m_dataSource.SelectObjectInAuthoring(item.objectGuid));
        }
        else
        {
            if (AkWwiseProjectInfo.GetData().currentDataSource == AkWwiseProjectInfo.DataSourceType.WwiseAuthoring)
            {
                menu.AddItem(UnityEditor.EditorGUIUtility.TrTextContent("Wwise Connection Settings"), false,
                             OpenSettings);
                menu.AddSeparator("");
            }

            menu.AddDisabledItem(UnityEditor.EditorGUIUtility.TrTextContent("Play \u2215 Stop"));
            menu.AddDisabledItem(UnityEditor.EditorGUIUtility.TrTextContent("Stop all"));
            menu.AddSeparator("");
            menu.AddDisabledItem(UnityEditor.EditorGUIUtility.TrTextContent("Rename"));
            menu.AddDisabledItem(UnityEditor.EditorGUIUtility.TrTextContent("Delete"));
            menu.AddSeparator("");
            menu.AddDisabledItem(UnityEditor.EditorGUIUtility.TrTextContent("Open Containing Folder"));
            menu.AddDisabledItem(UnityEditor.EditorGUIUtility.TrTextContent("Find in Project Explorer"));
        }

        menu.AddItem(UnityEditor.EditorGUIUtility.TrTextContent("Find References in Scene #R"), false,
                     () => FindReferencesInScene(item));

        menu.ShowAsContext();
    }