Class PlayerIdentityResolver
Resolves the PlayerId a call site should use, per the PlayerIdentitySource its module is configured with.
Inherited Members
Namespace: Serenity.Global.Infrastructure.Services
Assembly: Serenity.UnityGlobal.Infrastructure.dll
Syntax
public static class PlayerIdentityResolver
Remarks
Single source of truth for player-identity resolution across every Unity module that keys
data by PlayerId — the Leaderboard module it was written for, and the
Achievements module's UnityAchievementPlayerIdentityProvider. It lives beside the
shared kernel that owns PlayerId rather than inside either module, because
restating the DeviceId rule in a sibling module is how two aggregates end up keying the
same player differently.
Methods
Resolve(PlayerIdentitySource, PlayerId)
Resolves the identity for a call site that always has a caller-supplied player to fall back on (e.g. a score submission).
Declaration
public static PlayerId Resolve(PlayerIdentitySource identitySource, PlayerId callerSuppliedPlayer)
Parameters
| Type | Name | Description |
|---|---|---|
| PlayerIdentitySource | identitySource | Which source configures the resolution. |
| PlayerId | callerSuppliedPlayer | The player to use under Custom; ignored (in favor of the device id) under DeviceId. |
Returns
| Type | Description |
|---|---|
| PlayerId |
TryResolveLocalPlayer(PlayerIdentitySource, out PlayerId)
Resolves the local player's identity for a passive call site with no caller-supplied player (a display or cache component, not a submission). Only DeviceId can be resolved this way; Custom has no local player to fall back to and is reported as unresolved instead of silently guessing.
Declaration
public static bool TryResolveLocalPlayer(PlayerIdentitySource identitySource, out PlayerId player)
Parameters
| Type | Name | Description |
|---|---|---|
| PlayerIdentitySource | identitySource | Which source configures the resolution. |
| PlayerId | player | The resolved player identity, or |
Returns
| Type | Description |
|---|---|
| bool |
|