logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityGameUiService

    Unity MonoBehaviour implementation of IGameUiService.

    Inheritance
    object
    UnityGameUiService
    Implements
    IGameUiService
    IService
    IFoundationSettings
    Namespace: Serenity.GameUi.Infrastructure.Services
    Assembly: Serenity.UnityGameUi.Infrastructure.dll
    Syntax
    public class UnityGameUiService : MonoBehaviour, IGameUiService, IService, IFoundationSettings
    Remarks

    Delegates state tracking to UiState and forwards rendering commands to injected IGameHudPresenter, IGameResultsPresenter, and IGameScreenPresenter instances.

    Also the ShowHudSignal/HideHudSignal bridge: gameplay code, menu navigation, and those two signals all go through this one service, so a HUD can be shown or hidden with no generated code from a SignalEmitterComponent — mirrors how UnityFeedbackService subscribes itself to PlayFeedbackSignal.

    Constructors

    UnityGameUiService()

    Declaration
    public UnityGameUiService()

    Fields

    LOG_CATEGORY

    Declaration
    protected const string LOG_CATEGORY = "GameUiService"
    Field Value
    Type Description
    string

    _eventDispatcherService

    Declaration
    protected IEventDispatcherService _eventDispatcherService
    Field Value
    Type Description
    IEventDispatcherService

    _guid

    Declaration
    protected string _guid
    Field Value
    Type Description
    string

    _hudPresenter

    Declaration
    protected IGameHudPresenter _hudPresenter
    Field Value
    Type Description
    IGameHudPresenter

    _id

    Declaration
    protected string _id
    Field Value
    Type Description
    string

    _logService

    Declaration
    protected ILogService _logService
    Field Value
    Type Description
    ILogService

    _resultsPresenter

    Declaration
    protected IGameResultsPresenter _resultsPresenter
    Field Value
    Type Description
    IGameResultsPresenter

    _screenPresenter

    Declaration
    protected IGameScreenPresenter _screenPresenter
    Field Value
    Type Description
    IGameScreenPresenter

    _uiState

    Declaration
    protected UiState _uiState
    Field Value
    Type Description
    UiState

    Properties

    ActiveScreen

    Declaration
    public UiScreenId ActiveScreen { get; }
    Property Value
    Type Description
    UiScreenId

    CurrentHudState

    Declaration
    public HudState CurrentHudState { get; }
    Property Value
    Type Description
    HudState

    CurrentResultsState

    Declaration
    public ResultsState CurrentResultsState { get; }
    Property Value
    Type Description
    ResultsState

    Guid

    Declaration
    public string Guid { get; set; }
    Property Value
    Type Description
    string

    Id

    Declaration
    public string Id { get; set; }
    Property Value
    Type Description
    string

    LogService

    Declaration
    public ILogService LogService { get; set; }
    Property Value
    Type Description
    ILogService

    Methods

    HideHud()

    Declaration
    public virtual void HideHud()

    HideResults()

    Declaration
    public virtual void HideResults()

    InitializeService(ILogService, IGameHudPresenter, IGameResultsPresenter, IGameScreenPresenter, IEventDispatcherService)

    Initializes the service with required dependencies.

    Declaration
    public virtual void InitializeService(ILogService logService, IGameHudPresenter hudPresenter, IGameResultsPresenter resultsPresenter, IGameScreenPresenter screenPresenter, IEventDispatcherService eventDispatcherService = null)
    Parameters
    Type Name Description
    ILogService logService

    The logging service for diagnostic output.

    IGameHudPresenter hudPresenter

    The HUD presenter implementation.

    IGameResultsPresenter resultsPresenter

    The results screen presenter implementation.

    IGameScreenPresenter screenPresenter

    The screen navigation presenter implementation.

    IEventDispatcherService eventDispatcherService

    Dispatcher this service subscribes to for ShowHudSignal/HideHudSignal, so a HUD can be shown or hidden with no generated code. Optional: null skips the subscription (e.g. in a test that only exercises the presenter-forwarding API).

    SetActiveScreen(UiScreenId)

    Declaration
    public virtual void SetActiveScreen(UiScreenId screenId)
    Parameters
    Type Name Description
    UiScreenId screenId

    SetHudState(HudState)

    Declaration
    public virtual void SetHudState(HudState hudState)
    Parameters
    Type Name Description
    HudState hudState

    ShowHud()

    Declaration
    public virtual void ShowHud()

    ShowResults(bool, float)

    Declaration
    public virtual void ShowResults(bool isVictory, float finalTime)
    Parameters
    Type Name Description
    bool isVictory
    float finalTime

    Implements

    IGameUiService
    IService
    IFoundationSettings
    In this article
    © 2026 Serenity. All Rights Reserved