Interface IPlayerInputService
Service to manage player input and active controller state.
Namespace: Serenity.InputGateway.Application.Interfaces
Assembly: Serenity.InputGateway.Application.dll
Syntax
public interface IPlayerInputService : IService, IFoundationSettings
Remarks
Implementations should be serializable by the foundation.
Properties
ActiveControllerId
Declaration
string ActiveControllerId { get; set; }
Property Value
| Type | Description |
|---|---|
| string | Gets or sets the input asset (e.g., InputActionAsset in Unity). |
ChangeInterval
Declaration
float ChangeInterval { get; set; }
Property Value
| Type | Description |
|---|---|
| float | Gets or sets the interval between input changes. |
ConsecutiveChangesBeforeSpeedUp
Declaration
int ConsecutiveChangesBeforeSpeedUp { get; set; }
Property Value
| Type | Description |
|---|---|
| int | Gets or sets the number of consecutive changes before speeding up. |
FastChangeInterval
Declaration
float FastChangeInterval { get; set; }
Property Value
| Type | Description |
|---|---|
| float | Gets or sets the fast change interval after speeding up. |
InputRouter
Declaration
IUiInputRouter InputRouter { get; set; }
Property Value
| Type | Description |
|---|---|
| IUiInputRouter |
JoinService
Declaration
IPlayerInputJoinService JoinService { get; set; }
Property Value
| Type | Description |
|---|---|
| IPlayerInputJoinService |
OnPrimaryJoinTask
Declaration
IReflectionCallTaskDefinition OnPrimaryJoinTask { get; set; }
Property Value
| Type | Description |
|---|---|
| IReflectionCallTaskDefinition | Settings for routing UI input to player input handlers. |
PrimaryDeviceSelector
Declaration
IPrimaryDeviceSelector PrimaryDeviceSelector { get; set; }
Property Value
| Type | Description |
|---|---|
| IPrimaryDeviceSelector |
PrimaryInputGate
Declaration
IPrimaryInputGate PrimaryInputGate { get; set; }
Property Value
| Type | Description |
|---|---|
| IPrimaryInputGate |
Slots
Declaration
IPlayerInputSlots Slots { get; set; }
Property Value
| Type | Description |
|---|---|
| IPlayerInputSlots |
UiActionMap
Declaration
string UiActionMap { get; set; }
Property Value
| Type | Description |
|---|---|
| string | Settings for routing UI input to player input handlers. |
UiCancelAction
Declaration
string UiCancelAction { get; set; }
Property Value
| Type | Description |
|---|---|
| string | Gets or sets the UI cancel action. |
UiNavigateAction
Declaration
string UiNavigateAction { get; set; }
Property Value
| Type | Description |
|---|---|
| string | Gets or sets the UI navigation action. |
UiSubmitAction
Declaration
string UiSubmitAction { get; set; }
Property Value
| Type | Description |
|---|---|
| string | Gets or sets the UI submit action. |
Methods
DisableAllControllers()
Disables all connected controllers for input.
Declaration
void DisableAllControllers()
EnableAllControllers()
Enables all connected controllers for input.
Declaration
void EnableAllControllers()
GetPlayerInput()
Gets the underlying player input handle (e.g., a PlayerInput component in Unity).
Declaration
object GetPlayerInput()
Returns
| Type | Description |
|---|---|
| object | The player input handle as an object. |
InitializeService(object, IPlayerInputServiceSettingsDefinition, TaskBuildContext, IUiInputRouter, IPlayerInputSlots, IUiInputRouter, IPrimaryDeviceSelector, IPrimaryInputGate, IPlayerInputJoinService)
Initializes the player input service with the specified parameters.
Declaration
void InitializeService(object playerInput, IPlayerInputServiceSettingsDefinition settings, TaskBuildContext context, IUiInputRouter uiInputRouter, IPlayerInputSlots slots, IUiInputRouter inputRouter, IPrimaryDeviceSelector primaryDeviceSelector, IPrimaryInputGate primaryInputGate, IPlayerInputJoinService joinService)
Parameters
| Type | Name | Description |
|---|---|---|
| object | playerInput | The player input handle (e.g., a PlayerInput component in Unity). |
| IPlayerInputServiceSettingsDefinition | settings | The settings for the player input service. |
| TaskBuildContext | context | The task build context for creating tasks. |
| IUiInputRouter | uiInputRouter | The UI input router to handle UI input routing. |
| IPlayerInputSlots | slots | |
| IUiInputRouter | inputRouter | |
| IPrimaryDeviceSelector | primaryDeviceSelector | |
| IPrimaryInputGate | primaryInputGate | |
| IPlayerInputJoinService | joinService |
Remarks
This method should be called before using the service.
NotifyPrimaryJoined(PrimaryJoinInfo)
Notifies the service that a primary player has joined.
Declaration
void NotifyPrimaryJoined(PrimaryJoinInfo info)
Parameters
| Type | Name | Description |
|---|---|---|
| PrimaryJoinInfo | info | Information about the primary player who joined. |
Remarks
This method should be called when a new primary player joins the game.
RegisterController(IController)
Registers a controller to be managed by the service.
Declaration
void RegisterController(IController controller)
Parameters
| Type | Name | Description |
|---|---|---|
| IController | controller | The controller to register. |
SetActiveController(string)
Sets the active controller by its identifier.
Declaration
void SetActiveController(string controllerId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | controllerId | The identifier of the controller to set as active. |
UnregisterController(IController)
Unregisters a controller from being managed by the service.
Declaration
void UnregisterController(IController controller)
Parameters
| Type | Name | Description |
|---|---|---|
| IController | controller | The controller to unregister. |
UnsetActiveController()
Unsets the currently active controller, if any.
Declaration
void UnsetActiveController()