Class AchievementPlatformGatewayContext
What a storefront gateway is given when it is built: the achievements this project declares, and somewhere to log.
Inherited Members
Namespace: Serenity.Achievements.Infrastructure.Platforms
Assembly: Serenity.UnityAchievements.Infrastructure.dll
Syntax
public sealed class AchievementPlatformGatewayContext
Remarks
The definitions are here because a storefront names achievements by its own identifier and
nothing else. Steam answers GetAchievement("ACH_FIRST_BLOOD"); it has never heard of
first-blood. Without the declared set a gateway can push an unlock outward — the
caller hands it the definition — but it cannot read the account BACK, because there is no way
to turn an API name into an AchievementId. That is the difference between "reinstalling
restores my unlocks" working and silently doing nothing.
A parameter object rather than more arguments, because every gateway needs both and the next thing a gateway needs — a player identity, a settings read model — would otherwise change the signature of every definition subtype in the wild, including a licensee's own.
Constructors
AchievementPlatformGatewayContext(IReadOnlyCollection<AchievementDefinition>, ILogService)
Builds the context a gateway is constructed from.
Declaration
public AchievementPlatformGatewayContext(IReadOnlyCollection<AchievementDefinition> definitions, ILogService logService)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyCollection<AchievementDefinition> | definitions | Every achievement this project declares. |
| ILogService | logService | Logging service. May be |
Properties
Definitions
Declaration
public IReadOnlyCollection<AchievementDefinition> Definitions { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyCollection<AchievementDefinition> | Every achievement this project declares, so a gateway can map its platform's identifiers back. |
Empty
The context for a caller that has neither — a test, or a composition still being built.
Declaration
public static AchievementPlatformGatewayContext Empty { get; }
Property Value
| Type | Description |
|---|---|
| AchievementPlatformGatewayContext |
LogService
Declaration
public ILogService LogService { get; }
Property Value
| Type | Description |
|---|---|
| ILogService | Logging service used to report an unavailable SDK. May be |
Methods
ForLogging(ILogService)
Builds a context that carries only a log service.
Declaration
public static AchievementPlatformGatewayContext ForLogging(ILogService logService)
Parameters
| Type | Name | Description |
|---|---|---|
| ILogService | logService | Logging service. May be |
Returns
| Type | Description |
|---|---|
| AchievementPlatformGatewayContext | The context. |
OrEmpty(AchievementPlatformGatewayContext)
Returns the context as given, or Empty when it is null.
Declaration
public static AchievementPlatformGatewayContext OrEmpty(AchievementPlatformGatewayContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| AchievementPlatformGatewayContext | context | The context to normalize. May be |
Returns
| Type | Description |
|---|---|
| AchievementPlatformGatewayContext | A usable context; never |