logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Struct AchievementProgress

    How far a player has advanced towards a progressive achievement, plus the opaque condition state the evaluator needs to resume counting across sessions. Immutable value object.

    Implements
    IEquatable<AchievementProgress>
    Inherited Members
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    Namespace: Serenity.Achievements.Domain.ValueObjects
    Assembly: Serenity.Achievements.Domain.dll
    Syntax
    public readonly struct AchievementProgress : IEquatable<AchievementProgress>

    Constructors

    AchievementProgress(AchievementId, long, long, string, long)

    Creates a new AchievementProgress with the specified data.

    Declaration
    public AchievementProgress(AchievementId achievement, long current, long target, string conditionState, long revision)
    Parameters
    Type Name Description
    AchievementId achievement

    The achievement this progress belongs to.

    long current

    The current numerator. Negative values are clamped to zero.

    long target

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

    string conditionState

    Opaque state serialized by the unlock condition. May be null.

    long revision

    The monotonic write stamp this row was last persisted under.

    Fields

    Achievement

    The achievement this progress belongs to.

    Declaration
    public readonly AchievementId Achievement
    Field Value
    Type Description
    AchievementId

    ConditionState

    Opaque state serialized by the unlock condition. May be null.

    Declaration
    public readonly string ConditionState
    Field Value
    Type Description
    string

    Current

    The current numerator. Never negative.

    Declaration
    public readonly long Current
    Field Value
    Type Description
    long

    Revision

    The monotonic write stamp this row was last persisted under.

    Declaration
    public readonly long Revision
    Field Value
    Type Description
    long

    Target

    The numerator that unlocks the achievement. Zero means the achievement is boolean.

    Declaration
    public readonly long Target
    Field Value
    Type Description
    long

    Properties

    IsComplete

    Whether the numerator has reached the target.

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

    Normalized

    The progress expressed as a 0..1 fraction. A boolean achievement (zero target) reads as complete once its numerator is positive.

    Declaration
    public double Normalized { get; }
    Property Value
    Type Description
    double

    Methods

    Equals(AchievementProgress)

    Declaration
    public bool Equals(AchievementProgress other)
    Parameters
    Type Name Description
    AchievementProgress other
    Returns
    Type Description
    bool

    Equals(object)

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj
    Returns
    Type Description
    bool
    Overrides
    ValueType.Equals(object)

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int
    Overrides
    ValueType.GetHashCode()

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    ValueType.ToString()

    WithConditionState(string, long)

    Returns a copy of this progress carrying the given condition state and write stamp.

    Declaration
    public AchievementProgress WithConditionState(string conditionState, long revision)
    Parameters
    Type Name Description
    string conditionState

    The state serialized by the unlock condition.

    long revision

    The write stamp the next persist uses.

    Returns
    Type Description
    AchievementProgress

    WithCurrent(long, long)

    Returns a copy of this progress carrying the given numerator and write stamp.

    Declaration
    public AchievementProgress WithCurrent(long current, long revision)
    Parameters
    Type Name Description
    long current

    The new numerator.

    long revision

    The write stamp the next persist uses.

    Returns
    Type Description
    AchievementProgress

    Operators

    operator ==(AchievementProgress, AchievementProgress)

    Declaration
    public static bool operator ==(AchievementProgress left, AchievementProgress right)
    Parameters
    Type Name Description
    AchievementProgress left
    AchievementProgress right
    Returns
    Type Description
    bool

    operator !=(AchievementProgress, AchievementProgress)

    Declaration
    public static bool operator !=(AchievementProgress left, AchievementProgress right)
    Parameters
    Type Name Description
    AchievementProgress left
    AchievementProgress right
    Returns
    Type Description
    bool

    Implements

    IEquatable<T>
    In this article
    © 2026 Serenity. All Rights Reserved