logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Struct HudState

    Immutable snapshot of the HUD (Heads-Up Display) state. Represents what the HUD should display, not how it is rendered.

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

    Constructors

    HudState(bool, bool)

    Creates a new HudState with the specified visibility and pause state.

    Declaration
    public HudState(bool isVisible, bool isPaused)
    Parameters
    Type Name Description
    bool isVisible

    Whether the HUD is visible.

    bool isPaused

    Whether the HUD is in a paused state.

    HudState(bool, bool, string)

    Creates a new HudState that also names which HUD definition to show.

    Declaration
    public HudState(bool isVisible, bool isPaused, string activeHudId)
    Parameters
    Type Name Description
    bool isVisible

    Whether the HUD is visible.

    bool isPaused

    Whether the HUD is in a paused state.

    string activeHudId

    The HUD definition to show; empty to leave the current one in place.

    Fields

    ActiveHudId

    The id of the HUD definition to show, or empty when the presenter should keep whatever it already has.

    Declaration
    public readonly string ActiveHudId
    Field Value
    Type Description
    string
    Remarks

    Lets a project hold several authored HUDs (one per game mode, say) and switch between them as state, which is how the rest of this aggregate is modelled — the service names what the UI represents and the presenter decides how to render it.

    IsPaused

    Whether the HUD is in a paused display state.

    Declaration
    public readonly bool IsPaused
    Field Value
    Type Description
    bool

    IsVisible

    Whether the HUD is currently visible.

    Declaration
    public readonly bool IsVisible
    Field Value
    Type Description
    bool

    Properties

    Default

    A default HudState with the HUD visible and not paused.

    Declaration
    public static HudState Default { get; }
    Property Value
    Type Description
    HudState

    HasActiveHudId

    Whether a specific HUD definition is named.

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

    Hidden

    A HudState representing a hidden HUD.

    Declaration
    public static HudState Hidden { get; }
    Property Value
    Type Description
    HudState

    Methods

    Equals(HudState)

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

    Renders the state for logs. The HUD id is only appended when one is set, so the long-standing two-flag format is unchanged for states that do not name a definition.

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

    WithActiveHudId(string)

    Returns this state with a different HUD definition named.

    Declaration
    public HudState WithActiveHudId(string activeHudId)
    Parameters
    Type Name Description
    string activeHudId

    The HUD definition to show; empty to leave the current one in place.

    Returns
    Type Description
    HudState

    Operators

    operator ==(HudState, HudState)

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

    operator !=(HudState, HudState)

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

    Implements

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