logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class AchievementDefinition

    Configuration for a single achievement: how it is presented, how many points it awards, and which platform identifiers it is mirrored under. Immutable and validated on construction.

    Inheritance
    object
    AchievementDefinition
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Achievements.Domain.Entities
    Assembly: Serenity.Achievements.Domain.dll
    Syntax
    public class AchievementDefinition
    Remarks

    A definition with a ProgressTarget greater than zero is progressive: it is tracked with a numerator that unlocks the achievement once it reaches the target. Zero means the achievement is boolean — unlocked in one step.

    Constructors

    AchievementDefinition(AchievementId, string, string, bool, bool, int, int, long, AchievementPlatformMapping)

    Creates a new AchievementDefinition with the specified configuration.

    Declaration
    public AchievementDefinition(AchievementId id, string nameKey, string descriptionKey, bool isTranslating, bool isHidden, int points, int displayOrder, long progressTarget, AchievementPlatformMapping platformMapping)
    Parameters
    Type Name Description
    AchievementId id

    The identifier of the achievement this definition configures.

    string nameKey

    The display name or its localization key. Cannot be null.

    string descriptionKey

    The description or its localization key. May be null.

    bool isTranslating

    Whether the name and description are localization keys.

    bool isHidden

    Whether this achievement stays concealed until unlocked.

    int points

    The points awarded on unlock. Negative values are clamped to zero.

    int displayOrder

    The ordering hint used when listing achievements.

    long progressTarget

    The progress numerator that unlocks this achievement. Negative values are clamped to zero.

    AchievementPlatformMapping platformMapping

    The per-platform identifiers this achievement is mirrored under.

    Exceptions
    Type Condition
    ArgumentException

    Thrown when id is not valid.

    ArgumentNullException

    Thrown when nameKey is null.

    Fields

    DescriptionKey

    The description, or the localization key for it when IsTranslating.

    Declaration
    public readonly string DescriptionKey
    Field Value
    Type Description
    string

    DisplayOrder

    The ordering hint used when listing achievements. Lower values are listed first.

    Declaration
    public readonly int DisplayOrder
    Field Value
    Type Description
    int

    Id

    The identifier of the achievement this definition configures.

    Declaration
    public readonly AchievementId Id
    Field Value
    Type Description
    AchievementId

    IsHidden

    Whether this achievement stays concealed in the UI until it is unlocked.

    Declaration
    public readonly bool IsHidden
    Field Value
    Type Description
    bool

    IsTranslating

    Whether NameKey and DescriptionKey are localization keys.

    Declaration
    public readonly bool IsTranslating
    Field Value
    Type Description
    bool

    NameKey

    The display name, or the localization key for it when IsTranslating.

    Declaration
    public readonly string NameKey
    Field Value
    Type Description
    string

    PlatformMapping

    The per-platform identifiers this achievement is mirrored under.

    Declaration
    public readonly AchievementPlatformMapping PlatformMapping
    Field Value
    Type Description
    AchievementPlatformMapping

    Points

    The Serenity points awarded when this achievement is unlocked. Never negative.

    Declaration
    public readonly int Points
    Field Value
    Type Description
    int

    ProgressTarget

    The progress numerator that unlocks this achievement. Zero means boolean. Never negative.

    Declaration
    public readonly long ProgressTarget
    Field Value
    Type Description
    long

    Properties

    IsProgressive

    Whether this achievement is tracked with a progress numerator rather than a single step.

    Declaration
    public bool IsProgressive { get; }
    Property Value
    Type Description
    bool

    Methods

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    object.ToString()
    In this article
    © 2026 Serenity. All Rights Reserved