logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class CompletionSection

    ISaveSection holding this save slot's completion percentage and accumulated playtime.

    Inheritance
    object
    CompletionSection
    Implements
    ISaveSection
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    Namespace: Serenity.GameSave.Domain.Sections
    Assembly: Serenity.GameSave.Domain.dll
    Syntax
    public sealed class CompletionSection : ISaveSection

    Constructors

    CompletionSection()

    Declaration
    public CompletionSection()

    Fields

    KEY

    The section key this section is stored under.

    Declaration
    public const string KEY = "completion"
    Field Value
    Type Description
    string

    Properties

    CompletionPercent

    The completion percentage, always clamped to the [0, 100] range.

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

    PlaytimeSeconds

    The accumulated playtime, in seconds.

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

    SectionKey

    The stable key this section is stored under within a SaveDocument.

    Declaration
    public string SectionKey { get; }
    Property Value
    Type Description
    string

    Methods

    AddPlaytime(double)

    Accumulates seconds of playtime. Non-positive values are ignored.

    Declaration
    public void AddPlaytime(double seconds)
    Parameters
    Type Name Description
    double seconds

    Deserialize(string)

    Restores this section's state from payload. A null or empty payload (no prior save, or a brand-new slot) resets this section to its default state.

    Declaration
    public void Deserialize(string payload)
    Parameters
    Type Name Description
    string payload

    Serialize()

    Serializes this section's current state to JSON.

    Declaration
    public string Serialize()
    Returns
    Type Description
    string

    SetCompletionPercent(double)

    Sets the completion percentage, clamping it to the [0, 100] range.

    Declaration
    public void SetCompletionPercent(double completionPercent)
    Parameters
    Type Name Description
    double completionPercent

    Implements

    ISaveSection
    In this article
    © 2026 Serenity. All Rights Reserved