Class MapTileManager
public class MapTileManager : MonoSingleton<MapTileManager>, IDisposable
- Inheritance
-
MapTileManager
- Implements
- Inherited Members
Fields
OnTileFetched
public UnityEvent<Vector2Int, Tile> OnTileFetched
Field Value
- UnityEvent<Vector2Int, Tile>
OnTilesFetched
public UnityEvent<List<Tile>> OnTilesFetched
Field Value
canCacheTiles
public bool canCacheTiles
Field Value
Properties
ActiveDownloader
public DownloaderTiles ActiveDownloader { get; }
Property Value
DbConnection
public SQLiteConnection DbConnection { get; }
Property Value
- SQLiteConnection
DirectoryPath
public string DirectoryPath { get; }
Property Value
FilePath
public string FilePath { get; }
Property Value
HasValidFile
public bool HasValidFile { get; }
Property Value
canFetchOnline
public bool canFetchOnline { get; }
Property Value
Methods
CancelFetch(string)
public void CancelFetch(string threadId)
Parameters
threadIdstring
CancelRegionDownload()
Cancels the currently running region download, if any.
public void CancelRegionDownload()
CreateDatabase(out SQLiteConnection)
public bool CreateDatabase(out SQLiteConnection connection)
Parameters
connectionSQLiteConnection
Returns
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
FetchTile(Vector2Int, int, bool, UnityAction<Tile>, out string)
public void FetchTile(Vector2Int coordinate, int zoomLevel, bool showLabels, UnityAction<Tile> onComplete, out string threadId)
Parameters
GetCenterTile(int)
public Tile GetCenterTile(int zoomLevel)
Parameters
zoomLevelint
Returns
GetCenterTileAsync(int, UnityAction<Tile>, UnityAction<Exception>)
Asynchronous version of GetCenterTile - runs the query on the ThreadManager and returns on main thread.
public void GetCenterTileAsync(int zoomLevel, UnityAction<Tile> onComplete, UnityAction<Exception> onError = null)
Parameters
GetRegionCoverage(MapFile, UnityAction<float>, UnityAction<Exception>)
Asynchronously checks what fraction of region's tiles are already stored
in the offline DB. Returns 0.0 (nothing downloaded) to 1.0 (region fully available).
public void GetRegionCoverage(MapFile region, UnityAction<float> onResult, UnityAction<Exception> onError = null)
Parameters
GetTile(int, int, int, SQLiteConnection)
public static Tile GetTile(int x, int y, int zoomLevel, SQLiteConnection connection)
Parameters
Returns
GetTile(Vector2Int, int)
public Tile GetTile(Vector2Int coordinate, int zoomLevel)
Parameters
coordinateVector2IntzoomLevelint
Returns
GetTileAsync(Vector2Int, int, UnityAction<Tile>, UnityAction<Exception>)
Asynchronous version of GetTile - runs the query on a background thread and returns the result on the main thread.
public void GetTileAsync(Vector2Int coordinate, int zoomLevel, UnityAction<Tile> onComplete, UnityAction<Exception> onError = null)
Parameters
HasCachedTile(Vector2Int, out Tile, bool)
public bool HasCachedTile(Vector2Int coordinate, out Tile tile, bool withLabels)
Parameters
Returns
IsRegionAvailable(string, Action<bool>, UnityAction<Exception>)
Looks up regionName in Regions then checks
availability. Calls onResult with false if the name is not in the catalog.
public void IsRegionAvailable(string regionName, Action<bool> onResult, UnityAction<Exception> onError = null)
Parameters
IsRegionAvailable(MapFile, Action<bool>, UnityAction<Exception>)
Asynchronously checks whether region is fully available offline.
Calls onResult with true if coverage is 100%, false otherwise.
public void IsRegionAvailable(MapFile region, Action<bool> onResult, UnityAction<Exception> onError = null)
Parameters
OnDestroy()
Unity lifecycle: clears the static instance reference when this object is destroyed.
protected override void OnDestroy()
RevealDatabaseInFileExplorer()
public void RevealDatabaseInFileExplorer()
StartRegionDownload(MapFile, Action<float>, Action, Action)
Starts downloading all tiles for region into the unified offline DB.
Only missing tiles are fetched — already-downloaded tiles are skipped automatically.
public void StartRegionDownload(MapFile region, Action<float> onProgress = null, Action onComplete = null, Action onCancelled = null)
Parameters
regionMapFileRegion bounds and zoom range to download.
onProgressAction<float>Called every frame with 0–1 progress while downloading.
onCompleteActionCalled once when all tiles have been saved.
onCancelledActionCalled if the download is cancelled via CancelRegionDownload().
StartStreamFetch(List<Vector2Int>, int, bool)
public void StartStreamFetch(List<Vector2Int> enqueuedTiles, int zoomLevel, bool showLabels)