Table of Contents

Class PlayerInputManager

Namespace
BSGameLib.Game.Input
Assembly
BSGameLib.Game.dll

Keeps one input slot for each player, with the profile and bindings that player uses. Slot 0 is registered at start with the default bindings.

public sealed class PlayerInputManager
Inheritance
PlayerInputManager
Inherited Members

Constructors

PlayerInputManager(ILogger<PlayerInputManager>, IInputBindingService)

Created by dependency injection. Registers slot 0 for the first player, with the default bindings.

public PlayerInputManager(ILogger<PlayerInputManager> logger, IInputBindingService defaultBindings)

Parameters

logger ILogger<PlayerInputManager>
defaultBindings IInputBindingService

Properties

Slots

Every registered slot.

public IReadOnlyCollection<PlayerInputSlot> Slots { get; }

Property Value

IReadOnlyCollection<PlayerInputSlot>

Methods

GetBindings(int)

Returns the bindings of the slot for playerIndex.

public IInputBindingService GetBindings(int playerIndex = 0)

Parameters

playerIndex int

Returns

IInputBindingService

GetSlot(int)

Returns the slot for playerIndex. Throws KeyNotFoundException when that player has no slot.

public PlayerInputSlot GetSlot(int playerIndex = 0)

Parameters

playerIndex int

Returns

PlayerInputSlot

RegisterSlot(int, PlayerInputProfile, IInputBindingService)

Adds a slot for playerIndex, with its profile and bindings. Throws InvalidOperationException when the index already has a slot.

public void RegisterSlot(int playerIndex, PlayerInputProfile profile, IInputBindingService bindingService)

Parameters

playerIndex int
profile PlayerInputProfile
bindingService IInputBindingService

SetProfile(int, PlayerInputProfile)

Sets the profile of the slot for playerIndex. Throws KeyNotFoundException when that player has no slot.

public void SetProfile(int playerIndex, PlayerInputProfile profile)

Parameters

playerIndex int
profile PlayerInputProfile