logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    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.

    Inheritance
    object
    AchievementDefinitionRegistryBuilder
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    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 null for an empty registry.

    ILogService logService

    Logging service used to report duplicates and blanks. May be null.

    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 null for an empty registry.

    ILogService logService

    Logging service used to report duplicates and blanks. May be null.

    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.

    In this article
    © 2026 Serenity. All Rights Reserved