protected override void KeyEvent() { var selected = GetSelection(); if (selected.Count == 0) { return; } var item = Find(GetSelection()[0]); if (UnityEngine.Event.current.type == UnityEngine.EventType.KeyDown) { switch (UnityEngine.Event.current.keyCode) { case UnityEngine.KeyCode.KeypadEnter: DoubleClickedItem(item.id); UnityEngine.Event.current.Use(); break; case UnityEngine.KeyCode.Space: if (CanPlay(item)) { AkWaapiUtilities.TogglePlayEvent(item.objectType, item.objectGuid); } UnityEngine.Event.current.Use(); break; case UnityEngine.KeyCode.Delete: if (CanDelete(item)) { AkWaapiUtilities.Delete(item.objectGuid); } UnityEngine.Event.current.Use(); break; case UnityEngine.KeyCode.F2: if (CanRename(item)) { BeginRename(item); } UnityEngine.Event.current.Use(); break; case UnityEngine.KeyCode.O: if (UnityEngine.Event.current.shift) { if (CanOpen(item)) { AkWaapiUtilities.OpenWorkUnitInExplorer(item.objectGuid); } UnityEngine.Event.current.Use(); } break; case UnityEngine.KeyCode.F: if (UnityEngine.Event.current.shift) { if (CanSelect(item)) { m_dataSource.SelectObjectInAuthoring(item.objectGuid); } UnityEngine.Event.current.Use(); } break; case UnityEngine.KeyCode.R: if (UnityEngine.Event.current.shift) { FindReferencesInScene(item); UnityEngine.Event.current.Use(); } break; } } }
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(); }