public void ExecuteAlways(ShortcutEntry entry) { m_UnresolvedConflictPending = false; foreach (var shortcutEntry in m_Entries) { if (shortcutEntry != entry) { m_ProfileManager.ModifyShortcutEntry(shortcutEntry.identifier, new List <KeyCombination>(0)); } } if (entry.type != ShortcutType.Clutch) { Execute(entry); } Cleanup(); }
void RebindEntry(ShortcutEntry entry, List <KeyCombination> keyCombination) { // Ensure we have an active profile, if not create a new one if (m_ShortcutProfileManager.activeProfile == null) { var uniqueProfileId = GetUniqueProfileId(); if (uniqueProfileId == null) { Debug.LogWarning("Could not create unique profile id."); return; } m_ShortcutProfileManager.activeProfile = m_ShortcutProfileManager.CreateProfile(uniqueProfileId); } m_ShortcutProfileManager.ModifyShortcutEntry(entry.identifier, keyCombination); UpdateCommandsWithConflicts(); BuildKeyMapBindingStateData(); PopulateShortcutList(); m_ShortcutManagerWindowView.RefreshAll(); }
public void RebindShortcut(string shortcutId, ShortcutBinding binding) { if (shortcutId == null) { throw new ArgumentNullException(nameof(shortcutId) + ":" + shortcutId); } var shortcutEntries = m_ShortcutProfileManager.GetAllShortcuts(); var shortcutEntry = shortcutEntries.FirstOrDefault(entry => entry.identifier.path == shortcutId); if (shortcutEntry == null) { throw new ArgumentException("Shortcut not available", nameof(shortcutId) + ": " + shortcutId); } if (IsProfileReadOnly(activeProfileId)) { throw new InvalidOperationException("Cannot rebind shortcut on read-only profile"); } m_ShortcutProfileManager.ModifyShortcutEntry(shortcutEntry.identifier, binding.keyCombinationSequence); }