Class TileDataManager<T>
Manages the loading and unloading of data tiles.
Namespace: Holoride.ElasticSDK
Assembly: Holoride.ElasticSDK.Library.Runtime.dll
Syntax
public class TileDataManager<T> where T : class
Type Parameters
Name | Description |
---|---|
T |
Constructors
TileDataManager(int, float, ITileDataProvider<T>)
The base constructor of a TileDataManager.
Declaration
public TileDataManager(int zoomLevel, float extents, ITileDataProvider<T> tileDataProvider)
Parameters
Type | Name | Description |
---|---|---|
int | zoomLevel | The zoom level. |
float | extents | The extents of the area in which tiles should be kept in memory. |
ITileDataProvider<T> | tileDataProvider | The tile data provider. |
Methods
GetTile(Vector2Int)
Gets a specific tile at a given global position.
Declaration
public T GetTile(Vector2Int tilePos)
Parameters
Type | Name | Description |
---|---|---|
Vector2Int | tilePos | The tile position. |
Returns
Type | Description |
---|---|
T |
GetTiles(TileAreaDescription)
Returns an IEnumerable T for all Tiles in the TileAreaDescription.
Declaration
public IEnumerable<T> GetTiles(TileAreaDescription tileAreaDescription)
Parameters
Type | Name | Description |
---|---|---|
TileAreaDescription | tileAreaDescription | The area for which to return tiles. |
Returns
Type | Description |
---|---|
IEnumerable<T> | All tiles in the given area. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Throws an ArgumentException in case the provided TileAreaDescription isn't fully contained in the supported area of this TileDataManager. |
HasTile(Vector2Int)
Checks if a tile is currently in the memory.
Declaration
public bool HasTile(Vector2Int tilePos)
Parameters
Type | Name | Description |
---|---|---|
Vector2Int | tilePos | The tile position. |
Returns
Type | Description |
---|---|
bool | True, if the tile was already downloaded. |
LoadResourcesAsync(TileAreaDescription, Action<Vector2Int, T>, Action<Vector2Int, T>, IProgress<float>, CancellationToken)
Loads all the resources that are not already available.
Declaration
public UniTask LoadResourcesAsync(TileAreaDescription tileAreaDescription, Action<Vector2Int, T> onTileLoaded = null, Action<Vector2Int, T> onTileUnloaded = null, IProgress<float> onProgressUpdate = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
TileAreaDescription | tileAreaDescription | The tile array. |
Action<Vector2Int, T> | onTileLoaded | The function to call when the tile is loaded. This function is called on a separate thread, e.g. in order to deserialize data in a background process. |
Action<Vector2Int, T> | onTileUnloaded | The function to call when the tile is unloaded. |
IProgress<float> | onProgressUpdate | Called with relative progress in [0, 1]. |
CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Cysharp.Threading.Tasks.UniTask |