logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Struct AchievementConditionProgress

    How far along a condition is: the numerator and denominator to show, plus the 0..1 fraction they represent. Immutable value object.

    Implements
    IEquatable<AchievementConditionProgress>
    Inherited Members
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    Namespace: Serenity.Achievements.Application.Conditions
    Assembly: Serenity.Achievements.Application.dll
    Syntax
    public readonly struct AchievementConditionProgress : IEquatable<AchievementConditionProgress>
    Remarks

    Normalized is carried rather than derived because the two are not always the same measurement. A duration counts in whole displayed seconds but advances in fractions of one, so "1799 of 1800 seconds" and "1799.6 of 1800 seconds" round to the same pair of integers and to two different fractions. The integers are what an author reads; the fraction is what a progress bar draws.

    Constructors

    AchievementConditionProgress(long, long)

    Creates a progress whose fraction is the ratio of the two counts.

    Declaration
    public AchievementConditionProgress(long current, long target)
    Parameters
    Type Name Description
    long current

    How much is done. Negative values are clamped to zero.

    long target

    How much is asked for. Zero means the requirement is already met.

    AchievementConditionProgress(long, long, float)

    Creates a progress carrying an explicitly measured fraction.

    Declaration
    public AchievementConditionProgress(long current, long target, float normalized)
    Parameters
    Type Name Description
    long current

    How much is done. Negative values are clamped to zero.

    long target

    How much is asked for. Negative values are clamped to zero.

    float normalized

    The 0..1 fraction. Values outside that range are clamped.

    Fields

    Current

    How much of the requirement is done. Never negative.

    Declaration
    public readonly long Current
    Field Value
    Type Description
    long

    Normalized

    The same progress as a 0..1 fraction.

    Declaration
    public readonly float Normalized
    Field Value
    Type Description
    float

    Target

    How much the requirement asks for. Never negative.

    Declaration
    public readonly long Target
    Field Value
    Type Description
    long

    Properties

    IsComplete

    Whether the requirement has been reached.

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

    Methods

    Boolean(bool)

    The progress of a condition that is either done or not, with no middle.

    Declaration
    public static AchievementConditionProgress Boolean(bool isMet)
    Parameters
    Type Name Description
    bool isMet

    Whether the condition is satisfied.

    Returns
    Type Description
    AchievementConditionProgress

    Equals(AchievementConditionProgress)

    Declaration
    public bool Equals(AchievementConditionProgress other)
    Parameters
    Type Name Description
    AchievementConditionProgress 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()

    Operators

    operator ==(AchievementConditionProgress, AchievementConditionProgress)

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

    operator !=(AchievementConditionProgress, AchievementConditionProgress)

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

    Implements

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