Table of Contents

Class SceneGameHost

Namespace
Axolotl2D.Scenes
Assembly
Axolotl2D.dll

Hosts the game and owns the active scene DI scopes.

public sealed class SceneGameHost : IGameHost, IHostedService
Inheritance
SceneGameHost
Implements
Inherited Members

Constructors

SceneGameHost(Game, IServiceScopeFactory, AxolotlModuleRegistry, IHostApplicationLifetime)

Hosts the game and owns the active scene DI scopes.

public SceneGameHost(Game game, IServiceScopeFactory scopeFactory, AxolotlModuleRegistry moduleRegistry, IHostApplicationLifetime applicationLifetime)

Parameters

game Game
scopeFactory IServiceScopeFactory
moduleRegistry AxolotlModuleRegistry
applicationLifetime IHostApplicationLifetime

Properties

CurrentScene

The topmost active scene.

public BaseScene? CurrentScene { get; }

Property Value

BaseScene

SceneCount

public int SceneCount { get; }

Property Value

int

Methods

ChangeScene(string)

Changes to a package scene registered under a stable ID.

public void ChangeScene(string id)

Parameters

id string

ChangeScene(Type)

Changes to a scene type discovered at runtime and clears every active layer.

public void ChangeScene(Type type)

Parameters

type Type

ChangeScene<T>()

public void ChangeScene<T>() where T : BaseScene

Type Parameters

T

PopScene()

Removes and disposes the top scene, preserving the base scene.

public bool PopScene()

Returns

bool

PushScene(string, SceneLayerOptions?)

Pushes a package scene registered under a stable ID.

public void PushScene(string id, SceneLayerOptions? options = null)

Parameters

id string
options SceneLayerOptions?

PushScene(Type, SceneLayerOptions?)

Pushes a scene type discovered at runtime.

public void PushScene(Type type, SceneLayerOptions? options = null)

Parameters

type Type
options SceneLayerOptions?

PushScene<T>(SceneLayerOptions?)

Pushes an overlay scene that blocks lower updates while drawing over them.

public void PushScene<T>(SceneLayerOptions? options = null) where T : BaseScene

Parameters

options SceneLayerOptions?

Type Parameters

T

StartAsync(CancellationToken)

Triggered when the application host is ready to start the service.

public Task StartAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Indicates that the start process has been aborted.

Returns

Task

A Task that represents the asynchronous Start operation.

StopAsync(CancellationToken)

Triggered when the application host is performing a graceful shutdown.

public Task StopAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Indicates that the shutdown process should no longer be graceful.

Returns

Task

A Task that represents the asynchronous Stop operation.