Class KeyboardShortcut
- Namespace
- PAC.KeyboardShortcuts
A class to represent a single keyboard shortcut.
public class KeyboardShortcut
- Inheritance
-
KeyboardShortcut
- Inherited Members
Constructors
KeyboardShortcut(params CustomKeyCode[])
Creates a shortcut from the given keycodes. Sorts the keycodes into the order they would be read.
public KeyboardShortcut(params CustomKeyCode[] keyCodes)
Parameters
keyCodes
CustomKeyCode[]
Properties
None
The empty keyboard shortcut - i.e. no keycodes.
public static KeyboardShortcut None { get; }
Property Value
keyCodes
The keycodes in this shortcut, kept in the order they would be read.
public List<CustomKeyCode> keyCodes { get; }
Property Value
Methods
Add(CustomKeyCode)
Adds the keycode to the shortcut. Returns false if it was already in the shortcut; otherwise returns true.
public bool Add(CustomKeyCode keyCode)
Parameters
keyCode
CustomKeyCode
Returns
Contains(CustomKeyCode)
Returns true if the keycode is in the shortcut.
public bool Contains(CustomKeyCode keyCode)
Parameters
keyCode
CustomKeyCode
Returns
Equals(object)
Determines whether the specified object is equal to the current object.
public override bool Equals(object obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
GetKeys()
Returns true while all keys are being held down.
public bool GetKeys()
Returns
GetKeysDown()
Returns true the frame the final key is pressed.
public bool GetKeysDown()
Returns
GetKeysUp()
Returns true the frame (any key of) this shortcut is released.
public bool GetKeysUp()
Returns
Remove(CustomKeyCode)
Removes the keycode from the shortcut. Returns false if the keycode already wasn't in the shortcut; otherwise returns true.
public bool Remove(CustomKeyCode keyCode)
Parameters
keyCode
CustomKeyCode
Returns
ToArray()
Returns an array of the keycodes in this shortcut, in the order they would be read.
public CustomKeyCode[] ToArray()
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Operators
operator ==(KeyboardShortcut, KeyboardShortcut)
Checks if the shortcuts have the same set of keycodes.
public static bool operator ==(KeyboardShortcut shortcut1, KeyboardShortcut shortcut2)
Parameters
shortcut1
KeyboardShortcutshortcut2
KeyboardShortcut
Returns
operator !=(KeyboardShortcut, KeyboardShortcut)
Checks if the shortcuts do not have the same set of keycodes.
public static bool operator !=(KeyboardShortcut shortcut1, KeyboardShortcut shortcut2)
Parameters
shortcut1
KeyboardShortcutshortcut2
KeyboardShortcut