Interface IEntityLoaderService
Defines an IService that allows for loading of any IEntity.
The IEntityLoaderService makes the assumption that the IData associated with the Entity being loaded has been stored inside the IDataService.
Namespace: IdleKit.Gameplay
Assembly: cs.temp.dll.dll
Syntax
public interface IEntityLoaderService : IService
Methods
LoadAllEntities<TReturn, TData>()
Loads all IEntity of a given type that have an associated IEntityData held in the IContainer. If the IEntity does not exist in the IContainer, one will be created and cached in the IContainer.
Declaration
TReturn[] LoadAllEntities<TReturn, TData>()
where TReturn : class, IEntity where TData : class, IEntityData
Returns
Type | Description |
---|---|
TReturn[] | The loaded IEntity. |
Type Parameters
Name | Description |
---|---|
TReturn | |
TData |
LoadEntities<TReturn, TData>(String[])
Loads all IEntity based on the requested data Ids specified in dataIds
.
If the IEntity is not found in the IContainer, one will be created and stored
in IContainer.
Declaration
TReturn[] LoadEntities<TReturn, TData>(string[] dataIds)
where TReturn : class, IEntity where TData : class, IEntityData
Parameters
Type | Name | Description |
---|---|---|
String[] | dataIds |
Returns
Type | Description |
---|---|
TReturn[] | The loaded IEntity. |
Type Parameters
Name | Description |
---|---|
TReturn | |
TData |
Remarks
The Ids specified via dataIds
must all be for the same IEntity type.
LoadEntity<TReturn, TData>(String)
Loads the IEntity providing the dataId
.
If no cached IEntity is found in the IContainer, then one will be created via
the IEntityData associated with he dataId
and stored in the
IContainer.
Declaration
TReturn LoadEntity<TReturn, TData>(string dataId)
where TReturn : class, IEntity where TData : class, IEntityData
Parameters
Type | Name | Description |
---|---|---|
String | dataId |
Returns
Type | Description |
---|---|
TReturn | The loaded IEntity. |
Type Parameters
Name | Description |
---|---|
TReturn | |
TData |
UnloadEntities<TEntity>(TEntity[])
The batch version of the UnloadEntity<TEntity>(TEntity).
Declaration
void UnloadEntities<TEntity>(TEntity[] entities)
where TEntity : class, IEntity
Parameters
Type | Name | Description |
---|---|---|
TEntity[] | entities |
Type Parameters
Name | Description |
---|---|
TEntity |
UnloadEntity<TEntity>(TEntity)
All IEntity loaded by LoadEntity<TReturn, TData>(String) must be unloaded by the UnloadEntity<TEntity>(TEntity) from the cache IContainer when the IEntity is no longer requires (i.e: moving to a new IContent or IStage.
It should unload the IEntity from the IContainer and call
Cleanup(IEntityLoaderService) on the IEntity to cleanup IEntity own by the
entity
.
Declaration
void UnloadEntity<TEntity>(TEntity entity)
where TEntity : class, IEntity
Parameters
Type | Name | Description |
---|---|---|
TEntity | entity |
Type Parameters
Name | Description |
---|---|
TEntity |