Skip to content

CrowdControl

Inherits IBehavior

Public Member Functions

void

Dispose()

bool

IsTokenValid()

Checks if the current JWT token is valid for authentication with the Crowd Control service. True if the token is valid, false otherwise.

Task

StartSession(bool startNew)

Task

StopSession()

void

Connect()

Opens the connection to the Crowd Control service.

void

Disconnect()

Closes the connection to the Crowd Control service.

Task

Ping()

Pings the Crowd Control service to check connectivity.

void

LoadContent()

Documentation inherited from IBehavior.LoadContent.

void

UnloadContent()

Documentation inherited from IBehavior.UnloadContent.

void

Draw(SITimeSpan gameTime, SITimeSpan deltaTime)

Documentation inherited from IBehavior.Draw.

void

Update(SITimeSpan gameTime, SITimeSpan deltaTime)

Documentation inherited from IBehavior.Update.

Task

GetAuthCode()

Documentation inherited from ClientSocket.GetAuthCode.

string?

GetInteractLink()

Documentation inherited from ClientSocket.GetInteractLink.

Task

LoadCustomEffects(IEnumerable effects, CustomEffects.OperationMode mode)

Documentation inherited from ClientSocket.LoadCustomEffects.

bool

CloneEffect(string sourceEffectID, params string[] destEffectIDs)

Documentation inherited from IEffectLoader.CloneEffect.

void

Respond(EffectRequest request, EffectStatus status, string? message)

Documentation inherited from ClientSocket.Respond(EffectRequest, EffectStatus, string?).

void

Respond(EffectRequest request, EffectStatus status, StandardErrors? messageID, string? message)

Documentation inherited from ClientSocket.Respond(EffectRequest, EffectStatus, StandardErrors?, string?).

void

Respond(EffectRequest request, EffectStatus status, SITimeSpan? timeRemaining, string? message)

Documentation inherited from ClientSocket.Respond(EffectRequest, EffectStatus, SITimeSpan?, string?).

void

Respond(EffectRequest request, EffectStatus status, SITimeSpan? timeRemaining, StandardErrors? messageID, string? message)

Documentation inherited from ClientSocket.Respond(EffectRequest, EffectStatus, SITimeSpan?, StandardErrors?, string?).

void

UpdateMetadata(IDictionary metadata)

Documentation inherited from ClientSocket.MetadataChanged(string, IDictionary{string, object}).

void

UpdateMetadata(string key, object value)

Task

ShowEffects(params string[] codes)

Shows the specified effects on the menu. True if the message was sent successfully, false otherwise.

Task

ShowEffects(IEnumerable codes, string? message)

Documentation inherited from ShowEffects(string[]).

Task

ShowAllEffects(string? message)

Shows all effects on the menu. True if the message was sent successfully, false otherwise.

Task

HideEffects(params string[] codes)

Hides the specified effects on the menu. True if the message was sent successfully, false otherwise.

Task

HideEffects(IEnumerable codes, string? message)

Documentation inherited from HideEffects(string[]).

Task

HideAllEffects(string? message)

Hides all effects on the menu. True if the message was sent successfully, false otherwise.

Task

EnableEffects(params string[] codes)

Makes the specified effects selectable on the menu. True if the message was sent successfully, false otherwise.

Task

EnableEffects(IEnumerable codes, string? message)

Documentation inherited from EnableEffects(string[]).

Task

EnableAllEffects(string? message)

Makes all effects selectable on the menu. True if the message was sent successfully, false otherwise.

Task

DisableEffects(params string[] codes)

Makes the specified effects unselectable on the menu. True if the message was sent successfully, false otherwise.

Task

DisableEffects(IEnumerable codes, string? message)

Documentation inherited from DisableEffects(string[]).

Task

DisableAllEffects(string? message)

Makes all effects unselectable on the menu. True if the message was sent successfully, false otherwise.

Public Static Functions

bool

IsTokenValid(string? token)

Checks if the provided JWT token is valid for authentication with the Crowd Control service. True if the token is valid, false otherwise.

Private Functions

void

OnApplicationAuthCodeRedeemedReceived(ApplicationAuthCodeRedeemed authCode)

void

OnEffectRequestReceived(EffectRequest request)

Handles an incoming effect request from the Crowd Control service. Responds with an appropriate status message if the effect cannot be handled.

Protected Functions

void

Dispose(bool disposing)

Documentation inherited from IDisposable.Dispose.

Internal Attributes

ClientSocket

ClientSocket

The client socket used to communicate with the Crowd Control service.

Properties

bool

ContentLoaded

[get, set]

Documentation inherited from IBehavior.ContentLoaded.

string

GameID

[get, ]

The game identifier used when connecting to the Crowd Control service.

string

ApplicationID

[get, ]

The application identifier used for authentication with the Crowd Control service.

bool

Connected

[get, ]

Gets whether the client socket is currently connected to the Crowd Control service.

IEffectLoader

EffectLoader

[get, ]

The effect loader used to manage and load effects.

IMetadataLoader

MetadataLoader

[get, ]

The metadata loader used to manage and load metadata.

Scheduler

Scheduler

[get, ]

The scheduler used to manage timed effects.

EffectType

AllowedTypes

[get, set]

Types of effects that this client will accept from the Crowd Control service. Effects of other types will be silently discarded. Do not change this value without consulting Crowd Control support.

IGameStateManager

GameStateManager

[get, ]

The game state manager used to query and manipulate game state.

bool

IsActiveSession

[get, ]

Gets whether this instance has an active session.

bool

IsDisposed

[get, set]

Gets whether this instance has been disposed.

TaskScheduler

m_taskScheduler

[get, set]

TaskFactory

TaskFactory

[get, ]

bool

AutoReconnect

[get, set]

Whether to automatically reconnect to Crowd Control when the connection is lost while a session is active.

Events

Action<EffectRequest>?

EffectRequestReceived

Raised when an effect request is received from the Crowd Control API.

Action<EffectRequest, Common.EffectResponse>?

EffectResponseSent

Raised when an effect request response is sent to the Crowd Control API.

Action<EffectReport>?

EffectReportSent

Raised when an effect class report is sent to the Crowd Control API.

Action?

SessionReady

Raised when the Crowd Control session is ready.

Action?

SessionEnded

Raised when the Crowd Control session has ended.

Action<string>?

JwtTokenReceived

Raised when a JWT token is received from the Crowd Control API.

Action?

Disposed

Raised when this instance is disposed.

Action<ApplicationAuthCode>

AuthCodeReceived

Raised when an application auth code is received from the Crowd Control API.

Action<ApplicationAuthCodeRedeemed>

AuthCodeRedeemedReceived

Raised when an application auth code is redeemed by the Crowd Control API.

Action<ApplicationAuthCodeError>

AuthCodeErrorReceived

Raised when an error occurs during application auth code retrieval or redemption.