private void AddShortcut(UIComponent c, UIMouseEventParameter p) { if (m_component == null) { return; } DebugUtils.Log("Adding shortcut to " + m_component.name); Shortcut shortcut = Shortcut.GetShortcut(m_component); if (shortcut == null) { shortcut = new Shortcut(m_component); GUI.UIShortcutModal.instance.title = "New Shortcut"; } else { GUI.UIShortcutModal.instance.title = "Edit Shortcut"; } HidePanel(); GUI.UIShortcutModal.instance.shortcut = shortcut; UIView.PushModal(GUI.UIShortcutModal.instance); GUI.UIShortcutModal.instance.Show(); }
public static string GetUniqueName(string name) { int count = 0; string uniqueName = name; while (Shortcut.GetShortcut(uniqueName) != null) { uniqueName = name + ++count; } return(uniqueName); }