Class UnityLeaderboardScoreBridge
Bridges the Score aggregate to the Leaderboard aggregate.
Inherited Members
Namespace: Serenity.Leaderboard.Infrastructure.Services
Assembly: Serenity.UnityLeaderboard.Infrastructure.dll
Syntax
public class UnityLeaderboardScoreBridge
Remarks
Reads a board's configured ScoreKey off the current IScoreService snapshot and submits it to ILeaderboardService, resolving the player identity per PlayerIdentitySource. Never throws: an unregistered board or a metric with no current value logs a warning and returns without submitting, matching the framework's never-throw-in-runtime philosophy.
Constructors
UnityLeaderboardScoreBridge(IScoreService, ILeaderboardService, ILeaderboardSettings, ILogService)
Initializes a new instance of the UnityLeaderboardScoreBridge class.
Declaration
public UnityLeaderboardScoreBridge(IScoreService scoreService, ILeaderboardService leaderboardService, ILeaderboardSettings settings, ILogService logService)
Parameters
| Type | Name | Description |
|---|---|---|
| IScoreService | scoreService | Source of the current score snapshot. |
| ILeaderboardService | leaderboardService | Destination service submissions are routed through. |
| ILeaderboardSettings | settings | Board configuration and player-identity resolution rules. |
| ILogService | logService | Logging service. May be |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
Methods
SubmitCurrentScoreAsync(BoardId, PlayerId, string, CancellationToken)
Reads the given board's source metric off the current score snapshot and submits it to the leaderboard.
Declaration
public Task SubmitCurrentScoreAsync(BoardId board, PlayerId player, string displayName, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| BoardId | board | The board to submit to. |
| PlayerId | player | The submitting player. Used verbatim when PlayerIdentitySource is PlayerIdentitySource.Custom; ignored (in favor of the device id) when it is PlayerIdentitySource.DeviceId. |
| string | displayName | The display name to record, or empty/null to fall back to DefaultDisplayName. |
| CancellationToken | cancellationToken | Token used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task |