Class CustomKeyCode
- Namespace
- PAC.KeyboardShortcuts
A class to supersede Unity's KeyCode enum to allow keycodes to refer to multiple keys - e.g. Shift instead of separated into LeftShift and RightShift.
public class CustomKeyCode : IEnumerable
- Inheritance
-
CustomKeyCode
- Implements
- Inherited Members
Fields
Alt
public static readonly CustomKeyCode Alt
Field Value
Ctrl
public static readonly CustomKeyCode Ctrl
Field Value
GreaterThan
public static readonly CustomKeyCode GreaterThan
Field Value
LessThan
public static readonly CustomKeyCode LessThan
Field Value
Minus
public static readonly CustomKeyCode Minus
Field Value
Plus
public static readonly CustomKeyCode Plus
Field Value
Shift
public static readonly CustomKeyCode Shift
Field Value
_0
The keycode for 0.
public static readonly CustomKeyCode _0
Field Value
_1
The keycode for 1.
public static readonly CustomKeyCode _1
Field Value
_2
The keycode for 2.
public static readonly CustomKeyCode _2
Field Value
_3
The keycode for 3.
public static readonly CustomKeyCode _3
Field Value
_4
The keycode for 4.
public static readonly CustomKeyCode _4
Field Value
_5
The keycode for 5.
public static readonly CustomKeyCode _5
Field Value
_6
The keycode for 6.
public static readonly CustomKeyCode _6
Field Value
_7
The keycode for 7.
public static readonly CustomKeyCode _7
Field Value
_8
The keycode for 8.
public static readonly CustomKeyCode _8
Field Value
_9
The keycode for 9.
public static readonly CustomKeyCode _9
Field Value
allKeyCodes
All Unity KeyCodes and all combined keycodes.
public static readonly CustomKeyCode[] allKeyCodes
Field Value
alphabet
The keycodes A-Z.
public static readonly CustomKeyCode[] alphabet
Field Value
combinedKeyCodes
All the defined keycodes that combine multiple Unity KeyCodes.
public static readonly CustomKeyCode[] combinedKeyCodes
Field Value
digits
The keycodes 0-9.
public static readonly CustomKeyCode[] digits
Field Value
Properties
displayName
What will be returned from ToString().
public string displayName { get; }
Property Value
keyCodes
The Unity KeyCodes comprising this keycode.
public List<KeyCode> keyCodes { get; }
Property Value
- List<KeyCode>
Methods
Contains(KeyCode)
Returns true if the Unity KeyCode forms part of this CustomKeyCode.
public bool Contains(KeyCode keyCode)
Parameters
keyCode
KeyCode
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
FromString(string)
Converts a string into the keycode with that display name. Returns null if there isn't one.
public static CustomKeyCode FromString(string displayName)
Parameters
displayName
string
Returns
GetEnumerator()
Returns an enumerator that iterates through a collection.
public IEnumerator GetEnumerator()
Returns
- IEnumerator
An IEnumerator object that can be used to iterate through the collection.
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
GetKey()
Returns true while this key is being held down.
public bool GetKey()
Returns
GetKeyDown()
Returns true the frame this key is pressed.
public bool GetKeyDown()
Returns
GetKeyUp()
Returns true the frame this key is released.
public bool GetKeyUp()
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 ==(CustomKeyCode, CustomKeyCode)
public static bool operator ==(CustomKeyCode keyCode1, CustomKeyCode keyCode2)
Parameters
keyCode1
CustomKeyCodekeyCode2
CustomKeyCode
Returns
implicit operator CustomKeyCode(KeyCode)
public static implicit operator CustomKeyCode(KeyCode keyCode)
Parameters
keyCode
KeyCode
Returns
operator !=(CustomKeyCode, CustomKeyCode)
public static bool operator !=(CustomKeyCode keyCode1, CustomKeyCode keyCode2)
Parameters
keyCode1
CustomKeyCodekeyCode2
CustomKeyCode