Scripting Interface Overview
This section presents an overview of the scripting interfaces for the core components in the Typing Game Kit.
InputSequence
Represents a sequence of texts that may be typed.
Events
OnCompleted
Is raised when the sequence has been completed.
OnInputAccepted
Is raised when the sequence receives matching input.
OnInputRejected
Is raised when the sequence receives input that does not match.
OnRemoval
Is raised when a sequence is set for removal.
OnTargeted
Is raised when the sequence has been targeted.
OnTextUpdated
Is raised when the sequence's text has been altered.
OnUntargeted
Is raised when the sequence has been untargeted.
Properties
AcceptableInputs
Returns the inputs that can currently be accepted by the sequence.
CompletedText
Returns the portion of the text that has been accepted by the sequence so far.
IsCaseSensitive
Determines if the case of input is regarded when accepting/rejecting input.
IsCompleted
Returns true if the sequence has been typed to completion.
IsTargeted
Returns `true` if the sequence is targeted else `false`.
LastProcessedInput
The last input fed into the sequence.
ProgressIndex
The number of characters that have been accepted by the sequence.
RemainingText
Returns the portion of the text that is remaining of the sequence.
Text
The sequence's text content.
IsWhitespaceOptional
If enabled whitespace is optional and the next non-whitespace character is acceptable input.
Manager
The currently active InputSequenceManager
InputHandler
The input handler used to feed input to the sequences.
Methods
ProcessInput
Makes the input sequence receive and either 'accept' or 'reject' the provided input.
WouldAcceptInput
Returns true if the sequence would accept the given input.
Remove
Destroys the sequence.
ResetProgress
Resets the progress of the sequence.
Target
Targets the sequence.
Untarget
Untargets the input sequence.
InputSequenceManager
Controls what and how input is fed into the input sequences.
Events
OnInputAccepted
Is raised when input successfully matched any sequence.
OnInputRejected
Is raised when input failed to match any sequence.
OnSequenceCompleted
Is raised when any sequence was completed.
Properties
AcceptableInputs
Returns all the inputs that would be accepted by at least one sequence.
LatestProcessedInput
The latest processed input.
SequenceCount
Returns the number of registered input sequences.
Sequences
Returns all the registered input sequences.
TargetedSequences
Returns the targeted sequences.
ReceivingSequences
Sequences that currently may receive input.
Methods
ClearTargetedSequences
Clears the targeted sequences.
RegisterSequence
Registers a sequence with the manager and enable it to receive keyboard input.
RemoveAllSequences
Marks registered sequences for removal.
TargetSequence
Targets the given input sequence.
UntargetSequence
Untargets the given input sequence.
UnregisterSequence
The sequence will no longer receive input.
ProcessInput
Forces the manager to process input unless it has already done so this frame.
OverlaySequenceManager
Instantiates and manages the Sequence Overlay.
Properties
OverlaySequencePrefab
The prefab to use when instantiating the overlay sequences.
Methods
CreateSequence
Instantiates a new `OverlaySequence` prefab and returns its corresponding `InputSequence`
TextCollection
Inhibits a collection of text segments that are indexed by their initial character.
Properties
InitialsBreakdownByCase
If true the statistics separate the initials with different case.
Texts
All available text in the collection.
Methods
LoadTextFromSources
Loads/Reloads the texts segments from the text sources.
FindUniquelyTargetableText
Attempts to return a text with a unique initial among the other registered input sequences' texts.
FindTextWithUniqueInitial
Returns a text that has a unique initial among the other provided texts. Returns null if no such text exists.
GetInitials
Grabs all the unique initials among the text segments. If 'caseSensitive' is true all initials will be represented by its upper case.
PickRandomText
Picks a random text from the collection.
GetTextsByInitial
Returns all the texts segments with the specified initial.