Game.Settings.SettingsUIKeyboardActionAttribute
Assembly:
Assembly-CSharp (Assembly-CSharp.dll)
Namespace:
Game.Settings
Type:
class (attribute)
Base:
SettingsUIInputActionAttribute
Summary:
Attribute used to declare a keyboard input action for the settings UI. This attribute is a specialized shortcut of SettingsUIInputActionAttribute which automatically uses InputManager.DeviceType.Keyboard. It provides several overloads to declare an action name, action type (button/axis/etc.), input mode, and optional custom usages/interactions/processors. Typical use is to decorate classes that describe or register input actions for the settings user interface.
Fields
- This class does not declare any instance or static fields.
The behavior and storage are provided by the base class (SettingsUIInputActionAttribute) and the attribute metadata itself.
Properties
- This class does not declare any properties.
Inherited properties (if any) come from SettingsUIInputActionAttribute or further base types.
Constructors
-
public SettingsUIKeyboardActionAttribute(string name, ActionType type = ActionType.Button, bool allowModifiers = true, bool developerOnly = false, Mode mode = Mode.DigitalNormalized, string[] usages = null, string[] interactions = null, string[] processors = null)
Provides a full declaration surface: action name, action type, whether modifier keys are allowed, whether action is developer-only, input mode, and optional arrays of usages, interactions and processors. This overload sets the device type to Keyboard. -
public SettingsUIKeyboardActionAttribute(string name, ActionType type, Mode mode, params string[] customUsages)
Specify name, action type and explicit input mode, and pass custom usages as a params array. Device type is Keyboard. -
public SettingsUIKeyboardActionAttribute(string name, ActionType type, params string[] customUsages)
Specify name and action type, with custom usages; uses Mode.DigitalNormalized by default. Device type is Keyboard. -
public SettingsUIKeyboardActionAttribute(string name, Mode mode, params string[] customUsages)
Specify name and input mode plus custom usages; action type defaults to ActionType.Button. Device type is Keyboard. -
public SettingsUIKeyboardActionAttribute(string name, params string[] customUsages)
Simplest overload: specify name and custom usages; action type defaults to Button and mode defaults to DigitalNormalized. Device type is Keyboard.
Notes on parameters: - name: logical identifier for the action shown in the settings UI. - type: ActionType (e.g., Button, Value) indicating how input is interpreted. - allowModifiers: whether modifier keys (Ctrl/Alt/Shift) are permitted for this binding. - developerOnly: if true, the action is only shown/available in developer modes. - mode: Mode enum indicating how the input is normalized or handled. - usages/interactions/processors/customUsages: strings usually matching input system usages/interactions/processors to customize binding behavior.
Methods
- This class does not declare any methods.
All behavior is provided by constructors and the base attribute type.
Usage Example
using Game.Settings;
using Game.Input;
// Basic declaration: button action bound to keyboard (default mode: DigitalNormalized)
[SettingsUIKeyboardAction("OpenMenu")]
public class OpenMenuSettingsAction
{
// Class body can be empty if used purely as metadata, or
// contain logic/registering code depending on the mod framework.
}
// More explicit declaration with type, mode, and custom usages
[SettingsUIKeyboardAction("Sprint", ActionType.Value, Mode.Digital, "Keyboard/LeftShift")]
public class SprintSettingsAction { }
// Declaration allowing modifiers and marking as developer-only
[SettingsUIKeyboardAction("ToggleDebug", ActionType.Button, allowModifiers: true, developerOnly: true)]
public class ToggleDebugAction { }
Additional notes: - This attribute is a convenience wrapper that sets InputManager.DeviceType to Keyboard; use SettingsUIInputActionAttribute directly if you need a different device. - Place the attribute on classes used by the settings/input registration system so the settings UI can surface the keyboard action and its bindings.