Class UiState
Mutable runtime state of the game UI. Tracks which screen is active and the current HUD and results states. UI is treated as state, not as widgets—this entity captures what the UI represents.
Inherited Members
Namespace: Serenity.GameUi.Domain.Entities
Assembly: Serenity.GameUi.Domain.dll
Syntax
public class UiState
Constructors
UiState()
Creates a new UiState with default values.
Declaration
public UiState()
Properties
ActiveScreen
Gets the currently active screen identifier.
Declaration
public UiScreenId ActiveScreen { get; }
Property Value
| Type | Description |
|---|---|
| UiScreenId |
Hud
Gets the current HUD state.
Declaration
public HudState Hud { get; }
Property Value
| Type | Description |
|---|---|
| HudState |
Results
Gets the current results screen state.
Declaration
public ResultsState Results { get; }
Property Value
| Type | Description |
|---|---|
| ResultsState |
Methods
HideHud()
Hides the HUD.
Declaration
public void HideHud()
HideResults()
Hides the results screen.
Declaration
public void HideResults()
SetActiveScreen(UiScreenId)
Sets the active screen.
Declaration
public void SetActiveScreen(UiScreenId screenId)
Parameters
| Type | Name | Description |
|---|---|---|
| UiScreenId | screenId | The screen to activate. |
SetHudState(HudState)
Updates the HUD state.
Declaration
public void SetHudState(HudState hudState)
Parameters
| Type | Name | Description |
|---|---|---|
| HudState | hudState | The new HUD state. |
SetResultsState(ResultsState)
Updates the results screen state.
Declaration
public void SetResultsState(ResultsState resultsState)
Parameters
| Type | Name | Description |
|---|---|---|
| ResultsState | resultsState | The new results state. |
ShowHud()
Shows the HUD with default settings.
Declaration
public void ShowHud()
ShowResults(bool, float)
Shows the results screen with the specified outcome.
Declaration
public void ShowResults(bool isVictory, float finalTime)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | isVictory | Whether the session was a victory. |
| float | finalTime | The final elapsed time in seconds. |