Class AchievementDefinitionRegistryBuilder
Turns a flat list of declared achievements into the by-id registry AchievementRegistry is constructed with, reporting the one thing a list can express and a dictionary cannot: two definitions claiming the same identifier.
Inherited Members
Namespace: Serenity.Achievements.Application.Services
Assembly: Serenity.Achievements.Application.dll
Syntax
public static class AchievementDefinitionRegistryBuilder
Remarks
Static and public so the duplicate-handling policy is directly testable without a
composition root, exactly as UnityLeaderboardInstaller.BuildBoardRegistry is.
Methods
Build(IReadOnlyList<AchievementDefinition>, ILogService)
Builds the by-id registry. A later definition with the same id wins, and warns.
Declaration
public static IReadOnlyDictionary<AchievementId, AchievementDefinition> Build(IReadOnlyList<AchievementDefinition> definitions, ILogService logService)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<AchievementDefinition> | definitions | The declared definitions, or |
| ILogService | logService | Logging service used to report duplicates and blanks. May be |
Returns
| Type | Description |
|---|---|
| IReadOnlyDictionary<AchievementId, AchievementDefinition> | The declared definitions keyed by their identifier. |
BuildFrom(IAchievementDefinitionSource, ILogService)
Builds the by-id registry from a definition source, tolerating a missing one.
Declaration
public static IReadOnlyDictionary<AchievementId, AchievementDefinition> BuildFrom(IAchievementDefinitionSource definitionSource, ILogService logService)
Parameters
| Type | Name | Description |
|---|---|---|
| IAchievementDefinitionSource | definitionSource | The source the definitions are read from, or |
| ILogService | logService | Logging service used to report duplicates and blanks. May be |
Returns
| Type | Description |
|---|---|
| IReadOnlyDictionary<AchievementId, AchievementDefinition> | The declared definitions keyed by their identifier. |
Remarks
The source is project code — an asset loader, a generated list, a mod — so "it threw" is a case, not an accident. A failing source degrades to an empty registry the same way a failing backend degrades to PlayerPrefs and a failing platform definition is skipped: the module still installs, and every unlock warns once about an unknown id.