public static bool HandleShortcut(TimelineWindow.TimelineState state, Event evt, T item) { T[] items = new T[] { item }; bool result; foreach (ItemAction <T> current in ItemAction <T> .actions) { object[] customAttributes = current.GetType().GetCustomAttributes(typeof(ShortcutAttribute), true); object[] array = customAttributes; for (int i = 0; i < array.Length; i++) { ShortcutAttribute shortcutAttribute = (ShortcutAttribute)array[i]; if (shortcutAttribute.IsRecognized(evt)) { if (MenuItemActionBase.s_ShowActionTriggeredByShortcut) { Debug.Log(current.GetType().Name); } bool flag = current.Execute(state, items); state.Refresh(); state.Evaluate(); result = flag; return(result); } } } result = false; return(result); }
public static bool HandleShortcut(TimelineWindow.TimelineState state, Event evt, TrackAsset track) { List <TrackAsset> list = SelectionManager.SelectedTracks().ToList <TrackAsset>(); if (list.All((TrackAsset x) => x != track)) { list.Add(track); } bool result; foreach (TrackAction current in TrackAction.actions) { object[] customAttributes = current.GetType().GetCustomAttributes(typeof(ShortcutAttribute), true); object[] array = customAttributes; for (int i = 0; i < array.Length; i++) { ShortcutAttribute shortcutAttribute = (ShortcutAttribute)array[i]; if (shortcutAttribute.IsRecognized(evt)) { if (MenuItemActionBase.s_ShowActionTriggeredByShortcut) { Debug.Log(current.GetType().Name); } result = current.Execute(state, list.ToArray()); return(result); } } } result = false; return(result); }
public static bool HandleShortcut(TimelineWindow.TimelineState state, Event evt) { bool result; if (EditorGUI.IsEditingTextField()) { result = false; } else { foreach (TimelineAction current in TimelineAction.actions) { object[] customAttributes = current.GetType().GetCustomAttributes(typeof(ShortcutAttribute), true); object[] array = customAttributes; for (int i = 0; i < array.Length; i++) { ShortcutAttribute shortcutAttribute = (ShortcutAttribute)array[i]; if (shortcutAttribute.IsRecognized(evt)) { if (MenuItemActionBase.s_ShowActionTriggeredByShortcut) { Debug.Log(current.GetType().Name); } result = current.Execute(state); return(result); } } } result = false; } return(result); }
public static string GetShortcutText(ShortcutAttribute attribute) { if (attribute == null) { return(string.Empty); } var shortcut = attribute.GetMenuShortcut(); if (!string.IsNullOrEmpty(shortcut)) { return(" " + shortcut); } return(string.Empty); }