public SkyIslandMapChunk(ChunkOverheadKey key, IBoundedIndexable <Index2D, SkyIslandMaps> values) { Contracts.Requires.That(values != null); this.Key = key; this.MapsLocalView = values; this.MapsStageView = new OffsetArray2D <SkyIslandMaps>(values, values.Dimensions * key.Index); }
/// <inheritdoc /> public async Task <TChunk> CreateAsync(ChunkOverheadKey key) { if (key.Index.IsIn(this.minKey, this.maxKey)) { return(await this.interiorFactory.CreateAsync(key).DontMarshallContext()); } else { return(this.exteriorFactory.Create(key)); } }
/// <inheritdoc /> public async Task <IDisposableValue <ISkyIslandMapChunk> > CreateAsync(ChunkOverheadKey key) { var resources = await this.pool.TakeLoanAsync().DontMarshallContext(); try { var chunk = new SkyIslandMapChunk(key, resources.Value.Maps); await this.populator.PopulateAsync(chunk).DontMarshallContext(); return(new CompositeDisposableWrapper <ISkyIslandMapChunk>(chunk, resources)); } catch (Exception) { resources.Dispose(); throw; } }
public static bool Contains(this IStageBounds bounds, ChunkOverheadKey key) { Contracts.Requires.That(bounds != null); return(key.Index.IsIn(bounds.InOverheadChunks.LowerBounds, bounds.InOverheadChunks.UpperBounds)); }