Class InputContext
Represents a context for input bindings with priority-based resolution. Input contexts allow for scene-specific or layered input handling.
public class InputContext
- Inheritance
-
InputContext
- Inherited Members
Constructors
InputContext(string, int, bool)
Creates a new input context.
public InputContext(string name, int priority = 0, bool allowPassthrough = true)
Parameters
namestringName of the context
priorityintPriority of the context (higher = more important)
allowPassthroughboolWhether to allow input passthrough
Properties
AllowPassthrough
Whether input should pass through to lower priority contexts if not handled.
public bool AllowPassthrough { get; set; }
Property Value
BindingCount
Gets the number of bindings in this context.
public int BindingCount { get; }
Property Value
Bindings
Collection of all bindings in this context.
public IReadOnlyDictionary<InputKey, InputBinding> Bindings { get; }
Property Value
Name
Name of this input context.
public string Name { get; set; }
Property Value
Priority
Priority of this context. Higher values have higher priority.
public int Priority { get; set; }
Property Value
Methods
AddBinding(InputBinding)
Adds a binding to this context.
public void AddBinding(InputBinding binding)
Parameters
bindingInputBindingThe binding to add
ClearBindings()
Clears all bindings from this context.
public void ClearBindings()
GetBinding(InputKey)
Gets a binding by input key.
public InputBinding GetBinding(InputKey inputKey)
Parameters
inputKeyInputKeyThe input key to look up
Returns
- InputBinding
The binding if found, null otherwise
GetBindingById(string)
Gets a binding by ID.
public InputBinding GetBindingById(string bindingId)
Parameters
bindingIdstringThe binding ID to look up
Returns
- InputBinding
The binding if found, null otherwise
GetMatchingBindings(InputKey)
Gets all bindings that match the specified input key.
public IEnumerable<InputBinding> GetMatchingBindings(InputKey inputKey)
Parameters
inputKeyInputKeyThe input key to match
Returns
- IEnumerable<InputBinding>
Collection of matching bindings
HandlesInput(InputKey)
Checks if this context handles the specified input key.
public bool HandlesInput(InputKey inputKey)
Parameters
inputKeyInputKeyThe input key to check
Returns
- bool
True if the context has an enabled binding for the input key
RemoveBinding(string)
Removes a binding by ID.
public bool RemoveBinding(string bindingId)
Parameters
bindingIdstringID of the binding to remove
Returns
- bool
True if the binding was removed, false if not found
ToString()
Returns a string representation of the context.
public override string ToString()