Table of Contents

Class Controls

Namespace
Squiggles.Core.Data
Assembly
SquigglesCommon4X.dll

A singleton for managing controls mappings and sensitivities.

public static class Controls
Inheritance
Controls
Inherited Members

Fields

FILE_PATH

private const string FILE_PATH = "controls.json"

Field Value

string

INPUT_GAMEPAD_AXIS

private const int INPUT_GAMEPAD_AXIS = 4

Field Value

int

INPUT_GAMEPAD_BUTTON

private const int INPUT_GAMEPAD_BUTTON = 2

Field Value

int

INPUT_KEY

private const int INPUT_KEY = 1

Field Value

int

INPUT_MOUSE_BUTTON

private const int INPUT_MOUSE_BUTTON = 3

Field Value

int

_originalMappingsCache

A cache of the original mappings to allow reverting easily.

private static readonly Dictionary<string, List<InputEvent>> _originalMappingsCache

Field Value

Dictionary<string, List<InputEvent>>

Properties

ControllerLookSensitivity

Sensitivity to be applied when performing gamepad/controller look processes. Requires dev implementation

public static float ControllerLookSensitivity { get; set; }

Property Value

float

MappingsOverloads

The currently registerd overloads.

public static Dictionary<string, int[]> MappingsOverloads { get; set; }

Property Value

Dictionary<string, int[]>

MouseLookSensivity

Sensitivity to be applied when performing mouse look processes. Requires dev implementation

public static float MouseLookSensivity { get; set; }

Property Value

float

Methods

GetCurrentMappingFor(string)

Gets the mapping as text for the given action. Or "" if no mapping is found. This can be used to display mappings through text, or be parsed to show button prompts.

public static string GetCurrentMappingFor(string action)

Parameters

action string

the action name

Returns

string

a string of the mapping, where each line is a mapping event parsed as text

GetInputCode(InputEvent)

private static int[] GetInputCode(InputEvent e)

Parameters

e InputEvent

Returns

int[]

Load()

public static void Load()

LoadMappingsFromData(string, int[])

private static void LoadMappingsFromData(string action, int[] codes)

Parameters

action string
codes int[]

ResetMapping(string)

Resets a single mapping. Used internally. No touchey!

public static void ResetMapping(string action)

Parameters

action string

the action to reset

ResetMappings()

Resets all currently loaded mappings. Probably best you don't touch that buddy

public static void ResetMappings()

SaveSettings()

public static void SaveSettings()

SetMapping(string, InputEvent)

Sets a provided event to a particular action as an override. Clears existing mappings before inserting new mapping

public static void SetMapping(string action, InputEvent assigned_input)

Parameters

action string

the action key

assigned_input InputEvent

the event to map to the action

Events

OnControlMappingChanged

An event triggered when the mappings change

public static event Action<string> OnControlMappingChanged

Event Type

Action<string>