VRKB
Virtual Reality Keyboard
Public Member Functions | Public Attributes | Protected Attributes | Properties | List of all members
VRKB.KeyboardBehaviour Class Reference
Inheritance diagram for VRKB.KeyboardBehaviour:
Inheritance graph
[legend]
Collaboration diagram for VRKB.KeyboardBehaviour:
Collaboration graph
[legend]

Public Member Functions

void Start ()
 
void LoadConfig ()
 
void LoadLayer (KeyboardConfig keyboardConfig, string layerName)
 
void AutogenerateKeyNames ()
 
void ClearText ()
 
void Backspace ()
 
void TypeChars (string text)
 
bool IsPressed (KeyBehaviour key)
 
int NumKeysPressed ()
 
bool PressKey (KeyBehaviour key, Collider collider, bool autoRepeat=false)
 
void ReleaseKey (KeyBehaviour key, Collider collider)
 
void Update ()
 

Public Attributes

string PlaceholderText = "Enter text..."
 Message shown in the input area before the user starts typing. More...
 
float RepeatDelayInMilliseconds = 100.0f
 Length of time key must be pressed before it starts repeating. More...
 
float RepeatRatePerSecond = 3.0f
 The rate at which a key repeats when it is held in a pressed state. More...
 
bool AllowSimultaneousKeyPresses = false
 If true, allow two or more keys to be pressed simultaneously with the mallet. Setting this to false helps to reduce typing errors. More...
 
bool PasswordMode = false
 Show all input text as wildcard characters ("*"). This is helpful if a user is entering a password and wants to keep it hidden from possible observers. More...
 
Material UnpressedKeyMaterial
 The material use for a key that is the unpressed state. Change the referenced material to change the colors of the keyboard keys when they are in an unpressed state, as well as other visual properties. More...
 
Material PressedKeyMaterial
 The material use for a key that is the pressed state. Change the referenced material to change the colors of the keyboard keys when they are in an pressed state, as well as other visual properties. More...
 
TextAsset KeyboardConfigFile
 JSON configuration file which controls the output mappings, character labels, and icons for the individual keys. More...
 
OnKeyPressEvent OnKeyPress
 A list of callback methods that are invoked each time a key is pressed. This event is useful for triggering actions such as playing a key clicking sound or generating haptic feedback on the VR controller(s).

Parameters
KeyBehaviourthe key that was pressed
Colliderthe collider that pressed the key (usually a mallet)
booltrue if this key press event was generated by autorepeat
More...
 
OnCancelEvent OnCancel
 A list of callback methods that are invoked when the user presses the "cancel" key. (On the default keyboard, the red "X" key is the cancel key.) This event is useful for resetting various program state after the user cancels his/her input (e.g. hiding the keyboard, closing a dialog box).

Parameters
stringtext that user has typed prior to hitting the cancel key
More...
 
OnConfirmEvent OnConfirm
 A list of callback methods that are invoked when the user presses the "confirm" key. (On the default keyboard, the green checkmark key is the confirm key.) This event is useful for grabbing the input text from the keyboard after the user has confirmed that it is correct.

Parameters
stringtext that user has typed prior to hitting the confirm key
More...
 

Protected Attributes

TMP_InputField _inputField
 
TextMeshProUGUI _placeholder
 
KeyboardConfig _config
 
string _layer
 
string _prevLayer
 
Action _prevAction
 
HashSet< KeyBehaviour_pressedKeys
 
char _cursor
 

Properties

string Text [get, set]
 The current contents of the keyboard input area. These are the characters that the user has typed since he/she last pressed the cancel or confirm keys. More...
 

Member Data Documentation

◆ AllowSimultaneousKeyPresses

bool VRKB.KeyboardBehaviour.AllowSimultaneousKeyPresses = false

If true, allow two or more keys to be pressed simultaneously with the mallet. Setting this to false helps to reduce typing errors.

◆ KeyboardConfigFile

TextAsset VRKB.KeyboardBehaviour.KeyboardConfigFile

JSON configuration file which controls the output mappings, character labels, and icons for the individual keys.

◆ OnCancel

OnCancelEvent VRKB.KeyboardBehaviour.OnCancel

A list of callback methods that are invoked when the user presses the "cancel" key. (On the default keyboard, the red "X" key is the cancel key.) This event is useful for resetting various program state after the user cancels his/her input (e.g. hiding the keyboard, closing a dialog box).

Parameters
stringtext that user has typed prior to hitting the cancel key

◆ OnConfirm

OnConfirmEvent VRKB.KeyboardBehaviour.OnConfirm

A list of callback methods that are invoked when the user presses the "confirm" key. (On the default keyboard, the green checkmark key is the confirm key.) This event is useful for grabbing the input text from the keyboard after the user has confirmed that it is correct.

Parameters
stringtext that user has typed prior to hitting the confirm key

◆ OnKeyPress

OnKeyPressEvent VRKB.KeyboardBehaviour.OnKeyPress

A list of callback methods that are invoked each time a key is pressed. This event is useful for triggering actions such as playing a key clicking sound or generating haptic feedback on the VR controller(s).

Parameters
KeyBehaviourthe key that was pressed
Colliderthe collider that pressed the key (usually a mallet)
booltrue if this key press event was generated by autorepeat

◆ PasswordMode

bool VRKB.KeyboardBehaviour.PasswordMode = false

Show all input text as wildcard characters ("*"). This is helpful if a user is entering a password and wants to keep it hidden from possible observers.

◆ PlaceholderText

string VRKB.KeyboardBehaviour.PlaceholderText = "Enter text..."

Message shown in the input area before the user starts typing.

◆ PressedKeyMaterial

Material VRKB.KeyboardBehaviour.PressedKeyMaterial

The material use for a key that is the pressed state. Change the referenced material to change the colors of the keyboard keys when they are in an pressed state, as well as other visual properties.

◆ RepeatDelayInMilliseconds

float VRKB.KeyboardBehaviour.RepeatDelayInMilliseconds = 100.0f

Length of time key must be pressed before it starts repeating.

◆ RepeatRatePerSecond

float VRKB.KeyboardBehaviour.RepeatRatePerSecond = 3.0f

The rate at which a key repeats when it is held in a pressed state.

◆ UnpressedKeyMaterial

Material VRKB.KeyboardBehaviour.UnpressedKeyMaterial

The material use for a key that is the unpressed state. Change the referenced material to change the colors of the keyboard keys when they are in an unpressed state, as well as other visual properties.

Property Documentation

◆ Text

string VRKB.KeyboardBehaviour.Text
getset

The current contents of the keyboard input area. These are the characters that the user has typed since he/she last pressed the cancel or confirm keys.


The documentation for this class was generated from the following file: