Skip to content

Class InputActionMap

Namespace: Apogee.Input
Assembly: Apogee.Input.dll

Every action the player can bind, where each works (its contexts) and what it is bound to. Contexts are names the game chooses (world, on_foot, vehicle, menu); situations say which are active together, so two actions that can never be active at once may share an input. A turns the player's input into these actions.

public sealed class InputActionMap : EngineObject

Inheritance

object ← EngineObject ← InputActionMap

Inherited Members

EngineObject.IsAdopted, EngineObject.Handle, EngineObject.IsDestroyed, EngineObject.Class, EngineObject.Adopt(), EngineObject.TryGet(SlotHandle, out EngineObject), EngineObject.Destroy(), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Properties

Actions

The actions, in the order they were added.

public IReadOnlyList<InputAction> Actions { get; }

Property Value

IReadOnlyList<InputAction>

Class

What the registry knows about this object's class.

public override ClassInfo Class { get; }

Property Value

ClassInfo

Methods

AddAction(string, string[], string[], bool, string)

Adds an action, bound to defaults (binding texts: see ). An analog action is read by strength; the others fire.

public void AddAction(string id, string[] contexts, string[] defaults, bool analog = false, string help = "")

Parameters

id string

contexts string[]

defaults string[]

analog bool

help string

AddSituation(string[])

Says that these contexts are active together (a situation). Without any, two actions clash when they share a context.

public void AddSituation(string[] contexts)

Parameters

contexts string[]

AllConflicts()

Every clash among the current bindings, each pair once.

public IReadOnlyList<BindingConflict> AllConflicts()

Returns

IReadOnlyList<BindingConflict>

BindingError(string)

Why a binding text does not read, or an empty string when it does.

public static string BindingError(string text)

Parameters

text string

Returns

string

Conflicts(string, Binding)

The actions that can be active together with id and are bound to binding as well.

public IReadOnlyList<string> Conflicts(string id, Binding binding)

Parameters

id string

binding Binding

Returns

IReadOnlyList<string>

ContextsOverlap(string[], string[])

True when an action of a and one of b can be active at the same time.

public bool ContextsOverlap(string[] a, string[] b)

Parameters

a string[]

b string[]

Returns

bool

Find(string)

public InputAction? Find(string id)

Parameters

id string

Returns

InputAction?

GetActions()

The ids of the actions, in the order they were added.

public string[] GetActions()

Returns

string[]

GetAllConflicts()

Every clash as a line of three tab-separated fields: the action, the other action and the binding.

public string[] GetAllConflicts()

Returns

string[]

GetBindings(string)

public string[] GetBindings(string id)

Parameters

id string

Returns

string[]

GetConflicts(string, string)

The actions that would clash if id were bound to this text.

public string[] GetConflicts(string id, string binding)

Parameters

id string

binding string

Returns

string[]

GetContexts(string)

public string[] GetContexts(string id)

Parameters

id string

Returns

string[]

GetDefaults(string)

public string[] GetDefaults(string id)

Parameters

id string

Returns

string[]

GetHelp(string)

What an action is for, as it was added.

public string GetHelp(string id)

Parameters

id string

Returns

string

HasAction(string)

public bool HasAction(string id)

Parameters

id string

Returns

bool

IsAnalog(string)

public bool IsAnalog(string id)

Parameters

id string

Returns

bool

Load(IReadOnlyDictionary<string, string[]>)

Applies what wrote. Returns what could not be applied (an unknown action, a binding that does not read); the rest is.

public string[] Load(IReadOnlyDictionary<string, string[]> saved)

Parameters

saved IReadOnlyDictionary<string, string[]>

Returns

string[]

LoadSaved(IReadOnlyDictionary<string, string[]>)

Applies saved bindings ('s) at startup: those of actions that are defined apply now, and the others are kept until the action is added () and are part of meanwhile. Returns the bindings that do not read. It raises no : what is loaded is saved already.

public string[] LoadSaved(IReadOnlyDictionary<string, string[]> saved)

Parameters

saved IReadOnlyDictionary<string, string[]>

Returns

string[]

LoadText(string)

Applies 's text; returns what could not be applied, as does.

public string[] LoadText(string text)

Parameters

text string

Returns

string[]

NormalizeBinding(string)

The binding text as it would be saved: the trigger, the modifiers and the input spelled the way this class writes them. Throws (a script error) on text that does not read.

public static string NormalizeBinding(string text)

Parameters

text string

Returns

string

ParseBinding(string)

A binding's parts: the input, its modifiers, its trigger. Throws (a script error) on text that does not read.

public static (string Input, Modifiers Modifiers, Trigger Trigger) ParseBinding(string text)

Parameters

text string

Returns

(string Input, Modifiers Modifiers, Trigger Trigger)

Reset(string)

public void Reset(string id)

Parameters

id string

ResetAll()

Puts every defined action back to its defaults. Saved bindings of actions that are not defined (yet) are kept.

public void ResetAll()

Save()

The bindings that differ from the defaults, by action id: what a game stores in the player's settings. It includes the saved bindings of actions that are not defined (), so a mod that is switched off for a while does not lose its players' bindings.

public IReadOnlyDictionary<string, string[]> Save()

Returns

IReadOnlyDictionary<string, string[]>

SaveText()

as text, one line per action: lights = Hold L | Joy RB (an action with no binding has nothing after the equals sign).

public string SaveText()

Returns

string

SetBindings(string, string[])

Rebinds an action. Throws (a script error) on a binding that does not read.

public void SetBindings(string id, string[] bindings)

Parameters

id string

bindings string[]

BindingsChanged

Raised after any rebinding: , , , and , whether or not a binding really changed. The settings store listens to save the bindings.

public event Action? BindingsChanged

Event Type

Action?