public void SelectKey(Key k, CommandRow c, bool isAlt) { if (selectedCommand != null) { selectedCommand.DeselectButton(this.isAlt); } selectedKey = null; selectedCommand = null; selectedKey = k; selectedCommand = c; this.isAlt = isAlt; c.SelectedButton(isAlt); }
void OnGUI() { if (selectedKey != null) { Event e = Event.current; if (e.isKey) { if (!isAlt) { selectedKey.key = e.keyCode; } else { selectedKey.altKey = e.keyCode; } selectedCommand.BindKeyToButton(selectedKey); selectedCommand.DeselectButton(isAlt); selectedCommand = null; selectedKey = null; } } }