Skip to content

API reference

Class AssetLoaderRegistry

Namespace: MicroEngine.Content
Assembly: MicroEngine.Content.dll
Guide: Assets

The loaders of a store, one per kind. The engine registers its own (images, atlases, fonts, sounds, music); a game or module adds kinds of its own, or replaces one by registering another loader with the same kind before the first load of that kind.

C#
public sealed class AssetLoaderRegistry

Inheritance

object ← AssetLoaderRegistry

Constructors

AssetLoaderRegistry()

C#
public AssetLoaderRegistry()

Properties

Kinds

The kinds registered, in ordinal order.

C#
public IReadOnlyList<string> Kinds { get; }

Property Value

IReadOnlyList<string>

Methods

Add(IAssetLoader)

Registers loader, replacing any loader of the same kind.

C#
public AssetLoaderRegistry Add(IAssetLoader loader)

Parameters

loader IAssetLoader

Returns

AssetLoaderRegistry

This registry, for chaining.

Get(string)

The loader of kind.

C#
public IAssetLoader Get(string kind)

Parameters

kind string

Returns

IAssetLoader

Exceptions

InvalidOperationException

No loader of that kind is registered; the message lists those that are.

KindOf(string)

The kind of the loader whose Extensions holds path’s extension (the first registered), or null.

C#
public string? KindOf(string path)

Parameters

path string

Returns

string?

TryGet(string, out IAssetLoader?)

The loader of kind, if one is registered.

C#
public bool TryGet(string kind, out IAssetLoader? loader)

Parameters

kind string

loader IAssetLoader?

Returns

bool