| | 1 | | using DCLServices.MapRendererV2.CoordsUtils; |
| | 2 | | using DCLServices.MapRendererV2.Culling; |
| | 3 | | using System.Threading; |
| | 4 | | using UnityEngine; |
| | 5 | |
|
| | 6 | | namespace DCLServices.MapRendererV2.MapLayers |
| | 7 | | { |
| | 8 | | internal abstract class MapLayerControllerBase |
| | 9 | | { |
| 2652 | 10 | | protected ICoordsUtils coordsUtils { get; } |
| 780 | 11 | | protected CancellationTokenSource ctsDisposing { get; } |
| 10448 | 12 | | protected Transform instantiationParent { get; } |
| 0 | 13 | | protected IMapCullingController mapCullingController { get; } |
| | 14 | |
|
| 864 | 15 | | protected MapLayerControllerBase(Transform instantiationParent, ICoordsUtils coordsUtils, IMapCullingController |
| | 16 | | { |
| 864 | 17 | | ctsDisposing = new CancellationTokenSource(); |
| 864 | 18 | | this.coordsUtils = coordsUtils; |
| 864 | 19 | | this.instantiationParent = instantiationParent; |
| 864 | 20 | | this.mapCullingController = cullingController; |
| 864 | 21 | | } |
| | 22 | |
|
| | 23 | | public void Dispose() |
| | 24 | | { |
| 54 | 25 | | ctsDisposing.Cancel(); |
| 54 | 26 | | ctsDisposing.Dispose(); |
| 54 | 27 | | DisposeImpl(); |
| 54 | 28 | | } |
| | 29 | |
|
| 6 | 30 | | protected virtual void DisposeImpl() { } |
| | 31 | |
|
| | 32 | |
|
| | 33 | | protected CancellationTokenSource LinkWithDisposeToken(CancellationToken globalCancellation) => |
| 480 | 34 | | CancellationTokenSource.CreateLinkedTokenSource(globalCancellation, ctsDisposing.Token); |
| | 35 | | } |
| | 36 | | } |