static void DrawHotkey(string label, HotKey hotkey) { EditorGUILayout.BeginHorizontal(); GUILayout.Label(label + " :"); hotkey.keyCode = (KeyCode)EditorGUILayout.EnumPopup(hotkey.keyCode); GUILayout.Label("Alt"); hotkey.alt = EditorGUILayout.Toggle(hotkey.alt); GUILayout.Label("Ctrl"); hotkey.ctrl = EditorGUILayout.Toggle(hotkey.ctrl); GUILayout.Label("Shift"); hotkey.shift = EditorGUILayout.Toggle(hotkey.shift); EditorGUILayout.EndHorizontal(); }
public static void SetHotkey(string key, HotKey hk) { EditorPrefs.SetInt(key + "KC", (int)hk.keyCode); EditorPrefs.SetBool(key + "A", hk.alt); EditorPrefs.SetBool(key + "C", hk.ctrl); EditorPrefs.SetBool(key + "S", hk.shift); }
public static void InitializeHotKeys() { addPointMouse = GetHotkey(ADD_POINT_MOUSE_KEY); if (addPointMouse.keyCode == KeyCode.None) { addPointMouse = new HotKey(KeyCode.Mouse0, false, true, false); } addPointKeyboard = GetHotkey(ADD_POINT_KEYBOARD_KEY); if (addPointKeyboard.keyCode == KeyCode.None) { addPointKeyboard = new HotKey(KeyCode.D, false, false, true); } removePoint = GetHotkey(REMOVE_POINT_KEY); if (removePoint.keyCode == KeyCode.None) { removePoint = new HotKey(KeyCode.X, false, false, false); } stickToGround = GetHotkey(STICK_TO_GROUND_KEY); if (stickToGround.keyCode == KeyCode.None) { stickToGround = new HotKey(KeyCode.G, false, false, false); } drawLine = GetHotkey(DRAW_LINE_KEY); if (drawLine.keyCode == KeyCode.None) { drawLine = new HotKey(KeyCode.L, false, false, false); } }