private void ShortcutGUI(string title, string key, KeyCode defaultValue) { FirstKey first = (FirstKey)EditorPrefs.GetInt(key + "1", (int)FirstKey.None); string shortcut = first != FirstKey.None?first.ToString() + "+":""; shortcut = shortcut + ((KeyCode)EditorPrefs.GetInt(key + "2", (int)defaultValue)).ToString(); GUILayout.BeginHorizontal(); GUILayout.Label(title, FsmEditorStyles.shortcutLabel, GUILayout.Width(130)); GUILayout.Label(shortcut, FsmEditorStyles.shortcutLabel); GUILayout.EndHorizontal(); }
private bool ControlPressed(string key) { FirstKey firstKey = (FirstKey)EditorPrefs.GetInt(key + "1", (int)FirstKey.None); switch (firstKey) { case FirstKey.Alt: return(Event.current.alt); case FirstKey.Control: return(Event.current.control); case FirstKey.Shift: return(Event.current.shift); } return(true); }
private void DoKeyGUI(string label, string key, KeyCode defaultValue) { GUILayout.BeginHorizontal(); FirstKey firstKey = (FirstKey)EditorPrefs.GetInt(key + "1", (int)FirstKey.None); FirstKey index1 = (FirstKey)EditorGUILayout.EnumPopup(label, (FirstKey)firstKey, GUILayout.Width(200)); if (index1 != firstKey) { EditorPrefs.SetInt(key + "1", (int)index1); } GUILayout.Label("+", GUILayout.Width(17)); KeyCode keyCode = (KeyCode)EditorPrefs.GetInt(key + "2", (int)defaultValue); KeyCode index2 = (KeyCode)EditorGUILayout.EnumPopup(GUIContent.none, (KeyCode)keyCode, GUILayout.Width(70)); if (index2 != keyCode) { EditorPrefs.SetInt(key + "2", (int)index2); } GUILayout.EndHorizontal(); }
set => SetOrRemove(FirstKey, value);
public KeyboardListener(FirstKey firstKey) { FirstKey = firstKey; KeyboardHookInstance = new KeyboardHookDelegate(KeyboardHook); Install(); }
public string Output() { return(OutputRemoveNullEmpty(FirstKey.ToString() + "+" + SecondKey)); }
public override string ToString() { string firstKey = string.Empty, secondKey = string.Empty; firstKey = typeof(IDTO).IsAssignableFrom(typeof(TId1)) ? (FirstKey as IDTO).Id.ToString() : FirstKey.ToString(); secondKey = typeof(IDTO).IsAssignableFrom(typeof(TId2)) ? (SecondKey as IDTO).Id.ToString() : SecondKey.ToString(); return($"{firstKey}|{secondKey}"); }