Class AssetConfiguration
- Namespace
- Icy.Configuration
- Assembly
- IcyUI.dll
Represents configuration for the library assets.
public sealed class AssetConfiguration : IDisposable
- Inheritance
-
AssetConfiguration
- Implements
- Inherited Members
- Extension Methods
Constructors
AssetConfiguration(AssetContext)
Initializes a new instance of the AssetConfiguration class.
public AssetConfiguration(AssetContext defaultAssetContext)
Parameters
defaultAssetContextAssetContextThe root UI asset context.
Properties
AssetContextFactory
Gets or sets an instance of the asset context factory to use with current configuration.
public IAssetContextFactory AssetContextFactory { get; set; }
Property Value
AssetResolver
Gets or sets an instance of the asset resolver used in the library.
public IAssetResolver AssetResolver { get; set; }
Property Value
DefaultAssetContext
Gets or sets the default context to use with assets loading.
public IAssetContext DefaultAssetContext { get; set; }
Property Value
Localizer
Gets or sets where localized strings come from.
public ILocalizer Localizer { get; set; }
Property Value
Remarks
Defaults to an empty DictionaryLocalizer: every key shows as is until the game sets one (see WithLocalizer(IAssetConfigurationBuilder, ILocalizer)).
SharedResources
Gets or sets resources registry used in the library.
public IResourceRegistry SharedResources { get; set; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
LoadAsync<T>(string)
Loads an asset asynchronously from a path relative to DefaultAssetContext.
public ValueTask<T> LoadAsync<T>(string path) where T : class
Parameters
pathstringThe asset's path.
Returns
- ValueTask<T>
The loaded asset.
Type Parameters
TThe asset type.
Exceptions
- FileNotFoundException
The file doesn't exist.
- InvalidOperationException
No importer handles the file's format.
Load<T>(string)
Loads an asset from a path relative to DefaultAssetContext (the application folder unless changed), through the importers registered on AssetResolver.
public T Load<T>(string path) where T : class
Parameters
pathstringThe asset's path, for example
"UI/Menu.xml".
Returns
- T
The loaded asset.
Type Parameters
TThe asset type, such as UIElement for a markup file.
Exceptions
- FileNotFoundException
The file doesn't exist.
- InvalidOperationException
No importer handles the file's format.